Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[spirv] Forward declaration of function inside another. (#3310)
* [spirv] Forward declaration of function inside another. Fixes #3214. * Add struct to test shader.
- Loading branch information
Showing
3 changed files
with
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Run: %dxc -T ps_6_0 -E main | ||
|
||
struct foo | ||
{ | ||
float memberFunction() { | ||
float MulBy3(float f); | ||
return MulBy3(.25); | ||
} | ||
}; | ||
|
||
float4 main() : SV_Target | ||
{ | ||
foo f; | ||
float a = f.memberFunction(); | ||
|
||
float MulBy2(float f); | ||
|
||
// CHECK: OpFunctionCall %float %MulBy2 %param_var_f | ||
return float4(MulBy2(.25), 1, 0, 1); | ||
} | ||
|
||
// Definitions of foo::memberFunction | ||
// CHECK: %foo_memberFunction = OpFunction %float None | ||
// CHECK: OpFunctionCall %float %MulBy3 %param_var_f_0 | ||
// CHECK: OpFunctionEnd | ||
|
||
// CHECK: %MulBy2 = OpFunction %float None | ||
float MulBy2(float f) { | ||
return f*2; | ||
} | ||
|
||
// CHECK: %MulBy3 = OpFunction %float None | ||
float MulBy3(float f) { | ||
return f*3; | ||
} | ||
|
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