#Validation error about push constants with pointer types falsely requiring `storagePushConstant8`?

4 messages · Page 1 of 1 (latest)

exotic mauve
#

Hi, this might be a slang issue instead, but I'll post this here anyway. I have a slang shader with this entrypoint:

[numthreads(64,1,1)]
void main(
    uint8_t* output,
    Gltf* gltf,
    uniform uint scene_size,
    DescriptorHandle<Sampler2D> image,
    uint3 dispatch_thread_id : SV_DispatchThreadID,
) {...}

This creates an OpTypeStruct where one of the members is a OpTypePointer to a 8-bit OpTypeInt. I get this validation error:

[2025-01-25T07:04:19Z ERROR vulkan] VALIDATION [VUID-RuntimeSpirv-storagePushConstant8-06330 (574681531)] : Validation Error: [ VUID-RuntimeSpirv-storagePushConstant8-06330 ] | MessageID = 0x2240f1bb | vkCreateShaderModule():  SPIR-V contains an 8-bit OpVariable with PushConstant Storage Class, but storagePushConstant8 was not enabled.

I feel like this error is wrong as the pointer should be 64-bits in size, not 8. Changing the entry point to take a uint* and then casting it to uint8_t* in the shader gets rid of this error.

frank fern
#

@exotic mauve do you have the slang itself, I don't see anything that looks like a Push constant in your example

frank fern
#

@exotic mauve ok, so seems slang takes everything in main( here ) as a Push Constant struct

I see your question is about why the pointer itself is not considered 64-bit, looking now

#

ok, this just seems like a Validation bug (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/9364)

I raised a spec issue, the storagePushConstant8 was added way before pointers were allowed, so I assume this was an oversight and that this should be totally legal what you are doing, but will keep you updated (Thanks for asking this, fun edge case 🙃 )

GitHub

(Currently created internal spec issue to clarify - https://gitlab.khronos.org/vulkan/vulkan/-/issues/4172) In slang you can have something like (https://godbolt.org/z/8r8nYv7dW) RWStructuredBuffer...