-
Notifications
You must be signed in to change notification settings - Fork 836
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
Using gl_ObjectToWorld3x4EXT and gl_ObjectToWorldEXT at the same time leads to invalid SPIR-V #3007
Comments
Interesting data point; when swapping the usage of gl_ObjectToWorldEXT and gl_ObjectToWorld3x4EXT, it does seem to do the right thing:
|
cc @andfau-arm who provided the fix for #2921 |
Looking at my patch from #2955 (which fixed #2921) again, I wonder if it could be somehow related to the "forced type" part here in if (mayNeedToReuseBuiltIn) {
auto iter = builtInVariableIds.find(uint32_t(builtIn));
if (builtInVariableIds.end() != iter) {
id = iter->second;
symbolValues[symbol->getId()] = id;
if (forcedType.second != spv::NoType)
forceType[id] = forcedType.second;
return id;
}
} Do we "force" the type (the transposed matrix type) for both uses of the built-in if they come in the "wrong" order? |
If that is indeed the problem, then the fix would be to use something other than the SPIR-V ID to track values that need "forced" types. The 3x4 and 4x3 matrices need to have the same SPIR-V ID (because we can only have one OpVariable), but they must have different types, one "forced". |
Just chiming in here to say that I'm seeing the same problem with In my particular case, I was able to work around the problem by replacing this line: vec3 objectPos = gl_WorldToObjectEXT * vec4(result.worldPosition, 1); with this line: vec3 objectPos = vec4(result.worldPosition, 1) * gl_WorldToObject3x4EXT; This is the first use of gl_WorldToObject* in a closest hit shader. Later gl_WorldToObject3x4EXT is used again during the same shader invocation. |
leads to invalid SPIR-V that the validator will later complain about:
What happens is that gl_ObjectToWorldEXT will be applied a transpose (in the SPIR-V) when it should not.
This seems to be very related to an older issue: #2921
This issue is present in the latest Vulkan SDK, 1.3.216.0
gl_WorldToObjectEXT and gl_WorldToObject3x4EXT are likely also affected.
The text was updated successfully, but these errors were encountered: