public GraphicsBufferDescription(int sizeInBytes, ResourceFlags bufferFlags, GraphicsHeapType heapType, int structureByteStride = 0) { SizeInBytes = sizeInBytes; Flags = bufferFlags; HeapType = heapType; StructureByteStride = structureByteStride; }
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, }); }
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)); }
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))); }
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)); }
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, }); }
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)); }
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))); }
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, }); }
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)); }
public static GraphicsBuffer New(GraphicsDevice device, int size, GraphicsBufferFlags bufferFlags, GraphicsHeapType heapType = GraphicsHeapType.Default) { return(New(device, new GraphicsBufferDescription(size, bufferFlags, heapType))); }
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); }
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 }); }
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)); }