/// <summary> /// Creates a new 3D <see cref="Texture"/>. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="mipCount">Number of mipmaps, set to true to have all mipmaps, set to an int >=1 for a particular mipmap count.</param> /// <param name="format">Describes the format to use.</param> /// <param name="usage">The usage.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <returns> /// A new instance of 3D <see cref="Texture"/> class. /// </returns> public static Texture New3D(GraphicsDevice device, int width, int height, int depth, MipMapCount mipCount, PixelFormat format, DataBox[] textureData, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) { return new Texture(device).InitializeFrom(TextureDescription.New3D(width, height, depth, mipCount, format, textureFlags, usage), textureData); }
/// <summary> /// Creates a new 3D <see cref="Texture"/> with a single mipmap. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">Describes the format to use.</param> /// <param name="usage">The usage.</param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <returns> /// A new instance of 3D <see cref="Texture"/> class. /// </returns> public static Texture New3D(GraphicsDevice device, int width, int height, int depth, PixelFormat format, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) { return New3D(device, width, height, depth, false, format, textureFlags, usage); }
/// <summary> /// Creates a new 3D <see cref="Texture" /> with texture data for the firs map. /// </summary> /// <typeparam name="T">Type of the data to upload to the texture</typeparam> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="depth">The depth.</param> /// <param name="format">Describes the format to use.</param> /// <param name="usage">The usage.</param> /// <param name="textureData">The texture data, width * height * depth datas </param> /// <param name="textureFlags">true if the texture needs to support unordered read write.</param> /// <returns>A new instance of 3D <see cref="Texture" /> class.</returns> /// <remarks> /// The first dimension of mipMapTextures describes the number of is an array ot Texture3D Array /// </remarks> public static unsafe Texture New3D<T>(GraphicsDevice device, int width, int height, int depth, PixelFormat format, T[] textureData, TextureFlags textureFlags = TextureFlags.ShaderResource, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable) where T : struct { return New3D(device, width, height, depth, 1, format, new[] { GetDataBox(format, width, height, depth, textureData, (IntPtr)Interop.Fixed(textureData)) }, textureFlags, usage); }
public static DescriptorSetLayout New(GraphicsDevice device, DescriptorSetLayoutBuilder builder) { return(new DescriptorSetLayout(device, builder)); }
private DescriptorSetLayout(GraphicsDevice device, DescriptorSetLayoutBuilder builder) { ElementCount = builder.ElementCount; Entries = builder.Entries.ToArray(); }
public NativeResourceCollector(GraphicsDevice graphicsDevice) : base(graphicsDevice) { }
protected TemporaryResourceCollector(GraphicsDevice graphicsDevice) { GraphicsDevice = graphicsDevice; }
public HeapPool(GraphicsDevice graphicsDevice) : base(graphicsDevice) { }
public GraphicsResourceLinkCollector(GraphicsDevice graphicsDevice) : base(graphicsDevice) { }
protected ResourcePool(GraphicsDevice graphicsDevice) { GraphicsDevice = graphicsDevice; }
/// <summary> /// Creates a new Typed buffer <see cref="GraphicsResourceUsage.Default" /> uasge. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="value">The value to initialize the Typed buffer.</param> /// <param name="viewFormat">The view format of the buffer.</param> /// <param name="isUnorderedAccess">if set to <c>true</c> this buffer supports unordered access (RW in HLSL).</param> /// <param name="usage">The usage of this resource.</param> /// <returns>A Typed buffer</returns> public static Buffer New(GraphicsDevice device, DataPointer value, PixelFormat viewFormat, bool isUnorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) { return(Buffer.New(device, value, 0, BufferFlags.ShaderResource | (isUnorderedAccess ? BufferFlags.UnorderedAccess : BufferFlags.None), viewFormat, usage)); }
/// <summary> /// Creates a new Typed buffer <see cref="GraphicsResourceUsage.Default" /> uasge. /// </summary> /// <typeparam name="T">Type of the Typed buffer to get the sizeof from</typeparam> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="value">The value to initialize the Typed buffer.</param> /// <param name="viewFormat">The view format of the buffer.</param> /// <param name="isUnorderedAccess">if set to <c>true</c> this buffer supports unordered access (RW in HLSL).</param> /// <param name="usage">The usage of this resource.</param> /// <returns>A Typed buffer</returns> public static Buffer <T> New <T>(GraphicsDevice device, T[] value, PixelFormat viewFormat, bool isUnorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : struct { return(Buffer.New(device, value, BufferFlags.ShaderResource | (isUnorderedAccess ? BufferFlags.UnorderedAccess : BufferFlags.None), viewFormat, usage)); }
/// <summary> /// Creates a new Typed buffer <see cref="GraphicsResourceUsage.Default" /> uasge. /// </summary> /// <param name="device">The <see cref="GraphicsDevice"/>.</param> /// <param name="count">The number of data with the following viewFormat.</param> /// <param name="viewFormat">The view format of the buffer.</param> /// <param name="isUnorderedAccess">if set to <c>true</c> this buffer supports unordered access (RW in HLSL).</param> /// <param name="usage">The usage.</param> /// <returns>A Typed buffer</returns> public static Buffer New(GraphicsDevice device, int count, PixelFormat viewFormat, bool isUnorderedAccess = false, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) { return(Buffer.New(device, count * viewFormat.SizeInBytes(), BufferFlags.ShaderResource | (isUnorderedAccess ? BufferFlags.UnorderedAccess : BufferFlags.None), viewFormat, usage)); }
private DevicePipelineStateCache GetPipelineStateCache() { return(GraphicsDevice.GetOrCreateSharedData(typeof(DevicePipelineStateCache), device => new DevicePipelineStateCache(device))); }