Beispiel #1
0
        private Pointer <ID3D12Resource> CreateD3D12Resource()
        {
            _state.ThrowIfDisposedOrDisposing();

            ID3D12Resource *d3d12Resource;

            var textureDesc = Kind switch {
                GraphicsTextureKind.OneDimensional => D3D12_RESOURCE_DESC.Tex1D(DXGI_FORMAT_R8G8B8A8_UNORM, Width, mipLevels: 1),
                GraphicsTextureKind.TwoDimensional => D3D12_RESOURCE_DESC.Tex2D(DXGI_FORMAT_R8G8B8A8_UNORM, Width, Height, mipLevels: 1),
                GraphicsTextureKind.ThreeDimensional => D3D12_RESOURCE_DESC.Tex3D(DXGI_FORMAT_R8G8B8A8_UNORM, Width, Height, Depth, mipLevels: 1),
                _ => default,
Beispiel #2
0
        => TextureArray(dimension, format, width, height, depth);         // Tex arrays and 3D texs share the same field for depth/arrayCount so same creation process


        /// <summary>
        /// Creates a new <see cref="GpuResourceFormat"/> representing an array of 1 or 2 dimension textures
        /// </summary>
        /// <param name="dimension">The dimension of the textures in the array</param>
        /// <param name="format">The format of the textures in the array</param>
        /// <param name="width">The width of each texture</param>
        /// <param name="height">The height of each texture</param>
        /// <param name="arrayCount">The number of elements in the texture array</param>
        /// <returns>A new <see cref="GpuResourceFormat"/> representing an array of 1 or 2 dimensional textures</returns>
        public static GpuResourceFormat TextureArray(TextureDimension dimension, DXGI_FORMAT format, ulong width, uint height = 1, ushort arrayCount = 1)
        {
            // can't have 3D tex arrays
            Debug.Assert(dimension != TextureDimension.Tex3D);
            return(new GpuResourceFormat(D3D12_RESOURCE_DESC.Tex3D(format, width, height, arrayCount)));
        }