KhronosGroup / KhronosGroup/Vulkan-ValidationLayers
VK_HUAWEI_subpass_shading and VUID-VkPipelineShaderStageCreateInfo-pName-00707
- Dominant language
- C++
- Stars
- 1k
- Forks
- 504
- Avg merge
- 11h 35m
- Merged PRs (30d)
- 224
Description
**Environment:**
- Mobile Device: Huawei Mate 60 Pro+
- Layer: `VK_LAYER_KHRONOS_validation`
**Describe the Issue**
I used `VK_HUAWEI_subpass_shading` device extension, but faced with VVL error:
```
ERROR: [3012269921][VUID-VkPipelineShaderStageCreateInfo-pName-00707] : Validation Error: [ VUID-VkPipelineShaderStageCreateInfo-pName-00707 ] | MessageID = 0xb38b9761 | vkCreateComputePipelines(): pCreateInfos[0].stage.pName `main` entrypoint not found for stage VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI. The Vulkan spec states: pName must be the name of an OpEntryPoint in module with an execution model that matches stage (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkPipelineShaderStageCreateInfo-pName-00707)
```
, but I used example-like code from Vulkan Spec (Example at the bottom of [the page](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_HUAWEI_subpass_shading.html)).
**Expected behavior**
There should be no error.
**Where to start the search**
I think you can start with the `ExecutionModelToShaderStageFlagBits` function (location: `/layers/state_tracker/shader_module.cpp`), which is a little bit wrong:
* [`VK_HUAWEI_subpass_shading`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_HUAWEI_subpass_shading.html) extend [`VkShaderStageFlagBits`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkShaderStageFlagBits.html) with `VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI`.
* [`SPV_HUAWEI_subpass_shading`](https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/HUAWEI/SPV_HUAWEI_subpass_shading.html) do not provide new *SPIR-V* *Execution Model* and just add new *Capability* - `SubpassShadingHUAWEI`.
* But `ExecutionModelToShaderStageFlagBits` function see only *Execution Model* and decide that if *Execution Model* is equal to `GLCompute`, then shader stage is `VK_SHADER_STAGE_COMPUTE_BIT`. But it's wrong. Function should also see *Capabilities*, because if *Execution Model* is `GLCompute` and *Capability* is `SubpassShadingHUAWEI`, then shader stage exactly is `VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI`:
```
static uint32_t ExecutionModelToShaderStageFlagBits(uint32_t mode) {
switch (mode) {
...
return VK_SHADER_STAGE_FRAGMENT_BIT;
case spv::ExecutionModelGLCompute:
return VK_SHADER_STAGE_COMPUTE_BIT; // <------------ Problem here
case spv::ExecutionModelRayGenerationKHR:
return VK_SHADER_STAGE_RAYGEN_BIT_KHR;
...
}
}
```
**Valid Usage IDs**
`VUID-VkComputePipelineCreateInfo-stage-00701`
`VUID-VkPipelineShaderStageCreateInfo-pName-00707`
Contributor guide
Research direction
Start in /layers/state_tracker/shader_module.cpp at ExecutionModelToShaderStageFlagBits, then review how shader capabilities are available during stage validation. Verify handling of GLCompute with SubpassShadingHUAWEI against the VK_HUAWEI_subpass_shading example and the listed VUIDs; done means valid subpass-shading entry points no longer trigger the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100