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.
Propagate precise from formal parameter to actual parameter (microsof…
…t#6058) It is unclear what should happen if an input parameter on a function is marked as precise. I am choosing to propagate it to the actual parameters. Note that it is not wrong to propagate precise more than we should since it will only stop some optimizations.
- Loading branch information
Showing
4 changed files
with
44 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
20 changes: 20 additions & 0 deletions
20
tools/clang/test/CodeGenSPIRV/decoration.no-contraction.parameters.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,20 @@ | ||
// RUN: %dxc -T vs_6_0 -E VSMain %s -fcgl -spirv | FileCheck %s | ||
|
||
struct VSInput | ||
{ | ||
float4 pos : ATTRIBUTE0; | ||
}; | ||
|
||
float4x4 Proj; | ||
|
||
precise float4 MakePrecise(precise float4 v) { return v; } | ||
|
||
// CHECK: OpDecorate [[mul:%[0-9]+]] NoContraction | ||
|
||
void VSMain(VSInput input, out precise float4 OutputPos : SV_Position) | ||
{ | ||
// CHECK: [[mul]] = OpMatrixTimesVector | ||
// CHECK: OpStore %param_var_v [[mul]] | ||
// CHECK: OpFunctionCall %v4float %MakePrecise %param_var_v | ||
OutputPos = MakePrecise(mul(input.pos, Proj)); | ||
} |