CommandList
public sealed class CommandList Constructors
CommandList() CommandList(String debugName) Properties
| Name | Type | Description |
|---|---|---|
GlobalAttributes | AttributeAccess | These are the attributes for the current view. Setting a variable here will let you pass it down to other places in the render pipeline. |
Attributes | AttributeAccess | Access to the local attributes. What these are depends on where the command list is being called. If we're calling from a renderable, these are the attributes for that renderable. |
DebugName | String | |
Enabled | Boolean | |
Flags | Flag | |
Paint | HudPainter | Access to simple 2D painting functions to draw shapes and text. |
ViewportSize | SizeHandle | A handle to the viewport size |
Methods
Void Reset() Void Blit(Material material, RenderAttributes attributes = null) Void Set(StringToken token, Single f) Void Set(StringToken token, Double f) Void Set(StringToken token, Vector2 vector2) Void Set(StringToken token, Vector3 vector3) Void Set(StringToken token, Vector4 vector4) Void Set(StringToken token, Int32 i) Void Set(StringToken token, Boolean b) Void Set(StringToken token, Matrix matrix) Void Set(StringToken token, GpuBuffer buffer) Void Set(StringToken token, Texture texture) Void SetCombo(StringToken token, Int32 value) Void SetCombo(StringToken token, Boolean value) Void SetCombo(StringToken token, T t) Void SetConstantBuffer(StringToken token, T data) Void SetGlobal(StringToken token, GpuBuffer buffer) Void SetGlobal(StringToken token, Int32 i) Void SetGlobal(StringToken token, Boolean b) Void SetGlobal(StringToken token, Single f) Void SetGlobal(StringToken token, Double f) Void SetGlobal(StringToken token, Vector2 vector2) Void SetGlobal(StringToken token, Vector3 vector3) Void SetGlobal(StringToken token, Vector4 vector4) Void SetGlobal(StringToken token, Matrix matrix) Void SetGlobal(StringToken token, Texture texture) RenderTargetHandle GrabFrameTexture(String token, Boolean withMips = False) Takes a copy of the framebuffer and returns a handle to it
token withMips — Generates mipmaps on the grabbed texture filtered with gaussian blur for each mip RenderTargetHandle GrabDepthTexture(String token) Takes a copy of the depthbuffer and returns a handle to it
token Void InsertList(CommandList otherBuffer) Run this CommandList here
Void DrawModel(Model model, Transform transform, RenderAttributes attributes = null) Draws a single model at the given Transform immediately.
model — The model to draw transform — Transform to draw the model at attributes — Optional attributes to apply only for this draw call Void DrawModelInstanced(Model model, Span<Transform> transforms, RenderAttributes attributes = null) Void DrawModelInstancedIndirect(Model model, GpuBuffer buffer, Int32 bufferOffset = 0, RenderAttributes attributes = null) Draws multiple instances of a model using GPU instancing with the number of instances being provided by indirect draw arguments. Use `SV_InstanceID` semantic in shaders to access the rendered instance.
model — The model to draw buffer — The GPU buffer containing the DrawIndirectArguments bufferOffset — Optional offset in the GPU buffer attributes — Optional attributes to apply only for this draw call Void DrawModelInstanced(Model model, Int32 count, RenderAttributes attributes = null) Draws multiple instances of a model using GPU instancing. This is similar to RenderAttributes), except the count is provided from the CPU rather than via a GPU buffer. Use `SV_InstanceID` semantic in shaders to access the rendered instance.
model — The model to draw count — The number of instances to draw attributes — Optional attributes to apply only for this draw call Void Draw(GpuBuffer<T> vertexBuffer, Material material, Int32 startVertex = 0, Int32 vertexCount = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Void DrawIndexed(GpuBuffer<T> vertexBuffer, GpuBuffer indexBuffer, Material material, Int32 startIndex = 0, Int32 indexCount = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Void DrawInstancedIndirect(GpuBuffer<T> vertexBuffer, Material material, GpuBuffer indirectBuffer, UInt32 bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Void DrawInstancedIndirect(Material material, GpuBuffer indirectBuffer, UInt32 bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Draws instanced geometry using a vertex buffer and indirect draw arguments stored in a GPU buffer.
material — The material to use for rendering. indirectBuffer — The GPU buffer containing indirect draw arguments. bufferOffset — Optional byte offset into the indirect buffer. attributes — Optional render attributes to apply only for this draw call. primitiveType — The type of primitives to render. Defaults to triangles. Void DrawIndexedInstancedIndirect(GpuBuffer<T> vertexBuffer, GpuBuffer indexBuffer, Material material, GpuBuffer indirectBuffer, UInt32 bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Void DrawIndexedInstancedIndirect(GpuBuffer indexBuffer, Material material, GpuBuffer indirectBuffer, UInt32 bufferOffset = 0, RenderAttributes attributes = null, PrimitiveType primitiveType = 5) Draws instanced indexed geometry using indirect draw arguments stored in a GPU buffer.
indexBuffer — The GPU buffer containing index data. material — The material to use for rendering. indirectBuffer — The GPU buffer containing indirect draw arguments. bufferOffset — Optional byte offset into the indirect buffer. attributes — Optional render attributes to apply only for this draw call. primitiveType — The type of primitives to render. Defaults to triangles. RenderTargetHandle GetRenderTarget(String name, ImageFormat format, Int32 numMips = 1, Int32 sizeFactor = 1) Get a screen sized temporary render target. You should release the returned handle when you're done to return the textures to the pool.
name — The name of the render target handle. format — The format for the color buffer. If set to default we'll use whatever the current pipeline is using. numMips — Number of mips you want in this texture. You probably don't want this unless you want to generate mips in a second pass. sizeFactor — Divide the screen size by this factor. 2 would be half screen sized. 1 for full screen sized. RenderTargetHandle GetRenderTarget(String name, Int32 sizeFactor = 1, ImageFormat colorFormat = -2, ImageFormat depthFormat = -2, MultisampleAmount msaa = 6, Int32 numMips = 1) Get a screen sized temporary render target. You should release the returned handle when you're done to return the textures to the pool.
name — The name of the render target handle. sizeFactor — Divide the screen size by this factor. 2 would be half screen sized. 1 for full screen sized. colorFormat — The format for the color buffer. If set to default we'll use whatever the current pipeline is using. depthFormat — The format for the depth buffer. msaa — The number of msaa samples you'd like. Msaa render textures are a pain in the ass so you're probably gonna regret trying to use this. numMips — Number of mips you want in this texture. You probably don't want this unless you want to generate mips in a second pass. RenderTargetHandle GetRenderTarget(String name, Int32 width, Int32 height, ImageFormat colorFormat = -2, ImageFormat depthFormat = -2, MultisampleAmount msaa = 6, Int32 numMips = 1) Get a temporary render target. You should release the returned handle when you're done to return the textures to the pool.
name — The name of the render target handle. width — Width of the render target you want. height — Height of the render target you want. colorFormat — The format for the color buffer. If set to default we'll use whatever the current pipeline is using. depthFormat — The format for the depth buffer. msaa — The number of msaa samples you'd like. Msaa render textures are a pain in the ass so you're probably gonna regret trying to use this. numMips — Number of mips you want in this texture. You probably don't want this unless you want to generate mips in a second pass. Void ReleaseRenderTarget(RenderTargetHandle handle) We're no longer using this RT, return it to the pool
Void SetRenderTarget(RenderTargetHandle handle) Set the current render target. Setting this will bind the render target and change the viewport to match it.
Void SetRenderTarget(RenderTarget target) Set the current render target. Setting this will bind the render target and change the viewport to match it.
Void ClearRenderTarget() Set the current render target. Setting this will bind the render target and change the viewport to match it.
Void Set(StringToken token, ColorTextureRef buffer, Int32 mip = -1) Set the color texture from this named render target to this attribute
Void SetGlobal(StringToken token, ColorIndexRef buffer) Set the color texture from this named render target to this attribute
Void DispatchCompute(ComputeShader compute, Int32 threadsX, Int32 threadsY, Int32 threadsZ) Void DispatchComputeIndirect(ComputeShader compute, GpuBuffer indirectBuffer, UInt32 indirectElementOffset = 0) SizeHandle ViewportSizeScaled(Int32 divisor) A handle to the viewport size divided by a factor. Useful for dispatching at half or quarter resolution.
Void DispatchCompute(ComputeShader compute, SizeHandle dimension) Dispatch a compute shader
Void Clear(Color color, Boolean clearColor = True, Boolean clearDepth = True, Boolean clearStencil = True) Clear the current drawing context to given color.
color — Color to clear to. clearColor — Whether to clear the color buffer at all. clearDepth — Whether to clear the depth buffer. clearStencil — Whether to clear the stencil buffer. Void Clear(Texture texture, Color color = null) Clears the given texture to a solid color.
texture — The texture to clear. color — The color to clear to. Defaults to transparent black. Void Clear(RenderTargetHandle handle, Color color = null) Clears the color texture of the given render target handle to a solid color.
handle — The render target handle whose color texture to clear. color — The color to clear to. Defaults to transparent black. Void Clear(GpuBuffer buffer, UInt32 value = 0) Fills the given GPU buffer with a repeated uint32 value.
buffer — The buffer to clear. value — The uint32 value to fill with. Defaults to zero. Void ResourceBarrierTransition(Texture texture, ResourceState state, Int32 mip = -1) Executes a barrier transition for the given GPU Texture Resource. Transitions the texture resource to a new pipeline stage and access state.
texture — The texture to transition. state — The new resource state for the texture. mip — The mip level to transition (-1 for all mips). Void ResourceBarrierTransition(ColorTextureRef texture, ResourceState state, Int32 mip = -1) Executes a barrier transition for the color texture of the given render target handle.
texture — The render target color handle. state — The new resource state for the texture. mip — The mip level to transition (-1 for all mips). Void ResourceBarrierTransition(DepthTextureRef texture, ResourceState state, Int32 mip = -1) Executes a barrier transition for the depth texture of the given render target handle.
texture — The render target depth handle. state — The new resource state for the texture. mip — The mip level to transition (-1 for all mips). Void ResourceBarrierTransition(RenderTargetHandle handle, ResourceState state, Int32 mip = -1) Executes a barrier transition for the color texture of the given render target handle.
handle — The render target handle. state — The new resource state for the texture. mip — The mip level to transition (-1 for all mips). Void ResourceBarrierTransition(GpuBuffer buffer, ResourceState state) Executes a barrier transition for the given GPU Buffer Resource. Transitions the buffer resource to a new pipeline stage and access state.
buffer — The GPU buffer to transition. state — The new resource state for the buffer. Void ResourceBarrierTransition(GpuBuffer buffer, ResourceState before, ResourceState after) Executes a barrier transition for the given GPU Buffer Resource. Transitions the buffer resource from a known source state to a specified destination state.
buffer — The GPU buffer to transition. before — The current resource state of the buffer. after — The desired resource state of the buffer after the transition. Void UavBarrier(Texture texture) Issues a UAV barrier for the given texture, ensuring writes from prior shader invocations are visible to subsequent ones without changing the resource layout.
texture — The texture to barrier. Void UavBarrier(GpuBuffer buffer) Issues a UAV barrier for the given GPU buffer, ensuring writes from prior shader invocations are visible to subsequent ones.
buffer — The buffer to barrier. Void GenerateMipMaps(RenderTargetHandle handle, DownsampleMethod method = 1) Generates a mip-map chain for the specified render target. This will generate mipmaps for the color texture of the render target.
Void GenerateMipMaps(RenderTarget target, DownsampleMethod method = 1) Generates a mip-map chain for the specified render target. This will generate mipmaps for the color texture of the render target.
Void GenerateMipMaps(Texture texture, DownsampleMethod method = 1) Generates a mip-map chain for the specified texture. This will generate mipmaps for the color texture of the texture.
Void DrawText(Scope scope, Rect rect, TextFlag flags = 33) Draws text within a rectangle using a prepared Scope.
scope — The text rendering scope. rect — The rectangle to draw the text in. flags — Text alignment flags (optional). Void DrawRenderer(Renderer renderer, RendererSetup rendererSetup = null) Render a Renderer with the specified overrides.
Void DrawView(CameraComponent camera, RenderTargetHandle target, ViewSetup viewSetup = null) Renders the view from a camera to the specified render target.
Void DrawReflection(CameraComponent camera, Plane plane, RenderTargetHandle target, ReflectionSetup reflectionSetup = null) Render a planar reflection using the specified camera and the specified plane.
Void DrawRefraction(CameraComponent camera, Plane plane, RenderTargetHandle target, RefractionSetup refractionSetup = null) Render a planar refraction using the specified camera and the specified plane. This is for all intents and purposes a regular view with a plane clipping it. Usually used for rendering under water.