facebook / igl

Intermediate Graphics Library (IGL) is a cross-platform library that commands the GPU. It provides a single low-level cross-platform interface on top of various graphics APIs (e.g. OpenGL, Metal and Vulkan).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with SPIRV reflection produced by DXC compiler

geor-kasapidi opened this issue · comments

Hi! I have a problem with spirv relfection in IGL on this line. I have a bunch of RWStructuredBuffers in my shader, and DXC emits spirv for them as uniform+uniformblock decoration. My current solution for this is very dumb:

    const bool isStorage = (id.storageClass == SpvStorageClassUniform ||
                            id.storageClass == SpvStorageClassUniformConstant) && id.dset == 2; // kBindPoint_BuffersStorage
    const bool isUniform = (id.storageClass == SpvStorageClassUniform ||
                           id.storageClass == SpvStorageClassUniformConstant) && id.dset == 1; // kBindPoint_BuffersUniform

and it looks like the real one should use check for SpvDecorationBufferBlock maybe?

Thanks! Could you please make a PR with your hotfix? Then I can quickly do some internal testing.

yes, for sure! @corporateshark please check the PR. If you have some ideas how to make a better fix, please let me know.

@geor-kasapidi I'm hitting this validation error on Tiny_Mesh with PR #59. Which means the descriptor sets have become broken. Could you follow up on that?

Validation layer:
 Validation Error: VUID-VkGraphicsPipelineCreateInfo-layout-07988
 Object 0: handle = B8A507000000007C, type = VK_OBJECT_TYPE_SHADER_MODULE;
 MessageID = 0000000000000000
 vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] SPIR-V (VK_SHADER_STAGE_FRAGMENT_BIT) uses descriptor slot [Set 0 Binding 1] (type `VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER`) but was not declared in the pipeline layout.
The Vulkan spec states: If a resource variables is declared in a shader, a descriptor slot in layout must match the shader stage
(https://vulkan.lunarg.com/doc/view/1.3.268.0/windows/1.3-extensions/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-layout-07988)
[IGL] Assert failed in 'unsigned int __cdecl `anonymous-namespace'::vulkanDebugCallback(enum VkDebugUtilsMessageSeverityFlagBitsEXT,unsigned int,const struct VkDebugUtilsMessengerCallbackDataEXT *,void *)' (C:\open\fbsource\xplat\graphics\igl\public\src\igl\vulkan\VulkanContext.cpp:112): false

@corporateshark sorry, i think i will have some time in the next week to investigate this - just now, i will close this issue and my pr, and come back with a better solution.