纹理与间接命令缓冲

huangapple go评论62阅读模式
英文:

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:

  • MTLIndirectRenderCommand only has setVertexBuffer and setFragmentBuffer.
  • MTLIndirectComputeCommand only has setKernelBuffer

and on the GPU:

  • render_command only has set_vertex_bufer and set_fragment_buffer
  • compute_command only has set_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:

  • MTLIndirectRenderCommand only has setVertexBuffer and setFragmentBuffer.
  • MTLIndirectComputeCommand only has setKernelBuffer

and on the GPU:

  • render_command only has set_vertex_bufer and set_fragment_buffer
  • compute_command only has set_kernel_bufer.

huangapple
  • 本文由 发表于 2023年6月15日 00:20:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/76475662.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定