Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD & NVidia Extension Issues #1617

Open
mattparks opened this issue Dec 6, 2018 · 0 comments
Open

AMD & NVidia Extension Issues #1617

mattparks opened this issue Dec 6, 2018 · 0 comments
Labels
reflection Pertaining to shader reflection

Comments

@mattparks
Copy link
Contributor

mattparks commented Dec 6, 2018

I have been using glslang for Vulkan shader compilation and reflection, recently we have enabled linking to distributed glslang and SPIRV dlls, this caused segfaults in the application.
To try and find what options caused errors I created a test application with simple reflection, I found ENABLE_AMD_EXTENSIONS, and ENABLE_NV_EXTENSIONS to be the culprits, and the results are interesting.
The default build configuration has ENABLE_AMD_EXTENSIONS=OFF ENABLE_NV_EXTENSIONS=OFF ENABLE_OPT=OFF, each issue listed below describes which one was changed to generate the issue.

  1. I was getting SIGSEGV out of glslang::TSmallArrayVector::size by calling program.getUniformTType(i)->computeNumComponents() at https://github.com/KhronosGroup/glslang/blob/master/glslang/Include/arrays.h#L103 with just ENABLE_NV_EXTENSIONS=ON. adding ENABLE_AMD_EXTENSIONS=ON appears fix the crash, the array size is then not multiplied into the result (something I added in my main.cpp).
    With this point I would like to ask how to properly find the byte size of a uniform, we can get the byte size of a uniform block with program.getUniformBlockSize(i) but not of each individual uniform in the block or on its own.

  2. program.getUniformBlockTType(i)->getQualifier().layoutPushConstant will always have a integer value of 31 instead of 0 or 1 with ENABLE_AMD_EXTENSIONS=ON.
    This point and the next are very similar with the value set to a strange constant number, I checked and the qualifier pointer in the TProgram reflection and the one returned are to the same address but with some values altered (no process was run between checking the pointers).

  3. program.getAttributeTType(i)->getQualifier().layoutLocation will give a value of 4095, expected values range between 0-3 in my tests cases with ENABLE_AMD_EXTENSIONS=ON and ENABLE_NV_EXTENSIONS=ON. If I were to create a method in TProgram to fetch the values they are returned correctly: int TProgram::getAttributeLocation(int index) const { return reflection->getAttribute(index).getType()->getQualifier().layoutPushConstant; }

I ran my tests on Windows 10 in CLion, and with Ubuntu 18.10 using GCC7, I am including all of these findings in one issue as many relate to each other. My tests can be found here: https://github.com/mattparks/glsltest. debug/debug.cpp was used to create the outputs in debug that show the exact outputs seen.
There were more issues found with just these three build options, I found workarounds to the other issues with the three listed here being severe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reflection Pertaining to shader reflection
Projects
None yet
Development

No branches or pull requests

2 participants