英文:
Textures With Indirect Command Buffer
问题
我使用 drawIndexedPrimitives 函数来渲染,该函数有以下参数:primitiveType(图元类型)、indexType(索引类型)、indexBuffer(索引缓冲区)、indexBufferOffset(索引缓冲区偏移量)、indirectBuffer(间接缓冲区)和indirectBufferOffset(间接缓冲区偏移量)。当我使用参数缓冲区来设置纹理(例如,用于片段着色器)时,一切都正常。但是否有一种方法可以在不使用参数缓冲区的情况下设置纹理?参数缓冲区是唯一的方式吗?当与参数缓冲区一起使用时,事情进展顺利。
英文:
I render with func drawIndexedPrimitives( type primitiveType: MTLPrimitiveType, indexType: MTLIndexType, indexBuffer: MTLBuffer, indexBufferOffset: Int, indirectBuffer: MTLBuffer, indirectBufferOffset: Int ), when I use Argument Buffer to set textures(e.g. to fragnent shader), everything is fine. But is there a way to set textures without Argument Buffer? Argument Buffer is the only way?
When used with Argument Buffer, things go well.
答案1
得分: 1
No, there's no other way. If you are using indirect command buffers, you have to get textures through argument buffers.
If you look at the API on the CPU:
MTLIndirectRenderCommandonly hassetVertexBufferandsetFragmentBuffer.MTLIndirectComputeCommandonly hassetKernelBuffer
and on the GPU:
render_commandonly hasset_vertex_buferandset_fragment_buffercompute_commandonly hasset_kernel_bufer.
英文:
No, there's no other way. If you are using indirect command buffers, you have to get textures through argument buffers.
If you look at the API on the CPU:
MTLIndirectRenderCommandonly hassetVertexBufferandsetFragmentBuffer.MTLIndirectComputeCommandonly hassetKernelBuffer
and on the GPU:
render_commandonly hasset_vertex_buferandset_fragment_buffercompute_commandonly hasset_kernel_bufer.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论