API ReferenceSandbox.Rendering

CommandListclass

objectCommandList
Namespace
Sandbox.Rendering
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.Rendering.CommandList

Constructors2

Showing 2 constructors

Methods78

Showing 78 methods

public void ClearRenderTarget()PUBLIC

Set the current render target. Setting this will bind the render target and change the viewport to match it.

Returns:void

public void DispatchComputeIndirect(Sandbox.ComputeShader compute, Sandbox.GpuBuffer indirectBuffer, uint indirectElementOffset = 0)PUBLIC

ParameterTypeDescription
computeComputeShader
indirectBufferGpuBuffer
indirectElementOffset = 0uint
Returns:void

public void DrawIndexedInstanced(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, int instanceCount, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)PUBLIC

Draws indexed geometry with instancing. Each instance shares the same index buffer.

ParameterTypeDescription
indexBufferGpuBuffer
materialMaterial
instanceCountint
attributes = nullRenderAttributes
primitiveType = 5PrimitiveType
Returns:void

public void DrawModel(Sandbox.Model model, Transform transform, Sandbox.RenderAttributes attributes = null)PUBLIC

Draws a single model at the given Transform immediately.

ParameterTypeDescription
modelModelThe model to draw
transformTransformTransform to draw the model at
attributes = nullRenderAttributesOptional attributes to apply only for this draw call
Returns:void

public void DrawModelInstancedIndirect(Sandbox.Model model, Sandbox.GpuBuffer buffer, int bufferOffset = 0, Sandbox.RenderAttributes attributes = null)PUBLIC

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.

ParameterTypeDescription
modelModelThe model to draw
bufferGpuBufferThe GPU buffer containing the DrawIndirectArguments
bufferOffset = 0intOptional offset in the GPU buffer
attributes = nullRenderAttributesOptional attributes to apply only for this draw call
Returns:void

public void DrawRefraction(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.RefractionSetup refractionSetup = null)PUBLIC

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.

ParameterTypeDescription
cameraCameraComponent
planePlane
targetRenderTargetHandle
refractionSetup = nullRefractionSetup
Returns:void

public void DrawRenderer(Sandbox.Renderer renderer, Sandbox.Rendering.RendererSetup rendererSetup = null)PUBLIC

Render a `Sandbox.Renderer` with the specified overrides.

ParameterTypeDescription
rendererRenderer
rendererSetup = nullRendererSetup
Returns:void

public void DrawScreenQuad(Sandbox.Material material, Color color)PUBLIC

ParameterTypeDescription
materialMaterial
colorColor
Returns:void

public void DrawText(Sandbox.TextRendering.Scope scope, Sandbox.Rect rect, Sandbox.TextFlag flags = 33, float angleDegrees = 0)PUBLIC

Draws text within a rectangle using a prepared `Sandbox.TextRendering.Scope`.

ParameterTypeDescription
scopeScopeThe text rendering scope.
rectRectThe rectangle to draw the text in.
flags = 33TextFlagText alignment flags (optional).
angleDegrees = 0floatRotation angle in degrees (optional).
Returns:void

public Sandbox.Rendering.RenderTargetHandle GrabDepthTexture(string token)PUBLICOBSOLETE

Takes a copy of the depthbuffer and returns a handle to it

Obsolete: This API member is obsolete.

ParameterTypeDescription
tokenstring

public Sandbox.Rendering.RenderTargetHandle GrabFrameTexture(string token, bool withMips = False)PUBLICOBSOLETE

Takes a copy of the framebuffer and returns a handle to it

Obsolete: This API member is obsolete.

ParameterTypeDescription
tokenstring
withMips = FalseboolGenerates mipmaps on the grabbed texture filtered with gaussian blur for each mip

public void InsertList(Sandbox.Rendering.CommandList otherBuffer)PUBLIC

Run this CommandList here

ParameterTypeDescription
otherBufferCommandList
Returns:void

public void ReleaseRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)PUBLIC

We're no longer using this RT, return it to the pool

ParameterTypeDescription
handleRenderTargetHandle
Returns:void

public void Reset()PUBLIC

Returns:void

public void SetConstantBuffer(Sandbox.StringToken token, T data)PUBLICOBSOLETE

Obsolete: This API member is obsolete.

ParameterTypeDescription
tokenStringToken
dataT
Returns:void

public Sandbox.Rendering.RenderTargetHandle.SizeHandle ViewportSizeScaled(int divisor)PUBLIC

A handle to the viewport size divided by a factor. Useful for dispatching at half or quarter resolution.

ParameterTypeDescription
divisorint
Returns:SizeHandle

Properties7

Showing 7 properties

public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.Attributes { get; set; }PUBLICGETSET

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.

Returns:AttributeAccess

public string Sandbox.Rendering.CommandList.DebugName { get; set; }PUBLICGETSET

Returns:string

public bool Sandbox.Rendering.CommandList.Enabled { get; set; }PUBLICGETSET

Returns:bool

public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.GlobalAttributes { get; set; }PUBLICGETSETOBSOLETE

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.

Obsolete: Global/frame attributes are deprecated. Use a local Attributes set or pipeline texture slots instead.

Returns:AttributeAccess

public Sandbox.Rendering.HudPainter Sandbox.Rendering.CommandList.Paint { get; set; }PUBLICGETSET

Access to simple 2D painting functions to draw shapes and text.

Returns:HudPainter

On this page

Constructorspublic CommandList()public CommandList(System.String debugName)Methodspublic System.Void Blit(Sandbox.Material material, Sandbox.RenderAttributes attributes = null)public System.Void Clear(Color color, System.Boolean clearColor = True, System.Boolean clearDepth = True, System.Boolean clearStencil = True)public System.Void Clear(Sandbox.GpuBuffer buffer, System.UInt32 value = 0)public System.Void Clear(Sandbox.Rendering.RenderTargetHandle handle, Color color = null)public System.Void Clear(Sandbox.Texture texture, Color color = null)public System.Void ClearRenderTarget()public System.Void DispatchCompute(Sandbox.ComputeShader compute, Sandbox.Rendering.RenderTargetHandle.SizeHandle dimension)public System.Void DispatchCompute(Sandbox.ComputeShader compute, System.Int32 threadsX, System.Int32 threadsY, System.Int32 threadsZ)public System.Void DispatchComputeIndirect(Sandbox.ComputeShader compute, Sandbox.GpuBuffer indirectBuffer, System.UInt32 indirectElementOffset = 0)public System.Void Draw(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.Material material, System.Int32 startVertex = 0, System.Int32 vertexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexed(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, System.Int32 startIndex = 0, System.Int32 indexCount = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstanced(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, System.Int32 instanceCount, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstancedIndirect(Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawIndexedInstancedIndirect(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.GpuBuffer indexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawInstancedIndirect(Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawInstancedIndirect(Sandbox.GpuBuffer`1<T> vertexBuffer, Sandbox.Material material, Sandbox.GpuBuffer indirectBuffer, System.UInt32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null, Sandbox.Graphics.PrimitiveType primitiveType = 5)public System.Void DrawModel(Sandbox.Model model, Transform transform, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstanced(Sandbox.Model model, System.Int32 count, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstanced(Sandbox.Model model, System.Span`1<Transform> transforms, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstanced(Sandbox.Model model, System.Span`1<Transform> transforms, System.Int32 lodLevel, Sandbox.RenderAttributes attributes = null)public System.Void DrawModelInstancedIndirect(Sandbox.Model model, Sandbox.GpuBuffer buffer, System.Int32 bufferOffset = 0, Sandbox.RenderAttributes attributes = null)public System.Void DrawQuad(Sandbox.Rect rect, Sandbox.Material material, Color color)public System.Void DrawReflection(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ReflectionSetup reflectionSetup = null)public System.Void DrawRefraction(Sandbox.CameraComponent camera, Sandbox.Plane plane, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.RefractionSetup refractionSetup = null)public System.Void DrawRenderer(Sandbox.Renderer renderer, Sandbox.Rendering.RendererSetup rendererSetup = null)public System.Void DrawScreenQuad(Sandbox.Material material, Color color)public System.Void DrawText(Sandbox.TextRendering.Scope scope, Sandbox.Rect rect, Sandbox.TextFlag flags = 33, System.Single angleDegrees = 0)public System.Void DrawView(Sandbox.CameraComponent camera, Sandbox.Rendering.RenderTargetHandle target, Sandbox.Rendering.ViewSetup viewSetup = null)public System.Void GenerateMipMaps(Sandbox.Rendering.RenderTargetHandle handle, Sandbox.Graphics.DownsampleMethod method = 1)public System.Void GenerateMipMaps(Sandbox.RenderTarget target, Sandbox.Graphics.DownsampleMethod method = 1)public System.Void GenerateMipMaps(Sandbox.Texture texture, Sandbox.Graphics.DownsampleMethod method = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, Sandbox.ImageFormat format, System.Int32 numMips = 1, System.Int32 sizeFactor = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, System.Int32 sizeFactor = 1, Sandbox.ImageFormat colorFormat = -2, Sandbox.ImageFormat depthFormat = -2, Sandbox.MultisampleAmount msaa = 6, System.Int32 numMips = 1)public Sandbox.Rendering.RenderTargetHandle GetRenderTarget(System.String name, System.Int32 width, System.Int32 height, Sandbox.ImageFormat colorFormat = -2, Sandbox.ImageFormat depthFormat = -2, Sandbox.MultisampleAmount msaa = 6, System.Int32 numMips = 1)public Sandbox.Rendering.RenderTargetHandle GrabDepthTexture(System.String token)public Sandbox.Rendering.RenderTargetHandle GrabFrameTexture(System.String token, System.Boolean withMips = False)public System.Void InsertList(Sandbox.Rendering.CommandList otherBuffer)public System.Void ReleaseRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)public System.Void Reset()public System.Void ResourceBarrierTransition(Sandbox.GpuBuffer buffer, Sandbox.Rendering.ResourceState before, Sandbox.Rendering.ResourceState after)public System.Void ResourceBarrierTransition(Sandbox.GpuBuffer buffer, Sandbox.Rendering.ResourceState state)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle handle, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle.ColorTextureRef texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Rendering.RenderTargetHandle.DepthTextureRef texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void ResourceBarrierTransition(Sandbox.Texture texture, Sandbox.Rendering.ResourceState state, System.Int32 mip = -1)public System.Void Set(Sandbox.StringToken token, Matrix matrix)public System.Void Set(Sandbox.StringToken token, Sandbox.GpuBuffer buffer)public System.Void Set(Sandbox.StringToken token, Sandbox.Rendering.RenderTargetHandle.ColorTextureRef buffer, System.Int32 mip = -1)public System.Void Set(Sandbox.StringToken token, Sandbox.Texture texture)public System.Void Set(Sandbox.StringToken token, System.Boolean b)public System.Void Set(Sandbox.StringToken token, System.Double f)public System.Void Set(Sandbox.StringToken token, System.Int32 i)public System.Void Set(Sandbox.StringToken token, System.Single f)public System.Void Set(Sandbox.StringToken token, Vector2 vector2)public System.Void Set(Sandbox.StringToken token, Vector3 vector3)public System.Void Set(Sandbox.StringToken token, Vector4 vector4)public System.Void SetCombo(Sandbox.StringToken token, System.Boolean value)public System.Void SetCombo(Sandbox.StringToken token, System.Int32 value)public System.Void SetCombo(Sandbox.StringToken token, T t)public System.Void SetConstantBuffer(Sandbox.StringToken token, T data)public System.Void SetGlobal(Sandbox.StringToken token, Matrix matrix)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.GpuBuffer buffer)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.Rendering.RenderTargetHandle.ColorIndexRef buffer)public System.Void SetGlobal(Sandbox.StringToken token, Sandbox.Texture texture)public System.Void SetGlobal(Sandbox.StringToken token, System.Boolean b)public System.Void SetGlobal(Sandbox.StringToken token, System.Double f)public System.Void SetGlobal(Sandbox.StringToken token, System.Int32 i)public System.Void SetGlobal(Sandbox.StringToken token, System.Single f)public System.Void SetGlobal(Sandbox.StringToken token, Vector2 vector2)public System.Void SetGlobal(Sandbox.StringToken token, Vector3 vector3)public System.Void SetGlobal(Sandbox.StringToken token, Vector4 vector4)public System.Void SetRenderTarget(Sandbox.Rendering.RenderTargetHandle handle)public System.Void SetRenderTarget(Sandbox.RenderTarget target)public System.Void UavBarrier(Sandbox.GpuBuffer buffer)public System.Void UavBarrier(Sandbox.Rendering.RenderTargetHandle.ColorTextureRef texture)public System.Void UavBarrier(Sandbox.Rendering.RenderTargetHandle handle)public System.Void UavBarrier(Sandbox.Texture texture)public Sandbox.Rendering.RenderTargetHandle.SizeHandle ViewportSizeScaled(System.Int32 divisor)Propertiespublic Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.Attributes { get; set; }public System.String Sandbox.Rendering.CommandList.DebugName { get; set; }public System.Boolean Sandbox.Rendering.CommandList.Enabled { get; set; }public Sandbox.Rendering.CommandList.Flag Sandbox.Rendering.CommandList.Flags { get; set; }public Sandbox.Rendering.CommandList.AttributeAccess Sandbox.Rendering.CommandList.GlobalAttributes { get; set; }public Sandbox.Rendering.HudPainter Sandbox.Rendering.CommandList.Paint { get; set; }public Sandbox.Rendering.RenderTargetHandle.SizeHandle Sandbox.Rendering.CommandList.ViewportSize { get; set; }Metadata