-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sema: gracefully reject 0-sized IO patch (#6138)
InputPatch and OutputPatch array size must be greater than 0. Before this patch we emitted a validation error, which told the user this was a compiler issue. Fixes #3734 --------- Signed-off-by: Nathan Gauër <[email protected]>
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
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,11 @@ | ||
// RUN: %dxc -T ds_6_0 -E main -verify %s | ||
// RUN: %dxc -T ds_6_0 -E main -verify %s -spirv | ||
|
||
struct ControlPoint { | ||
float position : MY_BOOL; | ||
}; | ||
|
||
ControlPoint main(const OutputPatch<ControlPoint, 0> patch) { // expected-error {{OutputPatch element count must be greater than 0}} | ||
return patch[0]; | ||
} | ||
|
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,23 @@ | ||
// RUN: %dxc -T hs_6_0 -E main -verify %s | ||
// RUN: %dxc -T hs_6_0 -E main -verify %s -spirv | ||
|
||
struct ControlPoint { | ||
float position : MY_BOOL; | ||
}; | ||
|
||
struct PatchData { | ||
float edge [3] : SV_TessFactor; | ||
float inside : SV_InsideTessFactor; | ||
}; | ||
|
||
PatchData HullConst () { return (PatchData)0; } | ||
|
||
[domain("tri")] | ||
[partitioning("fractional_odd")] | ||
[outputtopology("triangle_cw")] | ||
[patchconstantfunc("HullConst")] | ||
[outputcontrolpoints(3)] | ||
ControlPoint main(InputPatch<ControlPoint, 0> v, // expected-error {{InputPatch element count must be greater than 0}} | ||
uint id : SV_OutputControlPointID) { | ||
return v[id]; | ||
} |