예제 #1
0
        /// <summary>
        /// Function to perform the creation of a specific kind of view.
        /// </summary>
        /// <returns>The view that was created.</returns>
        private protected override D3D11.ResourceView OnCreateNativeView()
        {
            Graphics.Log.Print($"Creating D3D11 buffer unordered access view for {Buffer.Name}.", LoggingLevel.Verbose);

            var desc = new D3D11.UnorderedAccessViewDescription1
            {
                Dimension = D3D11.UnorderedAccessViewDimension.Buffer,
                Buffer    =
                {
                    FirstElement = StartElement,
                    ElementCount = ElementCount,
                    Flags        = D3D11.UnorderedAccessViewBufferFlags.None
                },
                Format = (Format)Format
            };

            Native = new D3D11.UnorderedAccessView1(Resource.Graphics.D3DDevice, Resource.D3DResource, desc)
            {
                DebugName = $"'{Buffer.Name}'_D3D11UnorderedAccessView1"
            };

            Graphics.Log.Print($"Unordered Access Buffer View '{Buffer.Name}': {Buffer.ResourceType} -> Start: {StartElement}, Count: {ElementCount}, Element Size: {ElementSize}",
                               LoggingLevel.Verbose);

            return(Native);
        }
예제 #2
0
        /// <summary>
        /// Function to perform the creation of a specific kind of view.
        /// </summary>
        /// <returns>The view that was created.</returns>
        private protected override D3D11.ResourceView OnCreateNativeView()
        {
            D3D11.UnorderedAccessViewDescription1 desc = GetDesc2D(Texture);

            Graphics.Log.Print($"Creating D3D11 2D texture unordered access view for {Texture.Name}.", LoggingLevel.Verbose);

            try
            {
                // Create our SRV.
                Native = new D3D11.UnorderedAccessView1(Resource.Graphics.D3DDevice, Resource.D3DResource, desc)
                {
                    DebugName = $"'{Texture.Name}'_D3D11UnorderedAccessView1_2D"
                };

                Graphics.Log.Print($"Unordered Access 2D View '{Texture.Name}': {Texture.ResourceType} -> Mip slice: {MipSlice}, Array Index: {ArrayIndex}, Array Count: {ArrayCount}",
                                   LoggingLevel.Verbose);
            }
            catch (DX.SharpDXException sDXEx)
            {
                if ((uint)sDXEx.ResultCode.Code == 0x80070057)
                {
                    throw new GorgonException(GorgonResult.CannotCreate,
                                              string.Format(Resources.GORGFX_ERR_VIEW_CANNOT_CAST_FORMAT,
                                                            Texture.Format,
                                                            Format));
                }

                throw;
            }

            return(Native);
        }
예제 #3
0
        /// <summary>
        /// Function to initialize the unordered access view.
        /// </summary>
        private protected override D3D11.ResourceView OnCreateNativeView()
        {
            Graphics.Log.Print($"Creating D3D11 raw buffer unordered resource view for {Buffer.Name}.", LoggingLevel.Simple);

            BufferFormat format = BufferFormat.Unknown;

            switch (ElementType)
            {
            case RawBufferElementType.Int32:
                format = BufferFormat.R32_SInt;
                break;

            case RawBufferElementType.UInt32:
                format = BufferFormat.R32_UInt;
                break;

            case RawBufferElementType.Single:
                format = BufferFormat.R32_Float;
                break;
            }

            var desc = new D3D11.UnorderedAccessViewDescription1
            {
                Dimension = D3D11.UnorderedAccessViewDimension.Buffer,
                Buffer    =
                {
                    FirstElement = StartElement,
                    ElementCount = ElementCount,
                    Flags        = D3D11.UnorderedAccessViewBufferFlags.Raw
                },
                Format = (Format)format
            };

            Native = new D3D11.UnorderedAccessView1(Resource.Graphics.D3DDevice, Resource.D3DResource, desc)
            {
                DebugName = $"'{Buffer.Name}'_D3D11UnorderedResourceView1_Raw"
            };

            Graphics.Log.Print($"Unordered Resource Raw Buffer View '{Buffer.Name}': {Buffer.ResourceType} -> Start: {StartElement}, Count: {ElementCount}, Element Size: {ElementSize}, ElementType(Format): {ElementType}({format})",
                               LoggingLevel.Verbose);

            return(Native);
        }
예제 #4
0
        /// <summary>
        /// Function to perform the creation of a specific kind of view.
        /// </summary>
        /// <returns>The view that was created.</returns>
        private protected override D3D11.ResourceView OnCreateNativeView()
        {
            var desc = new D3D11.UnorderedAccessViewDescription1
            {
                Format    = (Format)Format,
                Dimension = D3D11.UnorderedAccessViewDimension.Texture3D,
                Texture3D =
                {
                    MipSlice    = MipSlice,
                    FirstWSlice = StartDepthSlice,
                    WSize       = DepthSliceCount
                }
            };

            Graphics.Log.Print($"Creating 3D texture unordered access view for {Texture.Name}.", LoggingLevel.Verbose);

            try
            {
                // Create our SRV.
                Native = new D3D11.UnorderedAccessView1(Resource.Graphics.D3DDevice, Resource.D3DResource, desc)
                {
                    DebugName = $"'{Texture.Name}'_D3D11UnorderedAccessView1_3D"
                };

                Graphics.Log.Print($"Unordered Access 3D View '{Texture.Name}': {Texture.ResourceType} -> Mip slice: {MipSlice}, Starting depth slice: {StartDepthSlice}, Depth slice count: {DepthSliceCount}",
                                   LoggingLevel.Verbose);
            }
            catch (DX.SharpDXException sDXEx)
            {
                if ((uint)sDXEx.ResultCode.Code == 0x80070057)
                {
                    throw new GorgonException(GorgonResult.CannotCreate,
                                              string.Format(Resources.GORGFX_ERR_VIEW_CANNOT_CAST_FORMAT,
                                                            Texture.Format,
                                                            Format));
                }

                throw;
            }

            return(Native);
        }