-
Notifications
You must be signed in to change notification settings - Fork 569
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
spirv-val: VUID-FragCoord-FragCoord-04212 interaction with PerVertexKHR #5611
Comments
@spencer-lunarg @gnl21 any thoughts on this. I find the Vulkan spec surrounding which IO can be arrayed to be a confusing read. It seems there should be a part of the built-in variables section saying if the variable/struct member is decorated with PerVertex then the arraying should be peeled before applying the VUs. |
My immediate thought is that I'm not sure that you're supposed to be able to use Having said all that, if this were to be allowed then yes, I think the array level would need to be removed first so that the value at each vertex follows the normal rules for what the value has to be (a vector of floats, in this case). |
Which part of the spec limits
Seems like any vertex shader output can be forwarded to the fragment shader input as-is, including builtins.. (On the DXC side, the feature is mostly broken, so any decision is fine for me) |
There isn't really one, as I said, but I think this was the intent, so the lack of a restriction would be a bug. Technically the spec does have the VUs:
and
which would prohibit this, but if it is supposed to be banned then it should be much clearer.
The problem is that some of the fragment shader builtin inputs do not have corresponding vertex shader outputs. I can imagine that My implementation doesn't support this extension at the moment, but it would be disproportionately expensive for us to provide access to these not-quite-vertex-outputs at each vertex. |
Right, thanks! So to recap, PerVertexKHR shall only be used on used-defined outputs, and no builtins at all. I can work with that on the compiler side :) |
As @gnl21 said, it's possibly missing a restriction. I don't think it was intended, though I didn't really touch this bit of the spec in the move from NV to KHR other than the "missing vertex" stuff. |
Hi,
I'm working on a bug in DXC related to SPV_KHR_fragment_shader_barycentric.
From what I gather, an input decorated with the
PerVertexKHR
becomes a an array of N elements, N being the number of vertices composing the primitive.Building this code yields this SPIR-V:
So we have:
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %gl_FragCoord PerVertexKHR
%gl_FragCoord = OpVariable %_ptr_Input__arr_v4float_uint_3 Input %out_var_SV_Target = OpVariable %_ptr_Output_v4float Output
This seem to go in the direction of the extension spec, but SPIRV-val complains that we go against
VUID-FragCoord-FragCoord-04212
as the variable decorated withFragCoord
doesn't have the correct type.I believe this is a "validation" error, but since not SPV_KHR_fragment_shader_barycentric nor VK_KHR_fragment_shader_barycentric relaxes the validation rules, maybe that's a spec issue?
The text was updated successfully, but these errors were encountered: