-
Notifications
You must be signed in to change notification settings - Fork 102
/
GLSL_EXT_debug_printf.txt
148 lines (95 loc) · 4.23 KB
/
GLSL_EXT_debug_printf.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
Name
EXT_debug_printf
Name Strings
GL_EXT_debug_printf
Contact
Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
Contributors
Status
Draft
Version
Last Modified Date: March 04, 2020
Revision: 1
Number
TBD
Dependencies
This extension requires GL_KHR_vulkan_glsl
Overview
This extension adds a "debugPrintfEXT" built-in function that is similar
to printf in C, but is implemented by the Vulkan validation layers and
the output goes to the debug output log.
New Procedures and Functions
None.
New Tokens
None.
Modifications to GL_KHR_vulkan_glsl
Add to the "Mapping to SPIR-V" section
debugPrintfEXT -> NonSemantic.DebugPrintf
literal string -> OpString
Modifications to the OpenGL Shading Language Specification, Version 4.60
Including the following line in a shader can be used to control the
language features described in this extension:
#extension GL_EXT_debug_printf : <behavior>
where <behavior> is as specified in section 3.3
New preprocessor #defines are added to the OpenGL Shading Language:
#define GL_EXT_debug_printf 1
Modify section 3.1 Character Set and Phases of Compilation
Add to the list of supported characters:
single quote ('), double quote ("), backslash (\)
Replace the paragraph beginning with "There are no digraphs or trigraphs"
with:
There are no digraphs or trigraphs. Outside of string literals (described
below), there are no escape sequences or uses of the backslash beyond use
as the line-continuation character
Replace the paragraph "There are no character or string data types, so
no quoting characters are included" with:
There are no character or string data types, but literal strings can be
used. A literal string is an initial double quote character, followed by
a sequence of characters and escape sequences, followed by a final double
quote character. An escape sequence is a short sequence of characters
contained within a string literal where the first character of the
sequence is a backslash. The escape sequences and character they are
treated as are:
- \' -> single quote
- \" -> double quote
- \? -> question mark
- \\ -> backslash
- \a -> alert (ASCII 0x07)
- \b -> backspace (ASCII 0x08)
- \f -> page break (ASCII 0x0C)
- \n -> new line (ASCII 0x0A)
- \r -> carriage return (ASCII 0x0D)
- \t -> horizontal tab (ASCII 0x09)
- \v -> vertical tab (ASCII 0x0B)
- \xhh -> 'hh' interpreted as a hexadecimal number
- \nnn -> 'nnn' interpreted as an octal number
Octal escape sequences consist of one, two, or three octal digits, and end
at the first character that is not an octal digit or at the third octal
digit, whichever comes first.
Hexadecimal escape sequences have one or more hex digits, and end at the
first character that is not a hex digit.
If the octal or hexadecimal value is greater than 127, then the escape
sequence has an undefined value.
Add a new section 8.X Debug Functions:
void debugPrintfEXT(...);
debugPrintfEXT writes output to an implementation-defined stream under
control of the format string passed as the first argument, which can
include format specifiers that control how subsequent arguments are
converted for output. If there are insufficient arguments for the format
specifiers, the behavior is undefined. If the format is exhausted while
arguments remain, the excess arguments are ignored.
This function has a variable number of arguments, and the first argument
must be a literal string. Other arguments can be of any type and must
match the type indicated by the order of the format specifiers in the
string. No type conversions or overload matching rules are applied to
the arguments.
Interpretation of the format specifiers is specified by the client API.
The set of format specifiers is implementation-dependent, but must
include at least "%d" and "%i" (int), "%u" (uint), and "%f" (float).
Errors
None.
Issues
None.
Revision History
Revision 1
- Internal revisions.