-
Notifications
You must be signed in to change notification settings - Fork 858
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
HLSL: Type mismatch between vertex shader output and hull shader input #1197
Comments
Yes, the I/O structures should be flattened. I will look into why that is not happening. |
@dustin-lunarg Curious, if I try using
In a hull shader with fxc, I get errors on the TEXCOORD semantics. Do your shaders work with fxc? |
@johnkslang The hull shaders producing the validation error are working with fxc. The following simplified example should compile with fxc /T hs_5_0 /E HS_Main:
In this case, I have some tessellation shaders that work with the Direct3D version of an application, but have issues when used with the Vulkan version. There is the validation error reported here and a rendering issue reported in #1181. Modifying the SPIR-V to eliminate the validation error reported here does not seem to affect the issue reported in #1181. |
So,
Currently, non-patch, arrayed I/O that does not contain a built-in is not flattened or split. |
Perhaps the problem is that the top level of hierarchy should not be flattened, because it is an array, but the next level down should be flattened. @loopdawg ? I think you dealt with |
Wait a minute, @dustin-lunarg , between me saying I couldn't reproduce and you posting a more complete example, you changed SV_POSITION -> POSITION. SV_POSITION is a built-in, while POSITION is not. Is your interface mixing these? |
@johnkslang Sorry, I meant to use SV_POSITION in both examples. I pasted the wrong code for the second example. Both vertex shader output and hull shader input are using SV_POSITION with the shaders that produce this validation error. With SV_POSITION, the hull shader input I is split into I_m_Position for the built-in and an I_0 struct for the user-defined values. It is a comparison between the I_0 struct input type and the vertex shader _entryPointOutput_m_TexCoord0 output type that seems to be the source of the validation error. |
The fundamental problem is that arrayed I/O containing a built-in (e.g., an array of struct input to hull) is "split", while a simple struct (e.g., an output struct from vertex) is "flattened". |
When creating a Vulkan graphics pipeline with a hull shader, vkCreateGraphicsPipelines is generating a validation error that indicates there is a type mismatch between the vertex and hull shader stages.
When the following struct is used as the vertex shader output/hull shader input:
The SPIR-V emitted for the vertex shader has the output struct split into separate values, where the user defined values each have their own location:
The SPIR-V emitted for the hull shader has the input struct split into a single value for the position builtin and a struct containing the user defined values, where the struct containing the user defined values is assigned location 0. In the following example the input struct was originally named I, which became I_0 for the struct containing the user defined values after the split:
This produces the following validation error:
If I am deciphering this correctly, it says that the vec4 at output location 0 (%_entryPointOutput_m_TexCoord0) does not match the struct at input location 0 (%I_0).
Modifying the SPIR-V for the hull shader to split the input struct into separate vec4 values eliminates the validation error:
The text was updated successfully, but these errors were encountered: