-
Notifications
You must be signed in to change notification settings - Fork 948
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow unconsumed inputs in fragment shaders by removing them from vertex
outputs when generating HLSL. Fixes #3748 * Add naga::back::hlsl::FragmentEntryPoint for providing information about the fragment entry point when generating vertex entry points via naga::back::hlsl::Writer::write. Vertex outputs not consumed by the fragment entry point are omitted in the final output struct. * Add naga snapshot test for this new feature, * Remove Features::SHADER_UNUSED_VERTEX_OUTPUT, StageError::InputNotConsumed, and associated validation logic. * Make wgpu dx12 backend pass fragment shader info when generating vertex HLSL. * Add wgpu regression test for allowing unconsumed inputs.
- Loading branch information
Showing
25 changed files
with
366 additions
and
70 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
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
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,2 @@ | ||
( | ||
) |
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,13 @@ | ||
// Out of order to test sorting. | ||
struct FragmentIn { | ||
@location(1) value: f32, | ||
@location(3) value2: f32, | ||
@builtin(position) position: vec4<f32>, | ||
// @location(0) unused_value: f32, | ||
// @location(2) unused_value2: vec4<f32>, | ||
} | ||
|
||
@fragment | ||
fn fs_main(v_out: FragmentIn) -> @location(0) vec4<f32> { | ||
return vec4<f32>(v_out.value, v_out.value, v_out.value2, v_out.value2); | ||
} |
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,2 @@ | ||
( | ||
) |
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,13 @@ | ||
// Out of order to test sorting. | ||
struct VertexOut { | ||
@builtin(position) position: vec4<f32>, | ||
@location(1) value: f32, | ||
@location(2) unused_value2: vec4<f32>, | ||
@location(0) unused_value: f32, | ||
@location(3) value2: f32, | ||
} | ||
|
||
@vertex | ||
fn vs_main() -> VertexOut { | ||
return VertexOut(vec4(1.0), 1.0, vec4(2.0), 1.0, 0.5); | ||
} |
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,17 @@ | ||
struct FragmentIn { | ||
float value : LOC1; | ||
float value2_ : LOC3; | ||
float4 position : SV_Position; | ||
}; | ||
|
||
struct FragmentInput_fs_main { | ||
float value : LOC1; | ||
float value2_ : LOC3; | ||
float4 position : SV_Position; | ||
}; | ||
|
||
float4 fs_main(FragmentInput_fs_main fragmentinput_fs_main) : SV_Target0 | ||
{ | ||
FragmentIn v_out = { fragmentinput_fs_main.value, fragmentinput_fs_main.value2_, fragmentinput_fs_main.position }; | ||
return float4(v_out.value, v_out.value, v_out.value2_, v_out.value2_); | ||
} |
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,12 @@ | ||
( | ||
vertex:[ | ||
], | ||
fragment:[ | ||
( | ||
entry_point:"fs_main", | ||
target_profile:"ps_5_1", | ||
), | ||
], | ||
compute:[ | ||
], | ||
) |
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,30 @@ | ||
struct VertexOut { | ||
float4 position : SV_Position; | ||
float value : LOC1; | ||
float4 unused_value2_ : LOC2; | ||
float unused_value : LOC0; | ||
float value2_ : LOC3; | ||
}; | ||
|
||
struct VertexOutput_vs_main { | ||
float value : LOC1; | ||
float value2_ : LOC3; | ||
float4 position : SV_Position; | ||
}; | ||
|
||
VertexOut ConstructVertexOut(float4 arg0, float arg1, float4 arg2, float arg3, float arg4) { | ||
VertexOut ret = (VertexOut)0; | ||
ret.position = arg0; | ||
ret.value = arg1; | ||
ret.unused_value2_ = arg2; | ||
ret.unused_value = arg3; | ||
ret.value2_ = arg4; | ||
return ret; | ||
} | ||
|
||
VertexOutput_vs_main vs_main() | ||
{ | ||
const VertexOut vertexout = ConstructVertexOut((1.0).xxxx, 1.0, (2.0).xxxx, 1.0, 0.5); | ||
const VertexOutput_vs_main vertexout_1 = { vertexout.value, vertexout.value2_, vertexout.position }; | ||
return vertexout_1; | ||
} |
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,12 @@ | ||
( | ||
vertex:[ | ||
( | ||
entry_point:"vs_main", | ||
target_profile:"vs_5_1", | ||
), | ||
], | ||
fragment:[ | ||
], | ||
compute:[ | ||
], | ||
) |
Oops, something went wrong.