History

INtroducing the stream format and the Stream and making it work for the model mesh

Sam Gateau committed 12 years ago

Commit 23905591 parent 7b5d2ef9 files · +547 −73Browse files

Showing the changes to interface/src/gpu/GLBackend.cpp (1 of 9 files). Show all

Unified · Split

interface/src/gpu/GLBackend.cpp+301−44
@@ -18,6 +18,14 @@ using namespace gpu; · 17 unmodified lines
18 18
19GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = 19GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
20{20{
21 (&::gpu::GLBackend::do_draw),
22 (&::gpu::GLBackend::do_drawIndexed),
23 (&::gpu::GLBackend::do_drawInstanced),
24 (&::gpu::GLBackend::do_drawIndexedInstanced),
25
26 (&::gpu::GLBackend::do_setInputStream),
27 (&::gpu::GLBackend::do_setInputFormat),
28
21 (&::gpu::GLBackend::do_glEnable),29 (&::gpu::GLBackend::do_glEnable),
22 (&::gpu::GLBackend::do_glDisable),30 (&::gpu::GLBackend::do_glDisable),
23 31
@@ -70,8 +78,42 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = · 46 unmodified lines
70 (&::gpu::GLBackend::do_glMaterialfv),78 (&::gpu::GLBackend::do_glMaterialfv),
71};79};
72 80
81const GLenum GLBackend::_primitiveToGLmode[NUM_PRIMITIVES] = {
82 GL_POINTS,
83 GL_LINES,
84 GL_LINE_STRIP,
85 GL_TRIANGLES,
86 GL_TRIANGLE_STRIP,
87 GL_QUADS,
88};
73 89
74GLBackend::GLBackend() {90static const GLenum _elementTypeToGLType[Element::NUM_TYPES]= {
91 GL_FLOAT,
92 GL_INT,
93 GL_UNSIGNED_INT,
94 GL_HALF_FLOAT,
95 GL_SHORT,
96 GL_UNSIGNED_SHORT,
97 GL_BYTE,
98 GL_UNSIGNED_BYTE,
99 GL_FLOAT,
100 GL_INT,
101 GL_UNSIGNED_INT,
102 GL_HALF_FLOAT,
103 GL_SHORT,
104 GL_UNSIGNED_SHORT,
105 GL_BYTE,
106 GL_UNSIGNED_BYTE
107};
108
109
110GLBackend::GLBackend() :
111 _inputFormat(0),
112 _inputStream(0),
113 _needInputFormatUpdate(true),
114 _needInputStreamUpdate(true),
115 _inputAttributeActivation(0)
116{
75 117
76}118}
77 119
@@ -87,7 +129,7 @@ void GLBackend::renderBatch(Batch& batch) { · 9 unmodified lines
87 GLBackend backend;129 GLBackend backend;
88 130
89 for (int i = 0; i < numCommands; i++) {131 for (int i = 0; i < numCommands; i++) {
90 CommandCall call = _commandCalls[((*command) - Batch::COMMAND_glEnable)];132 CommandCall call = _commandCalls[(*command)];
91 (backend.*(call))(batch, *offset);133 (backend.*(call))(batch, *offset);
92 command++;134 command++;
93 offset++;135 offset++;
@@ -126,24 +168,239 @@ void GLBackend::checkGLError() { · 32 unmodified lines
126 }168 }
127}169}
128 170
171#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError()
172//#define CHECK_GL_ERROR()
173
174void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
175 updateInput();
176
177 Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
178 GLenum mode = _primitiveToGLmode[primitiveType];
179 uint32 numVertices = batch._params[paramOffset + 1]._uint;
180 uint32 startVertex = batch._params[paramOffset + 0]._uint;
181
182 glDrawArrays(mode, startVertex, numVertices);
183 CHECK_GL_ERROR();
184}
185
186void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) {
187 updateInput();
188
189 Primitive primitiveType = (Primitive)batch._params[paramOffset + 2]._uint;
190 GLenum mode = _primitiveToGLmode[primitiveType];
191 uint32 numIndices = batch._params[paramOffset + 1]._uint;
192 uint32 startIndex = batch._params[paramOffset + 0]._uint;
193
194 glDrawElements(mode, numIndices, GL_UNSIGNED_INT, (GLvoid*) startIndex);
195 CHECK_GL_ERROR();
196}
197
198void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
199 CHECK_GL_ERROR();
200}
201
202void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) {
203 CHECK_GL_ERROR();
204}
205
206
207void GLBackend::do_setInputStream(Batch& batch, uint32 paramOffset) {
208 const Stream* stream = reinterpret_cast<const Stream*>(batch.editResource(batch._params[paramOffset]._uint)->_pointer);
209
210 if (stream != _inputStream) {
211 _inputStream = stream;
212 _needInputStreamUpdate = true;
213 }
214}
215
216void GLBackend::do_setInputFormat(Batch& batch, uint32 paramOffset) {
217 const StreamFormat* format = reinterpret_cast<const StreamFormat*>(batch.editResource(batch._params[paramOffset]._uint)->_pointer);
218
219 if (format != _inputFormat) {
220 _inputFormat = format;
221 _needInputFormatUpdate = true;
222 }
223}
224
225#define SUPPORT_LEGACY_OPENGL
226#if defined(SUPPORT_LEGACY_OPENGL)
227static const int NUM_CLASSIC_ATTRIBS = StreamFormat::SLOT_TANGENT;
228static const GLenum attributeSlotToClassicAttribName[NUM_CLASSIC_ATTRIBS] = {
229 GL_VERTEX_ARRAY,
230 GL_NORMAL_ARRAY,
231 GL_TEXTURE_COORD_ARRAY,
232 GL_COLOR_ARRAY
233};
234#endif
235
236void GLBackend::updateInput() {
237 if (_needInputFormatUpdate || _needInputStreamUpdate) {
238
239 if (_needInputFormatUpdate) {
240 InputActivationCache newActivation;
241
242 // Check expected activation
243 if (_inputFormat) {
244 const StreamFormat::AttributeMap& attributes = _inputFormat->getAttributes();
245 for (StreamFormat::AttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
246 const StreamFormat::Attribute& attrib = (*it).second;
247 newActivation.set(attrib._slot);
248 }
249 }
250
251 // Manage Activation what was and what is expected now
252 for (int i = 0; i < newActivation.size(); i++) {
253 bool newState = newActivation[i];
254 if (newState != _inputAttributeActivation[i]) {
255#if defined(SUPPORT_LEGACY_OPENGL)
256 if (i < NUM_CLASSIC_ATTRIBS) {
257 if (newState) {
258 glEnableClientState(attributeSlotToClassicAttribName[i]);
259 }
260 else {
261 glDisableClientState(attributeSlotToClassicAttribName[i]);
262 }
263 } else {
264#else
265 {
266#endif
267 if (newState) {
268 glEnableVertexAttribArray(i);
269 } else {
270 glDisableVertexAttribArray(i);
271 }
272 }
273 CHECK_GL_ERROR();
274
275 _inputAttributeActivation.flip(i);
276 }
277 }
278 }
279
280 // now we need to bind the buffers and assign the attrib pointers
281 if (_inputStream && _inputFormat) {
282 const Stream::Buffers& buffers = _inputStream->getBuffers();
283 const Stream::Offsets& offsets = _inputStream->getOffsets();
284 const Stream::Strides& strides = _inputStream->getStrides();
285
286 const StreamFormat::AttributeMap& attributes = _inputFormat->getAttributes();
287
288 for (StreamFormat::ChannelMap::const_iterator channelIt = _inputFormat->getChannels().begin();
289 channelIt != _inputFormat->getChannels().end();
290 channelIt++) {
291 const StreamFormat::ChannelMap::value_type::second_type& channel = (*channelIt).second;
292 if ((*channelIt).first < buffers.size()) {
293 int bufferNum = (*channelIt).first;
294 GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum]));
295 glBindBuffer(GL_ARRAY_BUFFER, vbo);
296 CHECK_GL_ERROR();
297
298 for (int i = 0; i < channel._slots.size(); i++) {
299 const StreamFormat::Attribute& attrib = attributes.at(channel._slots[i]);
300 GLuint count = attrib._element.getDimensionCount();
301 GLenum type = _elementTypeToGLType[attrib._element.getType()];
302 GLuint stride = strides[bufferNum];
303 GLuint pointer = attrib._offset + offsets[bufferNum];
304#if defined(SUPPORT_LEGACY_OPENGL)
305 if (attrib._slot < NUM_CLASSIC_ATTRIBS) {
306 switch (attrib._slot) {
307 case StreamFormat::SLOT_POSITION:
308 glVertexPointer(count, type, stride, (GLvoid*)pointer);
309 break;
310 case StreamFormat::SLOT_COLOR:
311 glColorPointer(count, type, stride, (GLvoid*)pointer);
312 break;
313 case StreamFormat::SLOT_TEXCOORD:
314 glTexCoordPointer(count, type, stride, (GLvoid*)pointer);
315 break;
316 case StreamFormat::SLOT_NORMAL:
317 glNormalPointer(type, stride, (GLvoid*)pointer);
318 break;
319 };
320 } else {
321#else
322 {
323#endif
324 glVertexAttribPointer(attrib._slot, count, type, attrib._element.isNormalized(), stride, (GLvoid*)pointer);
325 }
326 CHECK_GL_ERROR();
327 }
328 }
329 }
330 }
331
332 _needInputStreamUpdate = false;
333 _needInputFormatUpdate = false;
334 }
335
336/* Fancy version GL4.4
337 if (_needInputFormatUpdate) {
338
339 InputActivationCache newActivation;
340
341 // Assign the vertex format required
342 if (_inputFormat) {
343 const StreamFormat::AttributeMap& attributes = _inputFormat->getAttributes();
344 for (StreamFormat::AttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++) {
345 const StreamFormat::Attribute& attrib = (*it).second;
346 newActivation.set(attrib._slot);
347 glVertexAttribFormat(
348 attrib._slot,
349 attrib._element.getDimensionCount(),
350 _elementTypeToGLType[attrib._element.getType()],
351 attrib._element.isNormalized(),
352 attrib._stride);
353 }
354 CHECK_GL_ERROR();
355 }
356
357 // Manage Activation what was and what is expected now
358 for (int i = 0; i < newActivation.size(); i++) {
359 bool newState = newActivation[i];
360 if (newState != _inputAttributeActivation[i]) {
361 if (newState) {
362 glEnableVertexAttribArray(i);
363 } else {
364 glDisableVertexAttribArray(i);
365 }
366 _inputAttributeActivation.flip(i);
367 }
368 }
369 CHECK_GL_ERROR();
370
371 _needInputFormatUpdate = false;
372 }
373
374 if (_needInputStreamUpdate) {
375 if (_inputStream) {
376 const Stream::Buffers& buffers = _inputStream->getBuffers();
377 const Stream::Offsets& offsets = _inputStream->getOffsets();
378 const Stream::Strides& strides = _inputStream->getStrides();
379
380 for (int i = 0; i < buffers.size(); i++) {
381 GLuint vbo = gpu::GLBackend::getBufferID((*buffers[i]));
382 glBindVertexBuffer(i, vbo, offsets[i], strides[i]);
383 }
384
385 CHECK_GL_ERROR();
386 }
387 _needInputStreamUpdate = false;
388 }
389*/
390}
129 391
130// TODO: As long as we have gl calls explicitely issued from interface392// TODO: As long as we have gl calls explicitely issued from interface
131// code, we need to be able to record and batch these calls. THe long 393// code, we need to be able to record and batch these calls. THe long
132// term strategy is to get rid of any GL calls in favor of the HIFI GPU API394// term strategy is to get rid of any GL calls in favor of the HIFI GPU API
133 395
134//#define ADD_COMMAND(call) _commands.push_back(COMMAND_##call); _commandCalls.push_back(&gpu::Batch::do_##call); _commandOffsets.push_back(_params.size());
135#define ADD_COMMAND(call) _commands.push_back(COMMAND_##call); _commandOffsets.push_back(_params.size());
136//#define ADD_COMMAND_GL(call) _commands.push_back(COMMAND_##call); _commandCalls.push_back(&gpu::GLBackend::do_##call); _commandOffsets.push_back(_params.size());
137#define ADD_COMMAND_GL(call) _commands.push_back(COMMAND_##call); _commandOffsets.push_back(_params.size());396#define ADD_COMMAND_GL(call) _commands.push_back(COMMAND_##call); _commandOffsets.push_back(_params.size());
138 397
139//#define DO_IT_NOW(call, offset) runLastCommand();398//#define DO_IT_NOW(call, offset) runLastCommand();
140#define DO_IT_NOW(call, offset) 399#define DO_IT_NOW(call, offset)
141 400
142//#define CHECK_GL_ERROR() ::gpu::backend::checkGLError()
143#define CHECK_GL_ERROR()
144 401
145void Batch::_glEnable(GLenum cap) {402void Batch::_glEnable(GLenum cap) {
146 ADD_COMMAND(glEnable);403 ADD_COMMAND_GL(glEnable);
147 404
148 _params.push_back(cap);405 _params.push_back(cap);
149 406
@@ -155,7 +412,7 @@ void GLBackend::do_glEnable(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
155}412}
156 413
157void Batch::_glDisable(GLenum cap) {414void Batch::_glDisable(GLenum cap) {
158 ADD_COMMAND(glDisable);415 ADD_COMMAND_GL(glDisable);
159 416
160 _params.push_back(cap);417 _params.push_back(cap);
161 418
@@ -167,7 +424,7 @@ void GLBackend::do_glDisable(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
167}424}
168 425
169void Batch::_glEnableClientState(GLenum array) {426void Batch::_glEnableClientState(GLenum array) {
170 ADD_COMMAND(glEnableClientState);427 ADD_COMMAND_GL(glEnableClientState);
171 428
172 _params.push_back(array);429 _params.push_back(array);
173 430
@@ -179,7 +436,7 @@ void GLBackend::do_glEnableClientState(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
179}436}
180 437
181void Batch::_glDisableClientState(GLenum array) {438void Batch::_glDisableClientState(GLenum array) {
182 ADD_COMMAND(glDisableClientState);439 ADD_COMMAND_GL(glDisableClientState);
183 440
184 _params.push_back(array);441 _params.push_back(array);
185 442
@@ -191,7 +448,7 @@ void GLBackend::do_glDisableClientState(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
191}448}
192 449
193void Batch::_glCullFace(GLenum mode) {450void Batch::_glCullFace(GLenum mode) {
194 ADD_COMMAND(glCullFace);451 ADD_COMMAND_GL(glCullFace);
195 452
196 _params.push_back(mode);453 _params.push_back(mode);
197 454
@@ -203,7 +460,7 @@ void GLBackend::do_glCullFace(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
203}460}
204 461
205void Batch::_glAlphaFunc(GLenum func, GLclampf ref) {462void Batch::_glAlphaFunc(GLenum func, GLclampf ref) {
206 ADD_COMMAND(glAlphaFunc);463 ADD_COMMAND_GL(glAlphaFunc);
207 464
208 _params.push_back(ref);465 _params.push_back(ref);
209 _params.push_back(func);466 _params.push_back(func);
@@ -218,7 +475,7 @@ void GLBackend::do_glAlphaFunc(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
218}475}
219 476
220void Batch::_glDepthFunc(GLenum func) {477void Batch::_glDepthFunc(GLenum func) {
221 ADD_COMMAND(glDepthFunc);478 ADD_COMMAND_GL(glDepthFunc);
222 479
223 _params.push_back(func);480 _params.push_back(func);
224 481
@@ -230,7 +487,7 @@ void GLBackend::do_glDepthFunc(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
230}487}
231 488
232void Batch::_glDepthMask(GLboolean flag) {489void Batch::_glDepthMask(GLboolean flag) {
233 ADD_COMMAND(glDepthMask);490 ADD_COMMAND_GL(glDepthMask);
234 491
235 _params.push_back(flag);492 _params.push_back(flag);
236 493
@@ -242,7 +499,7 @@ void GLBackend::do_glDepthMask(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
242}499}
243 500
244void Batch::_glDepthRange(GLclampd zNear, GLclampd zFar) {501void Batch::_glDepthRange(GLclampd zNear, GLclampd zFar) {
245 ADD_COMMAND(glDepthRange);502 ADD_COMMAND_GL(glDepthRange);
246 503
247 _params.push_back(zFar);504 _params.push_back(zFar);
248 _params.push_back(zNear);505 _params.push_back(zNear);
@@ -257,7 +514,7 @@ void GLBackend::do_glDepthRange(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
257}514}
258 515
259void Batch::_glBindBuffer(GLenum target, GLuint buffer) {516void Batch::_glBindBuffer(GLenum target, GLuint buffer) {
260 ADD_COMMAND(glBindBuffer);517 ADD_COMMAND_GL(glBindBuffer);
261 518
262 _params.push_back(buffer);519 _params.push_back(buffer);
263 _params.push_back(target);520 _params.push_back(target);
@@ -272,7 +529,7 @@ void GLBackend::do_glBindBuffer(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
272}529}
273 530
274void Batch::_glBindTexture(GLenum target, GLuint texture) {531void Batch::_glBindTexture(GLenum target, GLuint texture) {
275 ADD_COMMAND(glBindTexture);532 ADD_COMMAND_GL(glBindTexture);
276 533
277 _params.push_back(texture);534 _params.push_back(texture);
278 _params.push_back(target);535 _params.push_back(target);
@@ -287,7 +544,7 @@ void GLBackend::do_glBindTexture(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
287}544}
288 545
289void Batch::_glActiveTexture(GLenum texture) {546void Batch::_glActiveTexture(GLenum texture) {
290 ADD_COMMAND(glActiveTexture);547 ADD_COMMAND_GL(glActiveTexture);
291 548
292 _params.push_back(texture);549 _params.push_back(texture);
293 550
@@ -299,7 +556,7 @@ void GLBackend::do_glActiveTexture(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
299}556}
300 557
301void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) {558void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) {
302 ADD_COMMAND(glDrawBuffers);559 ADD_COMMAND_GL(glDrawBuffers);
303 560
304 _params.push_back(cacheData(n * sizeof(GLenum), bufs));561 _params.push_back(cacheData(n * sizeof(GLenum), bufs));
305 _params.push_back(n);562 _params.push_back(n);
@@ -314,7 +571,7 @@ void GLBackend::do_glDrawBuffers(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
314}571}
315 572
316void Batch::_glUseProgram(GLuint program) {573void Batch::_glUseProgram(GLuint program) {
317 ADD_COMMAND(glUseProgram);574 ADD_COMMAND_GL(glUseProgram);
318 575
319 _params.push_back(program);576 _params.push_back(program);
320 577
@@ -326,7 +583,7 @@ void GLBackend::do_glUseProgram(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
326}583}
327 584
328void Batch::_glUniform1f(GLint location, GLfloat v0) {585void Batch::_glUniform1f(GLint location, GLfloat v0) {
329 ADD_COMMAND(glUniform1f);586 ADD_COMMAND_GL(glUniform1f);
330 587
331 _params.push_back(v0);588 _params.push_back(v0);
332 _params.push_back(location);589 _params.push_back(location);
@@ -341,7 +598,7 @@ void GLBackend::do_glUniform1f(Batch& batch, uint32 paramOffset) { · 8 unmodified lines
341}598}
342 599
343void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {600void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) {
344 ADD_COMMAND(glUniformMatrix4fv);601 ADD_COMMAND_GL(glUniformMatrix4fv);
345 602
346 const int MATRIX4_SIZE = 16 * sizeof(float);603 const int MATRIX4_SIZE = 16 * sizeof(float);
347 _params.push_back(cacheData(count * MATRIX4_SIZE, value));604 _params.push_back(cacheData(count * MATRIX4_SIZE, value));
@@ -361,7 +618,7 @@ void GLBackend::do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset) { · 13 unmodified lines
361}618}
362 619
363void Batch::_glMatrixMode(GLenum mode) {620void Batch::_glMatrixMode(GLenum mode) {
364 ADD_COMMAND(glMatrixMode);621 ADD_COMMAND_GL(glMatrixMode);
365 622
366 _params.push_back(mode);623 _params.push_back(mode);
367 624
@@ -373,7 +630,7 @@ void GLBackend::do_glMatrixMode(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
373}630}
374 631
375void Batch::_glPushMatrix() {632void Batch::_glPushMatrix() {
376 ADD_COMMAND(glPushMatrix);633 ADD_COMMAND_GL(glPushMatrix);
377 634
378 DO_IT_NOW(_glPushMatrix, 0);635 DO_IT_NOW(_glPushMatrix, 0);
379}636}
@@ -383,7 +640,7 @@ void GLBackend::do_glPushMatrix(Batch& batch, uint32 paramOffset) { · 3 unmodified lines
383}640}
384 641
385void Batch::_glPopMatrix() {642void Batch::_glPopMatrix() {
386 ADD_COMMAND(glPopMatrix);643 ADD_COMMAND_GL(glPopMatrix);
387 644
388 DO_IT_NOW(_glPopMatrix, 0);645 DO_IT_NOW(_glPopMatrix, 0);
389}646}
@@ -393,7 +650,7 @@ void GLBackend::do_glPopMatrix(Batch& batch, uint32 paramOffset) { · 3 unmodified lines
393}650}
394 651
395void Batch::_glMultMatrixf(const GLfloat *m) {652void Batch::_glMultMatrixf(const GLfloat *m) {
396 ADD_COMMAND(glMultMatrixf);653 ADD_COMMAND_GL(glMultMatrixf);
397 654
398 const int MATRIX4_SIZE = 16 * sizeof(float);655 const int MATRIX4_SIZE = 16 * sizeof(float);
399 _params.push_back(cacheData(MATRIX4_SIZE, m));656 _params.push_back(cacheData(MATRIX4_SIZE, m));
@@ -406,7 +663,7 @@ void GLBackend::do_glMultMatrixf(Batch& batch, uint32 paramOffset) { · 6 unmodified lines
406}663}
407 664
408void Batch::_glLoadMatrixf(const GLfloat *m) {665void Batch::_glLoadMatrixf(const GLfloat *m) {
409 ADD_COMMAND(glLoadMatrixf);666 ADD_COMMAND_GL(glLoadMatrixf);
410 667
411 const int MATRIX4_SIZE = 16 * sizeof(float);668 const int MATRIX4_SIZE = 16 * sizeof(float);
412 _params.push_back(cacheData(MATRIX4_SIZE, m));669 _params.push_back(cacheData(MATRIX4_SIZE, m));
@@ -419,7 +676,7 @@ void GLBackend::do_glLoadMatrixf(Batch& batch, uint32 paramOffset) { · 6 unmodified lines
419}676}
420 677
421void Batch::_glLoadIdentity(void) {678void Batch::_glLoadIdentity(void) {
422 ADD_COMMAND(glLoadIdentity);679 ADD_COMMAND_GL(glLoadIdentity);
423 680
424 DO_IT_NOW(_glLoadIdentity, 0);681 DO_IT_NOW(_glLoadIdentity, 0);
425}682}
@@ -429,7 +686,7 @@ void GLBackend::do_glLoadIdentity(Batch& batch, uint32 paramOffset) { · 3 unmodified lines
429}686}
430 687
431void Batch::_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {688void Batch::_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) {
432 ADD_COMMAND(glRotatef);689 ADD_COMMAND_GL(glRotatef);
433 690
434 _params.push_back(z);691 _params.push_back(z);
435 _params.push_back(y);692 _params.push_back(y);
@@ -448,7 +705,7 @@ void GLBackend::do_glRotatef(Batch& batch, uint32 paramOffset) { · 12 unmodified lines
448}705}
449 706
450void Batch::_glScalef(GLfloat x, GLfloat y, GLfloat z) {707void Batch::_glScalef(GLfloat x, GLfloat y, GLfloat z) {
451 ADD_COMMAND(glScalef);708 ADD_COMMAND_GL(glScalef);
452 709
453 _params.push_back(z);710 _params.push_back(z);
454 _params.push_back(y);711 _params.push_back(y);
@@ -465,7 +722,7 @@ void GLBackend::do_glScalef(Batch& batch, uint32 paramOffset) { · 10 unmodified lines
465}722}
466 723
467void Batch::_glTranslatef(GLfloat x, GLfloat y, GLfloat z) {724void Batch::_glTranslatef(GLfloat x, GLfloat y, GLfloat z) {
468 ADD_COMMAND(glTranslatef);725 ADD_COMMAND_GL(glTranslatef);
469 726
470 _params.push_back(z);727 _params.push_back(z);
471 _params.push_back(y);728 _params.push_back(y);
@@ -482,7 +739,7 @@ void GLBackend::do_glTranslatef(Batch& batch, uint32 paramOffset) { · 10 unmodified lines
482}739}
483 740
484void Batch::_glDrawArrays(GLenum mode, GLint first, GLsizei count) {741void Batch::_glDrawArrays(GLenum mode, GLint first, GLsizei count) {
485 ADD_COMMAND(glDrawArrays);742 ADD_COMMAND_GL(glDrawArrays);
486 743
487 _params.push_back(count);744 _params.push_back(count);
488 _params.push_back(first);745 _params.push_back(first);
@@ -499,7 +756,7 @@ void GLBackend::do_glDrawArrays(Batch& batch, uint32 paramOffset) { · 10 unmodified lines
499}756}
500 757
501void Batch::_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices) {758void Batch::_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices) {
502 ADD_COMMAND(glDrawRangeElements);759 ADD_COMMAND_GL(glDrawRangeElements);
503 760
504 _params.push_back(cacheResource(indices));761 _params.push_back(cacheResource(indices));
505 _params.push_back(type);762 _params.push_back(type);
@@ -522,7 +779,7 @@ void GLBackend::do_glDrawRangeElements(Batch& batch, uint32 paramOffset) { · 16 unmodified lines
522}779}
523 780
524void Batch::_glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {781void Batch::_glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
525 ADD_COMMAND(glColorPointer);782 ADD_COMMAND_GL(glColorPointer);
526 783
527 _params.push_back(cacheResource(pointer));784 _params.push_back(cacheResource(pointer));
528 _params.push_back(stride);785 _params.push_back(stride);
@@ -541,7 +798,7 @@ void GLBackend::do_glColorPointer(Batch& batch, uint32 paramOffset) { · 12 unmodified lines
541}798}
542 799
543void Batch::_glNormalPointer(GLenum type, GLsizei stride, const void *pointer) {800void Batch::_glNormalPointer(GLenum type, GLsizei stride, const void *pointer) {
544 ADD_COMMAND(glNormalPointer);801 ADD_COMMAND_GL(glNormalPointer);
545 802
546 _params.push_back(cacheResource(pointer));803 _params.push_back(cacheResource(pointer));
547 _params.push_back(stride);804 _params.push_back(stride);
@@ -558,7 +815,7 @@ void GLBackend::do_glNormalPointer(Batch& batch, uint32 paramOffset) { · 10 unmodified lines
558}815}
559 816
560void Batch::_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {817void Batch::_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
561 ADD_COMMAND(glTexCoordPointer);818 ADD_COMMAND_GL(glTexCoordPointer);
562 819
563 _params.push_back(cacheResource(pointer));820 _params.push_back(cacheResource(pointer));
564 _params.push_back(stride);821 _params.push_back(stride);
@@ -577,7 +834,7 @@ void GLBackend::do_glTexCoordPointer(Batch& batch, uint32 paramOffset) { · 12 unmodified lines
577}834}
578 835
579void Batch::_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {836void Batch::_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) {
580 ADD_COMMAND(glVertexPointer);837 ADD_COMMAND_GL(glVertexPointer);
581 838
582 _params.push_back(cacheResource(pointer));839 _params.push_back(cacheResource(pointer));
583 _params.push_back(stride);840 _params.push_back(stride);
@@ -597,7 +854,7 @@ void GLBackend::do_glVertexPointer(Batch& batch, uint32 paramOffset) { · 13 unmodified lines
597 854
598 855
599void Batch::_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) {856void Batch::_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) {
600 ADD_COMMAND(glVertexAttribPointer);857 ADD_COMMAND_GL(glVertexAttribPointer);
601 858
602 _params.push_back(cacheResource(pointer));859 _params.push_back(cacheResource(pointer));
603 _params.push_back(stride);860 _params.push_back(stride);
@@ -620,7 +877,7 @@ void GLBackend::do_glVertexAttribPointer(Batch& batch, uint32 paramOffset) { · 16 unmodified lines
620}877}
621 878
622void Batch::_glEnableVertexAttribArray(GLint location) {879void Batch::_glEnableVertexAttribArray(GLint location) {
623 ADD_COMMAND(glEnableVertexAttribArray);880 ADD_COMMAND_GL(glEnableVertexAttribArray);
624 881
625 _params.push_back(location);882 _params.push_back(location);
626 883
@@ -632,7 +889,7 @@ void GLBackend::do_glEnableVertexAttribArray(Batch& batch, uint32 paramOffset) { · 5 unmodified lines
632}889}
633 890
634void Batch::_glDisableVertexAttribArray(GLint location) {891void Batch::_glDisableVertexAttribArray(GLint location) {
635 ADD_COMMAND(glDisableVertexAttribArray);892 ADD_COMMAND_GL(glDisableVertexAttribArray);
636 893
637 _params.push_back(location);894 _params.push_back(location);
638 895
@@ -644,7 +901,7 @@ void GLBackend::do_glDisableVertexAttribArray(Batch& batch, uint32 paramOffset) · 5 unmodified lines
644}901}
645 902
646void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {903void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
647 ADD_COMMAND(glColor4f);904 ADD_COMMAND_GL(glColor4f);
648 905
649 _params.push_back(alpha);906 _params.push_back(alpha);
650 _params.push_back(blue);907 _params.push_back(blue);
@@ -663,7 +920,7 @@ void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) { · 12 unmodified lines
663}920}
664 921
665void Batch::_glMaterialf(GLenum face, GLenum pname, GLfloat param) {922void Batch::_glMaterialf(GLenum face, GLenum pname, GLfloat param) {
666 ADD_COMMAND(glMaterialf);923 ADD_COMMAND_GL(glMaterialf);
667 924
668 _params.push_back(param);925 _params.push_back(param);
669 _params.push_back(pname);926 _params.push_back(pname);
@@ -680,7 +937,7 @@ void GLBackend::do_glMaterialf(Batch& batch, uint32 paramOffset) { · 10 unmodified lines
680}937}
681 938
682void Batch::_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) {939void Batch::_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) {
683 ADD_COMMAND(glMaterialfv);940 ADD_COMMAND_GL(glMaterialfv);
684 941
685 _params.push_back(cacheData(4 * sizeof(float), params));942 _params.push_back(cacheData(4 * sizeof(float), params));
686 _params.push_back(pname);943 _params.push_back(pname);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t