public GraphicsBufferDescription(int sizeInBytes, ResourceFlags bufferFlags, GraphicsHeapType heapType, int structureByteStride = 0)
 {
     SizeInBytes         = sizeInBytes;
     Flags               = bufferFlags;
     HeapType            = heapType;
     StructureByteStride = structureByteStride;
 }
Пример #2
0
 public static GraphicsBuffer Create(GraphicsDevice device, int size, int structureByteStride, ResourceFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(Create(device, new GraphicsBufferDescription(size, bufferFlags, heapType, structureByteStride)));
 }
 public static TextureDescription New2D(int width, int height, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, short mipCount = 1, short arraySize = 1, int sampleCount = 1, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(new TextureDescription
     {
         Dimension = TextureDimension.Texture2D,
         Width = width,
         Height = height,
         DepthOrArraySize = arraySize,
         SampleCount = sampleCount,
         Flags = textureFlags,
         Format = format,
         MipLevels = mipCount,
         HeapType = heapType,
     });
 }
Пример #4
0
 public static Texture New2D(GraphicsDevice device, int width, int height, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, short mipCount = 1, short arraySize = 1, int multisampleCount = 1, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(New(device, TextureDescription.New2D(width, height, format, textureFlags, mipCount, arraySize, multisampleCount, heapType)));
 }
 public static unsafe GraphicsBuffer <T> New <T>(GraphicsDevice device, Span <T> data, GraphicsHeapType heapType = GraphicsHeapType.Upload) where T : unmanaged
 {
     return(GraphicsBuffer.New(device, data, BufferFlags.ConstantBuffer, heapType));
 }
 public static unsafe GraphicsBuffer <T> New <T>(GraphicsDevice device, int elementCount, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
 {
     return(GraphicsBuffer.New <T>(device, elementCount, BufferFlags.IndexBuffer, heapType));
 }
 public static unsafe GraphicsBuffer New(GraphicsDevice device, int size, int structureByteStride, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(GraphicsBuffer.New(device, size, structureByteStride, BufferFlags.IndexBuffer, heapType));
 }
Пример #8
0
 public static Texture Create2D(GraphicsDevice device, int width, int height, PixelFormat format, ResourceFlags textureFlags = ResourceFlags.None, short mipLevels = 1, short arraySize = 1, int sampleCount = 1, int sampleQuality = 0, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(Create(device, TextureDescription.New2D(width, height, format, textureFlags, mipLevels, arraySize, sampleCount, sampleQuality, heapType)));
 }
Пример #9
0
        public static Texture Create2D <T>(GraphicsDevice device, Span <T> data, int width, int height, PixelFormat format, ResourceFlags textureFlags = ResourceFlags.None, short mipLevels = 1, short arraySize = 1, int sampleCount = 1, int sampleQuality = 0, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
        {
            Texture texture = Create2D(device, width, height, format, textureFlags, mipLevels, arraySize, sampleCount, sampleQuality, heapType);

            texture.SetData(data);

            return(texture);
        }
 public static unsafe GraphicsBuffer New(GraphicsDevice device, int size, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(GraphicsBuffer.New(device, size, BufferFlags.ShaderResource, heapType));
 }
Пример #11
0
 private static TextureDescription ConvertFromNativeDescription(ResourceDescription description, GraphicsHeapType heapType)
 {
     return(new TextureDescription
     {
         Dimension = (TextureDimension)description.Dimension,
         Width = (int)description.Width,
         Height = description.Height,
         DepthOrArraySize = description.DepthOrArraySize,
         MipLevels = description.MipLevels,
         Format = (PixelFormat)description.Format,
         Flags = (ResourceFlags)description.Flags,
         SampleDescription = new SampleDescription(description.SampleDescription.Count, description.SampleDescription.Quality),
         HeapType = heapType,
     });
 }
Пример #12
0
 public static unsafe GraphicsBuffer New(GraphicsDevice device, int size, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(GraphicsBuffer.New(device, size, BufferFlags.UnorderedAccess, heapType));
 }
 public static GraphicsBuffer New(GraphicsDevice device, int size, int structureByteStride, BufferFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(New(device, new BufferDescription(size, bufferFlags, heapType, structureByteStride)));
 }
 public static unsafe GraphicsBuffer New(GraphicsDevice device, int size, GraphicsHeapType heapType = GraphicsHeapType.Upload)
 {
     return(GraphicsBuffer.New(device, size, BufferFlags.ConstantBuffer, heapType));
 }
Пример #15
0
        public static GraphicsBuffer <T> Create <T>(GraphicsDevice device, int elementCount, int structureByteStride, ResourceFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
        {
            int size = structureByteStride * elementCount;

            return(new GraphicsBuffer <T>(device, new GraphicsBufferDescription(size, bufferFlags, heapType, structureByteStride)));
        }
Пример #16
0
        private static TextureDescription ConvertFromNativeDescription(ResourceDescription description, GraphicsHeapType heapType, bool isShaderResource = false)
        {
            ResourceFlags flags = ResourceFlags.None;

            if (description.Flags.HasFlag(Vortice.Direct3D12.ResourceFlags.AllowRenderTarget))
            {
                flags |= ResourceFlags.RenderTarget;
            }

            if (description.Flags.HasFlag(Vortice.Direct3D12.ResourceFlags.AllowUnorderedAccess))
            {
                flags |= ResourceFlags.UnorderedAccess;
            }

            if (description.Flags.HasFlag(Vortice.Direct3D12.ResourceFlags.AllowDepthStencil))
            {
                flags |= ResourceFlags.DepthStencil;
            }

            if (!description.Flags.HasFlag(Vortice.Direct3D12.ResourceFlags.DenyShaderResource) && isShaderResource)
            {
                flags |= ResourceFlags.ShaderResource;
            }

            return(new TextureDescription
            {
                Dimension = (TextureDimension)description.Dimension,
                Width = (int)description.Width,
                Height = description.Height,
                DepthOrArraySize = description.DepthOrArraySize,
                MipLevels = description.MipLevels,
                Format = (PixelFormat)description.Format,
                Flags = flags,
                SampleDescription = new SampleDescription(description.SampleDescription.Count, description.SampleDescription.Quality),
                HeapType = heapType,
            });
        }
Пример #17
0
 public static GraphicsBuffer <T> Create <T>(GraphicsDevice device, int elementCount, ResourceFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
 {
     return(Create <T>(device, elementCount, Unsafe.SizeOf <T>(), bufferFlags, heapType));
 }
 public static unsafe GraphicsBuffer <T> New <T>(GraphicsDevice device, Span <T> data, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
 {
     return(GraphicsBuffer.New(device, data, BufferFlags.VertexBuffer, heapType));
 }
 public static unsafe GraphicsBuffer <T> New <T>(GraphicsDevice device, Span <T> data, int structureByteStride, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
 {
     return(GraphicsBuffer.New(device, data, structureByteStride, BufferFlags.IndexBuffer, heapType));
 }
Пример #20
0
 public static GraphicsBuffer New(GraphicsDevice device, int size, GraphicsBufferFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(New(device, new GraphicsBufferDescription(size, bufferFlags, heapType)));
 }
Пример #21
0
        private static TextureDescription ConvertFromNativeDescription(ResourceDescription description, GraphicsHeapType heapType, bool isShaderResource = false)
        {
            TextureDescription textureDescription = new TextureDescription
            {
                Dimension        = TextureDimension.Texture2D,
                Width            = (int)description.Width,
                Height           = description.Height,
                SampleCount      = description.SampleDescription.Count,
                Format           = (PixelFormat)description.Format,
                MipLevels        = description.MipLevels,
                HeapType         = heapType,
                DepthOrArraySize = description.DepthOrArraySize,
                Flags            = TextureFlags.None
            };

            if (description.Flags.HasFlag(ResourceFlags.AllowRenderTarget))
            {
                textureDescription.Flags |= TextureFlags.RenderTarget;
            }

            if (description.Flags.HasFlag(ResourceFlags.AllowUnorderedAccess))
            {
                textureDescription.Flags |= TextureFlags.UnorderedAccess;
            }

            if (description.Flags.HasFlag(ResourceFlags.AllowDepthStencil))
            {
                textureDescription.Flags |= TextureFlags.DepthStencil;
            }

            if (!description.Flags.HasFlag(ResourceFlags.DenyShaderResource) && isShaderResource)
            {
                textureDescription.Flags |= TextureFlags.ShaderResource;
            }

            return(textureDescription);
        }
Пример #22
0
 public static TextureDescription New2D(int width, int height, PixelFormat format, ResourceFlags textureFlags = ResourceFlags.None, short mipLevels = 1, short arraySize = 1, int sampleCount = 1, int sampleQuality = 0, GraphicsHeapType heapType = GraphicsHeapType.Default)
 {
     return(new TextureDescription
     {
         Dimension = TextureDimension.Texture2D,
         Width = width,
         Height = height,
         DepthOrArraySize = arraySize,
         MipLevels = mipLevels,
         Format = format,
         Flags = textureFlags,
         SampleDescription = new SampleDescription(sampleCount, sampleQuality),
         HeapType = heapType
     });
 }
Пример #23
0
        public static Texture New2D <T>(GraphicsDevice device, Span <T> data, int width, int height, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, short mipCount = 1, short arraySize = 1, int sampleCount = 1, GraphicsHeapType heapType = GraphicsHeapType.Default) where T : unmanaged
        {
            Texture texture = New2D(device, width, height, format, textureFlags, mipCount, arraySize, sampleCount, heapType);

            texture.SetData(data);

            return(texture);
        }
 public static unsafe GraphicsBuffer <T> New <T>(GraphicsDevice device, int elementCount, GraphicsHeapType heapType = GraphicsHeapType.Upload) where T : unmanaged
 {
     return(GraphicsBuffer.New <T>(device, elementCount, BufferFlags.ConstantBuffer, heapType));
 }