-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where inter-stage parameters without semantics don't get lo…
…cation attributes (#5670) * wgsl: Make sure each shader input field has a semantic This closes #5633. * Add test for inter-stage variables without semantics This verifies the fix of the second issue identified in #5633 * format code --------- Co-authored-by: slangbot <[email protected]>
- Loading branch information
Showing
4 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
tests/render/multiple-stage-io-locations-without-user-semantics.slang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// TODO: Investigate failures on non-WebGPU backends | ||
//TEST(smoke,render):COMPARE_HLSL_RENDER: -wgpu | ||
|
||
cbuffer Uniforms | ||
{ | ||
float4x4 modelViewProjection; | ||
} | ||
|
||
struct AssembledVertex | ||
{ | ||
float3 position; | ||
float3 color; | ||
}; | ||
|
||
struct Fragment | ||
{ | ||
float4 color; | ||
}; | ||
|
||
// Vertex Shader | ||
|
||
struct VertexStageInput | ||
{ | ||
AssembledVertex assembledVertex : A; | ||
}; | ||
|
||
struct VertexStageOutput | ||
{ | ||
float3 color; | ||
float3 localPosition; | ||
float4 sv_position : SV_Position; | ||
}; | ||
|
||
VertexStageOutput vertexMain(VertexStageInput input) | ||
{ | ||
VertexStageOutput output; | ||
|
||
float3 position = input.assembledVertex.position; | ||
float3 color = input.assembledVertex.color; | ||
|
||
output.color = color; | ||
output.sv_position = mul(modelViewProjection, float4(position, 1.0)); | ||
output.localPosition = position; | ||
|
||
return output; | ||
} | ||
|
||
// Fragment Shader | ||
|
||
struct FragmentStageInput | ||
{ | ||
float3 color; | ||
float3 localPosition; | ||
}; | ||
|
||
struct FragmentStageOutput | ||
{ | ||
Fragment fragment : SV_Target; | ||
}; | ||
|
||
FragmentStageOutput fragmentMain(FragmentStageInput input) | ||
{ | ||
FragmentStageOutput output; | ||
|
||
float3 color = input.color; | ||
|
||
if (input.color.y < input.color.z) | ||
{ | ||
output.fragment.color = float4(input.localPosition, 1.0); | ||
} | ||
else | ||
{ | ||
output.fragment.color = float4(input.color, 1.0); | ||
} | ||
|
||
return output; | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/render/multiple-stage-io-locations-without-user-semantics.slang.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
result code = 0 | ||
standard error = { | ||
} | ||
standard output = { | ||
} |
Binary file added
BIN
+35.8 KB
tests/render/multiple-stage-io-locations-without-user-semantics.slang.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.