KhronosGroup/SPIRV-Registry

`SPV_KHR_non_semantic_info`: support for mixed stage shader modules?

expenses opened this issue · 2 comments

@baldurk @sheredom (because you're mentioned on https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/master/extensions/KHR/SPV_KHR_non_semantic_info.html)

Hi. I think the SPV_KHR_non_semantic_info extension (which lets you use Debug Printf in shaders) is super cool. However, one limitation is that it is not supported for mixed stage shader modules:

UNASSIGNED-Debug-Printf(ERROR / SPEC): msgNum: -1804403757 - Validation Error: [ UNAS
SIGNED-Debug-Printf ] Object 0: handle = 0x2acf98cefe8, type = VK_OBJECT_TYPE_DEVICE;
 | MessageID = 0x9472fbd3 | Error during shader instrumentation: line 0: Mixed stage
shader module not supported
    Objects: 1
        [0] 0x2acf98cefe8, type: 3, name: NULL
ERROR:
VALIDATION [UNASSIGNED-Debug-Printf (-1804403757)] : Validation Error: [ UNASSIGNED-D
ebug-Printf ] Object 0: handle = 0x2acf98cefe8, type = VK_OBJECT_TYPE_DEVICE; | Messa
geID = 0x9472fbd3 | Error during shader instrumentation: line 0: Mixed stage shader m
odule not supported

error: process didn't exit successfully: `target\debug\example-runner-ash.exe -d` (ex
it code: 0xc0000005, STATUS_ACCESS_VIOLATION)

This isn't so bad for glslc (which doesn't support creating mixed stage modules anyway) but for things such as EmbarkStudios/rust-gpu#768 it's a real pain.

Are there any major factors that prevent Debug Printf being using in mixed stage modules? If not, it would be great to work towards removing this limitation.

The SPV_KHR_non_semantic_info extension is fairly general and covers a variety of use cases. The debug printf extended instruction set is one particular use, but it's not the only one. There's nothing in either extension that requires only one entry point or only entry points of one shader stage type. The errors you're citing come from a particular implementation of debug printf.

If you have an issue with the validation layer implementation of debug printf, you'd need to file an issue with the validation layers. AFAIK RenderDoc's implementation of printf should work for this case fine too, though I don't think I've had any test cases of that.

Okay, thanks @baldurk.