You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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=OFFENABLE_NV_EXTENSIONS=OFFENABLE_OPT=OFF, each issue listed below describes which one was changed to generate the issue.
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.
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).
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.
The text was updated successfully, but these errors were encountered:
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
, andENABLE_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.I was getting SIGSEGV out of
glslang::TSmallArrayVector::size
by callingprogram.getUniformTType(i)->computeNumComponents()
at https://github.com/KhronosGroup/glslang/blob/master/glslang/Include/arrays.h#L103 with justENABLE_NV_EXTENSIONS=ON
. addingENABLE_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.program.getUniformBlockTType(i)->getQualifier().layoutPushConstant
will always have a integer value of 31 instead of 0 or 1 withENABLE_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).
program.getAttributeTType(i)->getQualifier().layoutLocation
will give a value of 4095, expected values range between 0-3 in my tests cases withENABLE_AMD_EXTENSIONS=ON
andENABLE_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.
The text was updated successfully, but these errors were encountered: