matrix | 要使用的变换矩阵。 |
material | 要使用的材质。 |
shaderPass | 要使用着色器的哪个通道(或选择 -1,表示所有通道)。 |
topology | 程序化几何体的拓扑。 |
properties | 在渲染之前应用的其他材质属性。请参阅 MaterialPropertyBlock。 |
bufferWithArgs | 具有绘制参数的缓冲区。 |
argsOffset | 缓冲区中的字节偏移,绘制参数所在位置。 |
添加“绘制程序化几何体”命令。
当命令缓冲区执行时,将在 GPU 中执行绘制调用,没有任何顶点或索引缓冲区。
要绘制的几何体数量可从 ComputeBuffer 中读取。典型的用例是从 ComputeShader 中生成任意数量的数据,然后渲染该数据,无需回读 CPU。
这只在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。
带参数的缓冲区 bufferWithArgs
必须在给定的 argsOffset
偏移处具有四个整数:
每个实例的顶点数、实例数、起始顶点位置和起始实例位置。
这会映射到 Direct3D11 DrawInstancedIndirect 和其他图形 API 中的等效函数。在 OpenGL 4.2 之前的版本和支持间接绘制的所有 OpenGL ES 版本中,最后一个参数保留,因此必须是零。
在顶点着色器中,您通常使用 SV_VertexID 和 SV_InstanceID 输入变量以从一些缓冲区提取数据。
另请参阅:DrawProcedural、MaterialPropertyBlock、Graphics.DrawProceduralIndirect、ComputeBuffer.CopyCount、SystemInfo.supportsComputeShaders。
indexBuffer | 用于将顶点提交到 GPU 的索引缓冲区。 |
matrix | 要使用的变换矩阵。 |
material | 要使用的材质。 |
shaderPass | 要使用着色器的哪个通道(或选择 -1,表示所有通道)。 |
topology | 程序化几何体的拓扑。 |
bufferWithArgs | 具有绘制参数的缓冲区。 |
argsOffset | 缓冲区中的字节偏移,绘制参数所在位置。 |
properties | 在渲染之前应用的其他材质属性。请参阅 MaterialPropertyBlock。 |
添加“绘制程序化几何体”命令。
当命令缓冲区执行时,将在 GPU 中执行绘制调用,没有顶点缓冲区。
要绘制的几何体数量可从 ComputeBuffer 中读取。典型的用例是从 ComputeShader 中生成任意数量的数据,然后渲染该数据,无需回读 CPU。
这只在 Shader Model 4.5 级别的硬件中有用,其中着色器可以从 ComputeBuffer 缓冲区读取任意数据。
带参数的缓冲区 bufferWithArgs
必须在给定的 argsOffset
偏移处具有五个整数:
每个实例的索引数、实例数、起始索引位置、基顶点位置和起始实例位置。
这会映射到 Direct3D11 DrawIndexedInstancedIndirect 和其他图形 API 中的等效函数。在 OpenGL 4.2 之前的版本和支持间接绘制的所有 OpenGL ES 版本中,最后一个参数保留,因此必须是零。
在顶点着色器中,您通常使用 SV_VertexID 和 SV_InstanceID 输入变量以从一些缓冲区提取数据。
另请参阅:DrawProcedural、MaterialPropertyBlock、Graphics.DrawProceduralIndirect、ComputeBuffer.CopyCount、SystemInfo.supportsComputeShaders。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.