zeux / niagara

A Vulkan renderer written from scratch on stream
MIT License
1.26k stars 72 forks source link

Call `SetMeshOutputsEXT` before writing to `gl_MeshVerticesEXT`/`gl_PrimitiveTriangleIndicesEXT` #29

Closed BeastLe9enD closed 2 years ago

BeastLe9enD commented 2 years ago

In your mesh shader, you call SetMeshOutputsEXT after writing to gl_MeshVerticesEXT and gl_PrimitiveTriangleIndicesEXT. https://github.com/zeux/niagara/blob/57e102248fdebd44cceceb71384935714aca80b8/src/shaders/meshlet.mesh.glsl#L113

In the documentation I read (https://github.com/KhronosGroup/Vulkan-Docs/blob/main/proposals/VK_EXT_mesh_shader.adoc), it says:

Mesh shaders must specify the actual number of primitives and vertices being emitted before writing them, via the OpSetMeshOutputsEXT instruction.

I`m not sure if its really required to do so, but as I understand it is.

It makes no visual difference on the NVIDIA driver, but I still thought I'd write it to you because it's supposed to run poorly on some architectures.

zeux commented 2 years ago

Ah yeah it was supposed to be before, thanks!