-
Notifications
You must be signed in to change notification settings - Fork 863
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2435 from amdrexu/feature
HLSL: Add support for printf().
- Loading branch information
Showing
9 changed files
with
216 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
hlsl.printf.comp | ||
Shader version: 500 | ||
local_size = (1, 1, 1) | ||
0:? Sequence | ||
0:4 Function Definition: @main( ( temp void) | ||
0:4 Function Parameters: | ||
0:? Sequence | ||
0:5 Debug printf ( temp void) | ||
0:5 Constant: | ||
0:5 "first string" | ||
0:6 Debug printf ( temp void) | ||
0:6 Constant: | ||
0:6 "please print this message." | ||
0:7 Debug printf ( temp void) | ||
0:7 Constant: | ||
0:7 "Variables are: %d %d %.2f" | ||
0:7 Constant: | ||
0:7 1 (const uint) | ||
0:7 Constant: | ||
0:7 2 (const uint) | ||
0:7 Constant: | ||
0:7 1.500000 | ||
0:8 Debug printf ( temp void) | ||
0:8 Constant: | ||
0:8 "Integers are: %d %d %d" | ||
0:8 Constant: | ||
0:8 1 (const int) | ||
0:8 Constant: | ||
0:8 2 (const int) | ||
0:8 Constant: | ||
0:8 3 (const int) | ||
0:9 Debug printf ( temp void) | ||
0:9 Constant: | ||
0:9 "More: %d %d %d %d %d %d %d %d %d %d" | ||
0:9 Constant: | ||
0:9 1 (const int) | ||
0:9 Constant: | ||
0:9 2 (const int) | ||
0:9 Constant: | ||
0:9 3 (const int) | ||
0:9 Constant: | ||
0:9 4 (const int) | ||
0:9 Constant: | ||
0:9 5 (const int) | ||
0:9 Constant: | ||
0:9 6 (const int) | ||
0:9 Constant: | ||
0:9 7 (const int) | ||
0:9 Constant: | ||
0:9 8 (const int) | ||
0:9 Constant: | ||
0:9 9 (const int) | ||
0:9 Constant: | ||
0:9 10 (const int) | ||
0:4 Function Definition: main( ( temp void) | ||
0:4 Function Parameters: | ||
0:? Sequence | ||
0:4 Function Call: @main( ( temp void) | ||
0:? Linker Objects | ||
0:? 'first' ( const string) | ||
0:? "first string" | ||
|
||
|
||
Linked compute stage: | ||
|
||
|
||
Shader version: 500 | ||
local_size = (1, 1, 1) | ||
0:? Sequence | ||
0:4 Function Definition: @main( ( temp void) | ||
0:4 Function Parameters: | ||
0:? Sequence | ||
0:5 Debug printf ( temp void) | ||
0:5 Constant: | ||
0:5 "first string" | ||
0:6 Debug printf ( temp void) | ||
0:6 Constant: | ||
0:6 "please print this message." | ||
0:7 Debug printf ( temp void) | ||
0:7 Constant: | ||
0:7 "Variables are: %d %d %.2f" | ||
0:7 Constant: | ||
0:7 1 (const uint) | ||
0:7 Constant: | ||
0:7 2 (const uint) | ||
0:7 Constant: | ||
0:7 1.500000 | ||
0:8 Debug printf ( temp void) | ||
0:8 Constant: | ||
0:8 "Integers are: %d %d %d" | ||
0:8 Constant: | ||
0:8 1 (const int) | ||
0:8 Constant: | ||
0:8 2 (const int) | ||
0:8 Constant: | ||
0:8 3 (const int) | ||
0:9 Debug printf ( temp void) | ||
0:9 Constant: | ||
0:9 "More: %d %d %d %d %d %d %d %d %d %d" | ||
0:9 Constant: | ||
0:9 1 (const int) | ||
0:9 Constant: | ||
0:9 2 (const int) | ||
0:9 Constant: | ||
0:9 3 (const int) | ||
0:9 Constant: | ||
0:9 4 (const int) | ||
0:9 Constant: | ||
0:9 5 (const int) | ||
0:9 Constant: | ||
0:9 6 (const int) | ||
0:9 Constant: | ||
0:9 7 (const int) | ||
0:9 Constant: | ||
0:9 8 (const int) | ||
0:9 Constant: | ||
0:9 9 (const int) | ||
0:9 Constant: | ||
0:9 10 (const int) | ||
0:4 Function Definition: main( ( temp void) | ||
0:4 Function Parameters: | ||
0:? Sequence | ||
0:4 Function Call: @main( ( temp void) | ||
0:? Linker Objects | ||
0:? 'first' ( const string) | ||
0:? "first string" | ||
|
||
// Module Version 10000 | ||
// Generated by (magic number): 8000a | ||
// Id's are bound by 36 | ||
|
||
Capability Shader | ||
Extension "SPV_KHR_non_semantic_info" | ||
1: ExtInstImport "GLSL.std.450" | ||
9: ExtInstImport "NonSemantic.DebugPrintf" | ||
MemoryModel Logical GLSL450 | ||
EntryPoint GLCompute 4 "main" | ||
ExecutionMode 4 LocalSize 1 1 1 | ||
8: String "first string" | ||
11: String "please print this message." | ||
13: String "Variables are: %d %d %.2f" | ||
20: String "Integers are: %d %d %d" | ||
26: String "More: %d %d %d %d %d %d %d %d %d %d" | ||
Source HLSL 500 | ||
Name 4 "main" | ||
Name 6 "@main(" | ||
2: TypeVoid | ||
3: TypeFunction 2 | ||
14: TypeInt 32 0 | ||
15: 14(int) Constant 1 | ||
16: 14(int) Constant 2 | ||
17: TypeFloat 32 | ||
18: 17(float) Constant 1069547520 | ||
21: TypeInt 32 1 | ||
22: 21(int) Constant 1 | ||
23: 21(int) Constant 2 | ||
24: 21(int) Constant 3 | ||
27: 21(int) Constant 4 | ||
28: 21(int) Constant 5 | ||
29: 21(int) Constant 6 | ||
30: 21(int) Constant 7 | ||
31: 21(int) Constant 8 | ||
32: 21(int) Constant 9 | ||
33: 21(int) Constant 10 | ||
4(main): 2 Function None 3 | ||
5: Label | ||
35: 2 FunctionCall 6(@main() | ||
Return | ||
FunctionEnd | ||
6(@main(): 2 Function None 3 | ||
7: Label | ||
10: 2 ExtInst 9(NonSemantic.DebugPrintf) 1(DebugPrintf) 8 | ||
12: 2 ExtInst 9(NonSemantic.DebugPrintf) 1(DebugPrintf) 11 | ||
19: 2 ExtInst 9(NonSemantic.DebugPrintf) 1(DebugPrintf) 13 15 16 18 | ||
25: 2 ExtInst 9(NonSemantic.DebugPrintf) 1(DebugPrintf) 20 22 23 24 | ||
34: 2 ExtInst 9(NonSemantic.DebugPrintf) 1(DebugPrintf) 26 22 23 24 27 28 29 30 31 32 33 | ||
Return | ||
FunctionEnd |
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 @@ | ||
const string first = "first string"; | ||
|
||
[numthreads(1,1,1)] | ||
void main() { | ||
printf(first); | ||
printf("please print this message."); | ||
printf("Variables are: %d %d %.2f", 1u, 2u, 1.5f); | ||
printf("Integers are: %d %d %d", 1, 2, 3); | ||
printf("More: %d %d %d %d %d %d %d %d %d %d", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); | ||
} | ||
|
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