forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
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
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. Signed-off-by: Nathan Gauër <brioche@google.com>
Showing
4 changed files
with
57 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
11 changes: 11 additions & 0 deletions
11
tools/clang/test/CodeGenHLSL/ds-error-outputpatch-size.hlsl
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: not %dxc -T ds_6_0 -E main %s 2>&1 | FileCheck %s | ||
|
||
struct ControlPoint { | ||
float position : MY_BOOL; | ||
}; | ||
|
||
ControlPoint main(const OutputPatch<ControlPoint, 0> patch) { | ||
// CHECK: error: OutputPatch element count must be greater than 0 | ||
return patch[0]; | ||
} | ||
|
22 changes: 22 additions & 0 deletions
22
tools/clang/test/CodeGenHLSL/hs-error-inputpatch-size.hlsl
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,22 @@ | ||
// RUN: not %dxc -T hs_6_0 -E main %s 2>&1 | FileCheck %s | ||
|
||
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, uint id : SV_OutputControlPointID) { | ||
// CHECK: error: InputPatch element count must be greater than 0 | ||
return v[id]; | ||
} |