CommandBuffer.DrawProceduralIndirect

Switch to Manual
public void DrawProceduralIndirect (Matrix4x4 matrix, Material material, int shaderPass, MeshTopology topology, ComputeBuffer bufferWithArgs, int argsOffset, MaterialPropertyBlock properties);
public void DrawProceduralIndirect (Matrix4x4 matrix, Material material, int shaderPass, MeshTopology topology, ComputeBuffer bufferWithArgs, int argsOffset);
public void DrawProceduralIndirect (Matrix4x4 matrix, Material material, int shaderPass, MeshTopology topology, ComputeBuffer bufferWithArgs);

Parameters

matrix要使用的变换矩阵。
material要使用的材质。
shaderPass要使用着色器的哪个通道(或选择 -1,表示所有通道)。
topology程序化几何体的拓扑。
properties在渲染之前应用的其他材质属性。请参阅 MaterialPropertyBlock
bufferWithArgs具有绘制参数的缓冲区。
argsOffset缓冲区中的字节偏移,绘制参数所在位置。

Description

添加“绘制程序化几何体”命令。

When the command buffer executes, this will do a draw call on the GPU, without any vertex or index buffers. The amount of geometry to draw is read from a ComputeBuffer. Typical use case is generating an arbitrary amount of data from a ComputeShader and then rendering that, without requiring a readback to the CPU.

这只在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。

Buffer with arguments, bufferWithArgs, has to have four integer numbers at given argsOffset offset: vertex count per instance, instance count, start vertex location, and start instance location. This maps to Direct3D11 DrawInstancedIndirect and equivalent functions on other graphics APIs. On OpenGL versions before 4.2 and all OpenGL ES versions that support indirect draw, the last argument is reserved and therefore must be zero.

在顶点着色器中,您通常使用 SV_VertexID 和 SV_InstanceID 输入变量以从一些缓冲区提取数据。

另请参阅:DrawProceduralMaterialPropertyBlockGraphics.DrawProceduralIndirectComputeBuffer.CopyCountSystemInfo.supportsComputeShaders


Parameters

indexBufferIndex buffer used to submit vertices to the GPU.
matrix要使用的变换矩阵。
material要使用的材质。
shaderPass要使用着色器的哪个通道(或选择 -1,表示所有通道)。
topology程序化几何体的拓扑。
bufferWithArgs具有绘制参数的缓冲区。
argsOffset缓冲区中的字节偏移,绘制参数所在位置。
properties在渲染之前应用的其他材质属性。请参阅 MaterialPropertyBlock

Description

添加“绘制程序化几何体”命令。

When the command buffer executes, this will do a draw call on the GPU, without a vertex buffer. The amount of geometry to draw is read from a ComputeBuffer. Typical use case is generating an arbitrary amount of data from a ComputeShader and then rendering that, without requiring a readback to the CPU.

这只在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。

Buffer with arguments, bufferWithArgs, has to have five integer numbers at given argsOffset offset: index count per instance, instance count, start index location, base vertex location, and start instance location. This maps to Direct3D11 DrawIndexedInstancedIndirect and equivalent functions on other graphics APIs. On OpenGL versions before 4.2 and all OpenGL ES versions that support indirect draw, the last argument is reserved and therefore must be zero.

在顶点着色器中,您通常使用 SV_VertexID 和 SV_InstanceID 输入变量以从一些缓冲区提取数据。

另请参阅:DrawProceduralMaterialPropertyBlockGraphics.DrawProceduralIndirectComputeBuffer.CopyCountSystemInfo.supportsComputeShaders