Version: 2023.1

Graphics.DrawProceduralNow

切换到手册
public static void DrawProceduralNow (MeshTopology topology, int vertexCount, int instanceCount);

参数

topology 程序化几何体的拓扑。
vertexCount 要渲染的顶点数。
instanceCount 要渲染的实例数。

描述

在 GPU 上绘制程序化的几何形状。

DrawProceduralNow does a draw call on the GPU, without any vertex or index buffers. If the shader requires vertex buffers, one of the following occurs depending on platform: - If the vertex buffer is declared but the compiler can optimize it away, the normal DrawProcedural call occurs. - If the compiler is not able to optimize the vertex buffer declaration away, the draw call will be converted into a normal mesh drawing call with emulated vertex buffers injected. The latter option has performance overhead so it is recommended not to declare vertex inputs in shaders when using DrawProceduralNow. This is mainly useful on Shader Model 4.5 level hardware where shaders can read arbitrary data from ComputeBuffer buffers.

注意,该调用立即执行,类似于 Graphics.DrawMeshNow。它使用当前设置的渲染目标、变换矩阵和着色器通道。

CommandBuffers 中也有类似的功能,请参阅 CommandBuffer.DrawProcedural

另请参阅:Graphics.DrawProceduralIndirectNowSystemInfo.supportsInstancing


public static void DrawProceduralNow (MeshTopology topology, GraphicsBuffer indexBuffer, int indexCount, int instanceCount);

参数

topology 程序化几何体的拓扑。
indexCount 要渲染的索引数量。
instanceCount 要渲染的实例数。
indexBuffer 用于将顶点提交到 GPU 的索引缓冲区。

描述

在 GPU 上绘制程序化的几何形状。

DrawProceduralNow 在 GPU 上执行绘制调用,没有任何顶点缓冲区。 主要适用于 Shader Model 4.5 级别的硬件,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。

注意,该调用立即执行,类似于 Graphics.DrawMeshNow。它使用当前设置的渲染目标、变换矩阵和着色器通道。

CommandBuffers 中也有类似的功能,请参阅 CommandBuffer.DrawProcedural

另请参阅:Graphics.DrawProceduralIndirectNowSystemInfo.supportsInstancing