-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wgsl: Fix field semantics even if input struct doesn't need flattening (
#5642) * wgsl: Fix field semantics even if input struct doesn't need flattening Helps to address issue #5633. * Add test for multiple stage IO locations This verifies part of issue #5633.
- Loading branch information
Showing
9 changed files
with
96 additions
and
3 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
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
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,78 @@ | ||
//TEST(smoke,render):COMPARE_HLSL_RENDER: | ||
// TODO: Investigate Metal failure | ||
//DISABLE_TEST(smoke,render):COMPARE_HLSL_RENDER: -mtl | ||
|
||
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 : VERTEX_COLOR; | ||
float3 localPosition : VERTEX_LOCAL_POSITION; | ||
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 : VERTEX_COLOR; | ||
float3 localPosition : VERTEX_LOCAL_POSITION; | ||
}; | ||
|
||
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; | ||
} |
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 = { | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 = { | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 = { | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.