KhronosGroup/SPIRV-Registry

OpWritePackedPrimitiveIndices4x8NV and OpEntryPoint interface

cmarcelo opened this issue · 2 comments

OpWritePackedPrimitiveIndices4x8NV implicitly refer to "output variable decorated with the PrimitiveIndicesNV BuiltIn" instead of using an explicit ID. The OpEntryPoint interface is defined as

The set of Interface must be equal to or a superset of the global OpVariable Result referenced by the entry point’s static call tree, within the interface’s storage classes.

Glslang (Version: 10:11.0.0) doesn't include the variable in the interfaces if only OpWritePackedPrimitiveIndices4x8NV is used but no other explicit references. I think either:

  • This is (effectively) expected behavior, and we could add a note to SPV_NV_mesh_shader clarifiying this;
  • This is a bug in GLSLang, implicit reference should count for the interfaces, the spec should change either the definition of OpEntryPoint or OpWritePackedPrimitiveIndices4x8NV.

Actually it seems GLSLang is not even creating the variable in the case only the write packed refers to it.

There is an implied write to gl_PrimitiveIndicesNV and perhaps glslang should mark this as an output variable on the OpEntryPoint, though, as you note, glslang would need to "synthesize" some declaration and use of gl_PrimitiveIndicesNV. In that sense it seems more reasonable to just note this in the SPV_NV_mesh_shader ext (option 1).

Presumably one could work around this by doing the assigns to gl_PrimitiveIndicesNV manually (in that case glslang does record the use in OpEntryPoint).

Is there a tool/app that is failing because of this?