1bf215546Sopenharmony_ciName
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci    MESA_shader_debug
4bf215546Sopenharmony_ci
5bf215546Sopenharmony_ciName Strings
6bf215546Sopenharmony_ci
7bf215546Sopenharmony_ci    GL_MESA_shader_debug
8bf215546Sopenharmony_ci
9bf215546Sopenharmony_ciContact
10bf215546Sopenharmony_ci
11bf215546Sopenharmony_ci    Brian Paul (brian.paul 'at' tungstengraphics.com)
12bf215546Sopenharmony_ci    Michal Krol (mjkrol 'at' gmail.com)
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_ciStatus
15bf215546Sopenharmony_ci
16bf215546Sopenharmony_ci    Obsolete.
17bf215546Sopenharmony_ci
18bf215546Sopenharmony_ciVersion
19bf215546Sopenharmony_ci
20bf215546Sopenharmony_ci    Last Modified Date: July 30, 2006
21bf215546Sopenharmony_ci    Author Revision: 0.2
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_ciNumber
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci    TBD
26bf215546Sopenharmony_ci
27bf215546Sopenharmony_ciDependencies
28bf215546Sopenharmony_ci
29bf215546Sopenharmony_ci    OpenGL 1.0 is required.
30bf215546Sopenharmony_ci
31bf215546Sopenharmony_ci    The ARB_shader_objects extension is required.
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci    The ARB_shading_language_100 extension is required.
34bf215546Sopenharmony_ci
35bf215546Sopenharmony_ci    The extension is written against the OpenGL 1.5 specification.
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci    The extension is written against the OpenGL Shading Language 1.10
38bf215546Sopenharmony_ci    Specification.
39bf215546Sopenharmony_ci
40bf215546Sopenharmony_ciOverview
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci    This extension introduces a debug object that can be attached to
43bf215546Sopenharmony_ci    a program object to enable debugging. Vertex and/or fragment shader,
44bf215546Sopenharmony_ci    during execution, issue diagnostic function calls that are logged
45bf215546Sopenharmony_ci    to the debug object's log. A separate debug log for each shader type
46bf215546Sopenharmony_ci    is maintained. A debug object can be attached, detached and queried
47bf215546Sopenharmony_ci    at any time outside the Begin/End pair. Multiple debug objects can
48bf215546Sopenharmony_ci    be attached to a single program object.
49bf215546Sopenharmony_ci
50bf215546Sopenharmony_ciIP Status
51bf215546Sopenharmony_ci
52bf215546Sopenharmony_ci    None
53bf215546Sopenharmony_ci
54bf215546Sopenharmony_ciIssues
55bf215546Sopenharmony_ci
56bf215546Sopenharmony_ci    None
57bf215546Sopenharmony_ci
58bf215546Sopenharmony_ciNew Procedures and Functions
59bf215546Sopenharmony_ci
60bf215546Sopenharmony_ci    handleARB CreateDebugObjectMESA(void)
61bf215546Sopenharmony_ci    void ClearDebugLogMESA(handleARB obj, enum logType, enum shaderType)
62bf215546Sopenharmony_ci    void GetDebugLogMESA(handleARB obj, enum logType, enum shaderType,
63bf215546Sopenharmony_ci                         sizei maxLength, sizei *length,
64bf215546Sopenharmony_ci                         charARB *debugLog)
65bf215546Sopenharmony_ci    sizei GetDebugLogLengthMESA(handleARB obj, enum logType,
66bf215546Sopenharmony_ci                                enum shaderType)
67bf215546Sopenharmony_ci
68bf215546Sopenharmony_ciNew Types
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci    None
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_ciNew Tokens
73bf215546Sopenharmony_ci
74bf215546Sopenharmony_ci    Returned by the <params> parameter of GetObjectParameter{fi}vARB:
75bf215546Sopenharmony_ci
76bf215546Sopenharmony_ci        DEBUG_OBJECT_MESA                               0x8759
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_ci    Accepted by the <logType> argument of ClearDebugLogMESA,
79bf215546Sopenharmony_ci    GetDebugLogLengthMESA and GetDebugLogMESA:
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci        DEBUG_PRINT_MESA                                0x875A
82bf215546Sopenharmony_ci        DEBUG_ASSERT_MESA                               0x875B
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.5 Specification
85bf215546Sopenharmony_ci(OpenGL Operation)
86bf215546Sopenharmony_ci
87bf215546Sopenharmony_ci    None
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization)
90bf215546Sopenharmony_ci
91bf215546Sopenharmony_ci    None
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment
94bf215546Sopenharmony_ciOperations and the Frame Buffer)
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ci    None
97bf215546Sopenharmony_ci
98bf215546Sopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.5 Specification
99bf215546Sopenharmony_ci(Special Functions)
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci    None
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.5 Specification (State and State
104bf215546Sopenharmony_ciRequests)
105bf215546Sopenharmony_ci
106bf215546Sopenharmony_ci    None
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_ciAdditions to Appendix A of the OpenGL 1.5 Specification (Invariance)
109bf215546Sopenharmony_ci
110bf215546Sopenharmony_ci    None
111bf215546Sopenharmony_ci
112bf215546Sopenharmony_ciAdditions to Chapter 1 of the OpenGL Shading Language 1.10 Specification
113bf215546Sopenharmony_ci(Introduction)
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ci    None
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ciAdditions to Chapter 2 of the OpenGL Shading Language 1.10 Specification
118bf215546Sopenharmony_ci(Overview of OpenGL Shading)
119bf215546Sopenharmony_ci
120bf215546Sopenharmony_ci    None
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ciAdditions to Chapter 3 of the OpenGL Shading Language 1.10 Specification
123bf215546Sopenharmony_ci(Basics)
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_ci    None
126bf215546Sopenharmony_ci
127bf215546Sopenharmony_ciAdditions to Chapter 4 of the OpenGL Shading Language 1.10 Specification
128bf215546Sopenharmony_ci(Variables and Types)
129bf215546Sopenharmony_ci
130bf215546Sopenharmony_ci    None
131bf215546Sopenharmony_ci
132bf215546Sopenharmony_ciAdditions to Chapter 5 of the OpenGL Shading Language 1.10 Specification
133bf215546Sopenharmony_ci(Operators and Expressions)
134bf215546Sopenharmony_ci
135bf215546Sopenharmony_ci    None
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_ciAdditions to Chapter 6 of the OpenGL Shading Language 1.10 Specification
138bf215546Sopenharmony_ci(Statements and Structure)
139bf215546Sopenharmony_ci
140bf215546Sopenharmony_ci    None
141bf215546Sopenharmony_ci
142bf215546Sopenharmony_ciAdditions to Chapter 7 of the OpenGL Shading Language 1.10 Specification
143bf215546Sopenharmony_ci(Built-in Variables)
144bf215546Sopenharmony_ci
145bf215546Sopenharmony_ci    None
146bf215546Sopenharmony_ci
147bf215546Sopenharmony_ciAdditions to Chapter 8 of the OpenGL Shading Language 1.10 Specification
148bf215546Sopenharmony_ci(Built-in Functions)
149bf215546Sopenharmony_ci
150bf215546Sopenharmony_ci    Add a new section 8.10 "Debug Functions":
151bf215546Sopenharmony_ci
152bf215546Sopenharmony_ci    Debug functions are available to both fragment and vertex shaders.
153bf215546Sopenharmony_ci    They are used to track the execution of a shader by logging
154bf215546Sopenharmony_ci    passed-in arguments to the debug object's log. Those values can be
155bf215546Sopenharmony_ci    retrieved by the application for inspection after shader execution
156bf215546Sopenharmony_ci    is complete.
157bf215546Sopenharmony_ci
158bf215546Sopenharmony_ci    The text, if any, produced by any of these functions is appended
159bf215546Sopenharmony_ci    to each debug object that is attached to the program object.
160bf215546Sopenharmony_ci    There are different debug log types
161bf215546Sopenharmony_ci
162bf215546Sopenharmony_ci    Add a new section 8.10.1 "Print Function":
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci    The following printMESA prototypes are available.
165bf215546Sopenharmony_ci
166bf215546Sopenharmony_ci        void printMESA(const float value)
167bf215546Sopenharmony_ci        void printMESA(const int value)
168bf215546Sopenharmony_ci        void printMESA(const bool value)
169bf215546Sopenharmony_ci        void printMESA(const vec2 value)
170bf215546Sopenharmony_ci        void printMESA(const vec3 value)
171bf215546Sopenharmony_ci        void printMESA(const vec4 value)
172bf215546Sopenharmony_ci        void printMESA(const ivec2 value)
173bf215546Sopenharmony_ci        void printMESA(const ivec3 value)
174bf215546Sopenharmony_ci        void printMESA(const ivec4 value)
175bf215546Sopenharmony_ci        void printMESA(const bvec2 value)
176bf215546Sopenharmony_ci        void printMESA(const bvec3 value)
177bf215546Sopenharmony_ci        void printMESA(const bvec4 value)
178bf215546Sopenharmony_ci        void printMESA(const mat2 value)
179bf215546Sopenharmony_ci        void printMESA(const mat3 value)
180bf215546Sopenharmony_ci        void printMESA(const mat4 value)
181bf215546Sopenharmony_ci        void printMESA(const sampler1D value)
182bf215546Sopenharmony_ci        void printMESA(const sampler2D value)
183bf215546Sopenharmony_ci        void printMESA(const sampler3D value)
184bf215546Sopenharmony_ci        void printMESA(const samplerCube value)
185bf215546Sopenharmony_ci        void printMESA(const sampler1DShadow value)
186bf215546Sopenharmony_ci        void printMESA(const sampler2DShadow value)
187bf215546Sopenharmony_ci
188bf215546Sopenharmony_ci    The printMESA function writes the argument <value> to the "debug
189bf215546Sopenharmony_ci    print log" (XXX DEBUG_PRINT_MESA?). Each component is written in
190bf215546Sopenharmony_ci    text format (XXX format!) and is delimited by a white space (XXX 1
191bf215546Sopenharmony_ci    or more?).
192bf215546Sopenharmony_ci
193bf215546Sopenharmony_ci    Add a new section 8.10.2 "Assert Function":
194bf215546Sopenharmony_ci
195bf215546Sopenharmony_ci    The following assertMESA prototypes are available.
196bf215546Sopenharmony_ci
197bf215546Sopenharmony_ci        void assertMESA(const bool condition)
198bf215546Sopenharmony_ci        void assertMESA(const bool condition, const int cookie)
199bf215546Sopenharmony_ci        void assertMESA(const bool condition, const int cookie,
200bf215546Sopenharmony_ci                        const int file, const int line)
201bf215546Sopenharmony_ci
202bf215546Sopenharmony_ci    The assertMESA function checks if the argument <condition> is
203bf215546Sopenharmony_ci    true or false. If it is true, nothing happens. If it is false,
204bf215546Sopenharmony_ci    a diagnostic message is written to the "debug assert log".
205bf215546Sopenharmony_ci    The message contains the argument <file>, <line>, <cookie> and
206bf215546Sopenharmony_ci    implementation dependent double-quoted string, each of this
207bf215546Sopenharmony_ci    delimited by a white space. If the argument <cookie> is not present,
208bf215546Sopenharmony_ci    it is meant as if it was of value 0. If the arguments <file> and
209bf215546Sopenharmony_ci    <line> are not present, they are meant as if they were of values
210bf215546Sopenharmony_ci    __FILE__ and __LINE__, respectively. The following three calls
211bf215546Sopenharmony_ci    produce the same output, assuming they were issued from the same
212bf215546Sopenharmony_ci    file and line.
213bf215546Sopenharmony_ci
214bf215546Sopenharmony_ci        assertMESA (false);
215bf215546Sopenharmony_ci        assertMESA (false, 0);
216bf215546Sopenharmony_ci        assertMESA (false, 0, __FILE__, __LINE__);
217bf215546Sopenharmony_ci
218bf215546Sopenharmony_ci    The diagnostic message examples follow.
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_ci        1 89 0 ""
221bf215546Sopenharmony_ci        1 45 333 "all (lessThanEqual (fragColor, vec4 (1.0)))"
222bf215546Sopenharmony_ci        1 66 1 "assertion failed in file 1, line 66, cookie 1"
223bf215546Sopenharmony_ci
224bf215546Sopenharmony_ciAdditions to Chapter 9 of the OpenGL Shading Language 1.10 Specification
225bf215546Sopenharmony_ci(Shading Language Grammar)
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci    None
228bf215546Sopenharmony_ci
229bf215546Sopenharmony_ciAdditions to Chapter 10 of the OpenGL Shading Language 1.10
230bf215546Sopenharmony_ciSpecification (Issues)
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_ci    None
233bf215546Sopenharmony_ci
234bf215546Sopenharmony_ciAdditions to the AGL/EGL/GLX/WGL Specifications
235bf215546Sopenharmony_ci
236bf215546Sopenharmony_ci    None
237bf215546Sopenharmony_ci
238bf215546Sopenharmony_ciGLX Protocol
239bf215546Sopenharmony_ci
240bf215546Sopenharmony_ci    None
241bf215546Sopenharmony_ci
242bf215546Sopenharmony_ciErrors
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci    TBD
245bf215546Sopenharmony_ci
246bf215546Sopenharmony_ciNew State
247bf215546Sopenharmony_ci
248bf215546Sopenharmony_ci    TBD
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ciNew Implementation Dependent State
251bf215546Sopenharmony_ci
252bf215546Sopenharmony_ci    TBD
253bf215546Sopenharmony_ci
254bf215546Sopenharmony_ciSample Code
255bf215546Sopenharmony_ci
256bf215546Sopenharmony_ci    TBD
257bf215546Sopenharmony_ci
258bf215546Sopenharmony_ciRevision History
259bf215546Sopenharmony_ci
260bf215546Sopenharmony_ci    29 May 2006
261bf215546Sopenharmony_ci        Initial draft. (Michal Krol)
262bf215546Sopenharmony_ci    30 July 2006
263bf215546Sopenharmony_ci        Add Overview, New Procedures and Functions, New Tokens sections.
264bf215546Sopenharmony_ci        Add sections 8.10.1, 8.10.2 to GLSL spec.
265