Showing the changes to interface/src/gpu/Batch.cpp (1 of 3 files). Show all
Unified · Split
| @@ -12,14 +12,21 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include <QDebug> | 13 | #include <QDebug> |
| 14 | 14 | ||
| 15 | #define DO_IT_NOW(call, offset) int param = _params.size() - (offset); do##call(param); | 15 | #define ADD_COMMAND(call) _commands.push_back(COMMAND_##call); _commandCalls.push_back(&gpu::Batch::do_##call); _commandOffsets.push_back(_params.size()); |
| 16 | |||
| 17 | //#define DO_IT_NOW(call, offset) uint32 __param = _params.size() - (offset); do##call(__param); | ||
| 18 | //#define DO_IT_NOW(call, offset) uint32 __param = _commandOffsets.back(); CommandCall call = _commandCalls.back(); (this->*(call))(__param); | ||
| 19 | //#define DO_IT_NOW(call, offset) runLastCommand(); | ||
| 20 | //#define DO_IT_NOW(call, offset) uint32 __param = _params.size() - (offset); runCommand(_commands.size() -1);// do##call(__param); | ||
| 21 | #define DO_IT_NOW(call, offset) | ||
| 16 | 22 | ||
| 17 | using namespace gpu; | 23 | using namespace gpu; |
| 18 | 24 | ||
| 19 | Batch::Batch() : | 25 | Batch::Batch() : |
| 20 | _commands(), | 26 | _commands(), |
| 21 | _params(), | 27 | _params(), |
| 22 | _resources(){ | 28 | _resources(), |
| 29 | _data(){ | ||
| 23 | } | 30 | } |
| 24 | 31 | ||
| 25 | Batch::~Batch() { | 32 | Batch::~Batch() { |
| @@ -29,24 +36,99 @@ void Batch::clear() { · 3 unmodified lines | |||
| 29 | _commands.clear(); | 36 | _commands.clear(); |
| 30 | _params.clear(); | 37 | _params.clear(); |
| 31 | _resources.clear(); | 38 | _resources.clear(); |
| 39 | _data.clear(); | ||
| 40 | } | ||
| 41 | |||
| 42 | uint32 Batch::cacheResource(Resource* res) { | ||
| 43 | uint32 offset = _resources.size(); | ||
| 44 | _resources.push_back(ResourceCache(res)); | ||
| 45 | |||
| 46 | return offset; | ||
| 47 | } | ||
| 48 | |||
| 49 | uint32 Batch::cacheResource(const void* pointer) { | ||
| 50 | uint32 offset = _resources.size(); | ||
| 51 | _resources.push_back(ResourceCache(pointer)); | ||
| 52 | |||
| 53 | return offset; | ||
| 54 | } | ||
| 55 | |||
| 56 | uint32 Batch::cacheData(uint32 size, const void* data) { | ||
| 57 | uint32 offset = _data.size(); | ||
| 58 | uint32 nbBytes = size; | ||
| 59 | _data.resize(offset + nbBytes); | ||
| 60 | memcpy(_data.data() + offset, data, size); | ||
| 61 | |||
| 62 | return offset; | ||
| 63 | } | ||
| 64 | |||
| 65 | #define CASE_COMMAND(call) case COMMAND_##call: { do_##call(offset); } break; | ||
| 66 | |||
| 67 | void Batch::runCommand(Command com, uint32 offset) { | ||
| 68 | switch (com) { | ||
| 69 | CASE_COMMAND(draw); | ||
| 70 | CASE_COMMAND(drawIndexed); | ||
| 71 | CASE_COMMAND(drawInstanced); | ||
| 72 | CASE_COMMAND(drawIndexedInstanced); | ||
| 73 | CASE_COMMAND(glEnable); | ||
| 74 | CASE_COMMAND(glDisable); | ||
| 75 | CASE_COMMAND(glEnableClientState); | ||
| 76 | CASE_COMMAND(glDisableClientState); | ||
| 77 | CASE_COMMAND(glCullFace); | ||
| 78 | CASE_COMMAND(glAlphaFunc); | ||
| 79 | CASE_COMMAND(glDepthFunc); | ||
| 80 | CASE_COMMAND(glDepthMask); | ||
| 81 | CASE_COMMAND(glDepthRange); | ||
| 82 | CASE_COMMAND(glBindBuffer); | ||
| 83 | CASE_COMMAND(glBindTexture); | ||
| 84 | CASE_COMMAND(glActiveTexture); | ||
| 85 | CASE_COMMAND(glDrawBuffers); | ||
| 86 | CASE_COMMAND(glUseProgram); | ||
| 87 | CASE_COMMAND(glUniform1f); | ||
| 88 | CASE_COMMAND(glUniformMatrix4fv); | ||
| 89 | CASE_COMMAND(glMatrixMode); | ||
| 90 | CASE_COMMAND(glPushMatrix); | ||
| 91 | CASE_COMMAND(glPopMatrix); | ||
| 92 | CASE_COMMAND(glMultMatrixf); | ||
| 93 | CASE_COMMAND(glLoadMatrixf); | ||
| 94 | CASE_COMMAND(glLoadIdentity); | ||
| 95 | CASE_COMMAND(glRotatef); | ||
| 96 | CASE_COMMAND(glScalef); | ||
| 97 | CASE_COMMAND(glTranslatef); | ||
| 98 | CASE_COMMAND(glDrawArrays); | ||
| 99 | CASE_COMMAND(glDrawRangeElements); | ||
| 100 | CASE_COMMAND(glColorPointer); | ||
| 101 | CASE_COMMAND(glNormalPointer); | ||
| 102 | CASE_COMMAND(glTexCoordPointer); | ||
| 103 | CASE_COMMAND(glVertexPointer); | ||
| 104 | CASE_COMMAND(glVertexAttribPointer); | ||
| 105 | CASE_COMMAND(glEnableVertexAttribArray); | ||
| 106 | CASE_COMMAND(glDisableVertexAttribArray); | ||
| 107 | CASE_COMMAND(glColor4f); | ||
| 108 | CASE_COMMAND(glMaterialf); | ||
| 109 | CASE_COMMAND(glMaterialfv); | ||
| 110 | } | ||
| 32 | } | 111 | } |
| 33 | 112 | ||
| 34 | void Batch::draw( Primitive primitiveType, int nbVertices, int startVertex) { | 113 | void Batch::draw( Primitive primitiveType, int nbVertices, int startVertex) { |
| 35 | _commands.push_back(COMMAND_DRAW); | 114 | ADD_COMMAND(draw); |
| 115 | |||
| 36 | _params.push_back(startVertex); | 116 | _params.push_back(startVertex); |
| 37 | _params.push_back(nbVertices); | 117 | _params.push_back(nbVertices); |
| 38 | _params.push_back(primitiveType); | 118 | _params.push_back(primitiveType); |
| 39 | } | 119 | } |
| 40 | 120 | ||
| 41 | void Batch::drawIndexed( Primitive primitiveType, int nbIndices, int startIndex) { | 121 | void Batch::drawIndexed( Primitive primitiveType, int nbIndices, int startIndex) { |
| 42 | _commands.push_back(COMMAND_DRAW_INDEXED); | 122 | ADD_COMMAND(drawIndexed); |
| 123 | |||
| 43 | _params.push_back(startIndex); | 124 | _params.push_back(startIndex); |
| 44 | _params.push_back(nbIndices); | 125 | _params.push_back(nbIndices); |
| 45 | _params.push_back(primitiveType); | 126 | _params.push_back(primitiveType); |
| 46 | } | 127 | } |
| 47 | 128 | ||
| 48 | void Batch::drawInstanced( uint32 nbInstances, Primitive primitiveType, int nbVertices, int startVertex, int startInstance) { | 129 | void Batch::drawInstanced( uint32 nbInstances, Primitive primitiveType, int nbVertices, int startVertex, int startInstance) { |
| 49 | _commands.push_back(COMMAND_DRAW_INSTANCED); | 130 | ADD_COMMAND(drawInstanced); |
| 131 | |||
| 50 | _params.push_back(startInstance); | 132 | _params.push_back(startInstance); |
| 51 | _params.push_back(startVertex); | 133 | _params.push_back(startVertex); |
| 52 | _params.push_back(nbVertices); | 134 | _params.push_back(nbVertices); |
| @@ -55,7 +137,8 @@ void Batch::drawInstanced( uint32 nbInstances, Primitive primitiveType, int nbVe · 2 unmodified lines | |||
| 55 | } | 137 | } |
| 56 | 138 | ||
| 57 | void Batch::drawIndexedInstanced( uint32 nbInstances, Primitive primitiveType, int nbIndices, int startIndex, int startInstance) { | 139 | void Batch::drawIndexedInstanced( uint32 nbInstances, Primitive primitiveType, int nbIndices, int startIndex, int startInstance) { |
| 58 | _commands.push_back(COMMAND_DRAW_INDEXED_INSTANCED); | 140 | ADD_COMMAND(drawIndexedInstanced); |
| 141 | |||
| 59 | _params.push_back(startInstance); | 142 | _params.push_back(startInstance); |
| 60 | _params.push_back(startIndex); | 143 | _params.push_back(startIndex); |
| 61 | _params.push_back(nbIndices); | 144 | _params.push_back(nbIndices); |
| @@ -67,402 +150,474 @@ void Batch::drawIndexedInstanced( uint32 nbInstances, Primitive primitiveType, i · 5 unmodified lines | |||
| 67 | // code, we need to be able to record and batch these calls. THe long | 150 | // code, we need to be able to record and batch these calls. THe long |
| 68 | // term strategy is to get rid of any GL calls in favor of the HIFI GPU API | 151 | // term strategy is to get rid of any GL calls in favor of the HIFI GPU API |
| 69 | 152 | ||
| 70 | void Batch::_glEnable(GLenum cap) { | 153 | void Batch::_glEnable(GLenum cap) { |
| 71 | _commands.push_back(COMMAND_glEnable); | 154 | ADD_COMMAND(glEnable); |
| 72 | _params.push_back(cap); | 155 | |
| 73 | 156 | _params.push_back(cap); | |
| 74 | DO_IT_NOW(_glEnable, 1); | 157 | |
| 75 | } | 158 | DO_IT_NOW(_glEnable, 1); |
| 76 | void Batch::do_glEnable(int ¶mOffset) { | 159 | } |
| 160 | void Batch::do_glEnable(uint32& paramOffset) { | ||
| 77 | glEnable(_params[paramOffset++]._uint); | 161 | glEnable(_params[paramOffset++]._uint); |
| 78 | } | 162 | } |
| 79 | 163 | ||
| 80 | void Batch::_glDisable(GLenum cap) { | 164 | void Batch::_glDisable(GLenum cap) { |
| 81 | _commands.push_back(COMMAND_glDisable); | 165 | ADD_COMMAND(glDisable); |
| 82 | _params.push_back(cap); | 166 | |
| 83 | 167 | _params.push_back(cap); | |
| 84 | DO_IT_NOW(_glDisable, 1); | 168 | |
| 85 | } | 169 | DO_IT_NOW(_glDisable, 1); |
| 86 | void Batch::do_glDisable(int ¶mOffset) { | 170 | } |
| 171 | void Batch::do_glDisable(uint32& paramOffset) { | ||
| 87 | glDisable(_params[paramOffset++]._uint); | 172 | glDisable(_params[paramOffset++]._uint); |
| 88 | } | 173 | } |
| 89 | 174 | ||
| 90 | void Batch::_glEnableClientState(GLenum array) { | 175 | void Batch::_glEnableClientState(GLenum array) { |
| 91 | _commands.push_back(COMMAND_glEnableClientState); | 176 | ADD_COMMAND(glEnableClientState); |
| 92 | _params.push_back(array); | 177 | |
| 93 | 178 | _params.push_back(array); | |
| 94 | DO_IT_NOW(_glEnableClientState, 1 ); | 179 | |
| 95 | } | 180 | DO_IT_NOW(_glEnableClientState, 1 ); |
| 96 | void Batch::do_glEnableClientState(int ¶mOffset) { | 181 | } |
| 182 | void Batch::do_glEnableClientState(uint32& paramOffset) { | ||
| 97 | glEnableClientState(_params[paramOffset++]._uint); | 183 | glEnableClientState(_params[paramOffset++]._uint); |
| 98 | } | 184 | } |
| 185 | |||
| 186 | void Batch::_glDisableClientState(GLenum array) { | ||
| 187 | ADD_COMMAND(glDisableClientState); | ||
| 188 | |||
| 189 | _params.push_back(array); | ||
| 99 | 190 | ||
| 100 | void Batch::_glDisableClientState(GLenum array) { | 191 | DO_IT_NOW(_glDisableClientState, 1); |
| 101 | _commands.push_back(COMMAND_glDisableClientState); | ||
| 102 | _params.push_back(array); | ||
| 103 | |||
| 104 | DO_IT_NOW(_glDisableClientState, 1); | ||
| 105 | } | 192 | } |
| 106 | void Batch::do_glDisableClientState(int ¶mOffset) { | 193 | void Batch::do_glDisableClientState(uint32& paramOffset) { |
| 107 | glDisableClientState(_params[paramOffset++]._uint); | 194 | glDisableClientState(_params[paramOffset++]._uint); |
| 108 | } | 195 | } |
| 109 | 196 | ||
| 110 | void Batch::_glCullFace(GLenum mode) { | 197 | void Batch::_glCullFace(GLenum mode) { |
| 111 | _commands.push_back(COMMAND_glCullFace); | 198 | ADD_COMMAND(glCullFace); |
| 112 | _params.push_back(mode); | 199 | |
| 113 | 200 | _params.push_back(mode); | |
| 114 | DO_IT_NOW(_glCullFace, 1); | 201 | |
| 202 | DO_IT_NOW(_glCullFace, 1); | ||
| 115 | } | 203 | } |
| 116 | void Batch::do_glCullFace(int ¶mOffset) { | 204 | void Batch::do_glCullFace(uint32& paramOffset) { |
| 117 | glCullFace(_params[paramOffset++]._uint); | 205 | glCullFace(_params[paramOffset++]._uint); |
| 118 | } | 206 | } |
| 119 | 207 | ||
| 120 | void Batch::_glAlphaFunc(GLenum func, GLclampf ref) { | 208 | void Batch::_glAlphaFunc(GLenum func, GLclampf ref) { |
| 121 | _commands.push_back(COMMAND_glAlphaFunc); | 209 | ADD_COMMAND(glAlphaFunc); |
| 122 | _params.push_back(ref); | 210 | |
| 123 | _params.push_back(func); | 211 | _params.push_back(ref); |
| 124 | 212 | _params.push_back(func); | |
| 125 | DO_IT_NOW(_glAlphaFunc, 1); | 213 | |
| 214 | DO_IT_NOW(_glAlphaFunc, 2); | ||
| 126 | } | 215 | } |
| 127 | void Batch::do_glAlphaFunc(int ¶mOffset) { | 216 | void Batch::do_glAlphaFunc(uint32& paramOffset) { |
| 128 | glAlphaFunc(_params[paramOffset++]._uint, _params[paramOffset++]._float); | 217 | glAlphaFunc(_params[paramOffset++]._uint, _params[paramOffset++]._float); |
| 129 | } | 218 | } |
| 130 | 219 | ||
| 131 | void Batch::_glDepthFunc(GLenum func) { | 220 | void Batch::_glDepthFunc(GLenum func) { |
| 132 | _commands.push_back(COMMAND_glDepthFunc); | 221 | ADD_COMMAND(glDepthFunc); |
| 133 | _params.push_back(func); | 222 | |
| 134 | 223 | _params.push_back(func); | |
| 135 | DO_IT_NOW(_glDepthFunc, 1); | 224 | |
| 136 | } | 225 | DO_IT_NOW(_glDepthFunc, 1); |
| 137 | void Batch::do_glDepthFunc(int ¶mOffset) { | 226 | } |
| 227 | void Batch::do_glDepthFunc(uint32& paramOffset) { | ||
| 138 | glDepthFunc(_params[paramOffset++]._uint); | 228 | glDepthFunc(_params[paramOffset++]._uint); |
| 139 | } | 229 | } |
| 140 | 230 | ||
| 141 | void Batch::_glDepthMask(GLboolean flag) { | 231 | void Batch::_glDepthMask(GLboolean flag) { |
| 142 | _commands.push_back(COMMAND_glDepthMask); | 232 | ADD_COMMAND(glDepthMask); |
| 143 | _params.push_back(flag); | 233 | |
| 144 | 234 | _params.push_back(flag); | |
| 145 | DO_IT_NOW(_glDepthMask, 1); | 235 | |
| 146 | } | 236 | DO_IT_NOW(_glDepthMask, 1); |
| 147 | void Batch::do_glDepthMask(int ¶mOffset) { | 237 | } |
| 238 | void Batch::do_glDepthMask(uint32& paramOffset) { | ||
| 148 | glDepthMask(_params[paramOffset++]._uint); | 239 | glDepthMask(_params[paramOffset++]._uint); |
| 149 | } | 240 | } |
| 150 | 241 | ||
| 151 | void Batch::_glDepthRange(GLclampd zNear, GLclampd zFar) { | 242 | void Batch::_glDepthRange(GLclampd zNear, GLclampd zFar) { |
| 152 | _commands.push_back(COMMAND_glDepthRange); | 243 | ADD_COMMAND(glDepthRange); |
| 153 | _params.push_back(zFar); | 244 | |
| 154 | _params.push_back(zNear); | 245 | _params.push_back(zFar); |
| 155 | 246 | _params.push_back(zNear); | |
| 156 | DO_IT_NOW(_glDepthRange, 2); | 247 | |
| 157 | } | 248 | DO_IT_NOW(_glDepthRange, 2); |
| 158 | void Batch::do_glDepthRange(int ¶mOffset) { | 249 | } |
| 250 | void Batch::do_glDepthRange(uint32& paramOffset) { | ||
| 159 | glDepthRange(_params[paramOffset++]._double, _params[paramOffset++]._double); | 251 | glDepthRange(_params[paramOffset++]._double, _params[paramOffset++]._double); |
| 160 | } | 252 | } |
| 161 | 253 | ||
| 162 | void Batch::_glBindBuffer(GLenum target, GLuint buffer) { | 254 | void Batch::_glBindBuffer(GLenum target, GLuint buffer) { |
| 163 | _commands.push_back(COMMAND_glBindBuffer); | 255 | ADD_COMMAND(glBindBuffer); |
| 164 | _params.push_back(buffer); | 256 | |
| 165 | _params.push_back(target); | 257 | _params.push_back(buffer); |
| 166 | 258 | _params.push_back(target); | |
| 167 | DO_IT_NOW(_glBindBuffer, 2); | 259 | |
| 168 | } | 260 | DO_IT_NOW(_glBindBuffer, 2); |
| 169 | void Batch::do_glBindBuffer(int ¶mOffset) { | 261 | } |
| 262 | void Batch::do_glBindBuffer(uint32& paramOffset) { | ||
| 170 | glBindBuffer(_params[paramOffset++]._uint, _params[paramOffset++]._uint); | 263 | glBindBuffer(_params[paramOffset++]._uint, _params[paramOffset++]._uint); |
| 171 | } | 264 | } |
| 172 | 265 | ||
| 173 | void Batch::_glBindTexture(GLenum target, GLuint texture) { | 266 | void Batch::_glBindTexture(GLenum target, GLuint texture) { |
| 174 | _commands.push_back(COMMAND_glBindTexture); | 267 | ADD_COMMAND(glBindTexture); |
| 175 | _params.push_back(texture); | 268 | |
| 176 | _params.push_back(target); | 269 | _params.push_back(texture); |
| 177 | 270 | _params.push_back(target); | |
| 178 | DO_IT_NOW(_glBindTexture, 2); | 271 | |
| 179 | } | 272 | DO_IT_NOW(_glBindTexture, 2); |
| 180 | void Batch::do_glBindTexture(int ¶mOffset) { | 273 | } |
| 274 | void Batch::do_glBindTexture(uint32& paramOffset) { | ||
| 181 | glBindTexture(_params[paramOffset++]._uint, _params[paramOffset++]._uint); | 275 | glBindTexture(_params[paramOffset++]._uint, _params[paramOffset++]._uint); |
| 182 | } | 276 | } |
| 183 | 277 | ||
| 184 | void Batch::_glActiveTexture(GLenum texture) { | 278 | void Batch::_glActiveTexture(GLenum texture) { |
| 185 | _commands.push_back(COMMAND_glActiveTexture); | 279 | ADD_COMMAND(glActiveTexture); |
| 186 | _params.push_back(texture); | 280 | |
| 187 | 281 | _params.push_back(texture); | |
| 188 | DO_IT_NOW(_glActiveTexture, 1); | 282 | |
| 189 | } | 283 | DO_IT_NOW(_glActiveTexture, 1); |
| 190 | void Batch::do_glActiveTexture(int ¶mOffset) { | 284 | } |
| 285 | void Batch::do_glActiveTexture(uint32& paramOffset) { | ||
| 191 | glActiveTexture(_params[paramOffset++]._uint); | 286 | glActiveTexture(_params[paramOffset++]._uint); |
| 192 | } | 287 | } |
| 193 | 288 | ||
| 194 | void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) { | 289 | void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) { |
| 195 | _commands.push_back(COMMAND_glDrawBuffers); | 290 | ADD_COMMAND(glDrawBuffers); |
| 196 | _params.push_back(bufs); | 291 | |
| 197 | _params.push_back(n); | 292 | _params.push_back(cacheData(n * sizeof(GLenum), bufs)); |
| 198 | 293 | _params.push_back(n); | |
| 199 | DO_IT_NOW(_glDrawBuffers, 2); | 294 | |
| 200 | } | 295 | DO_IT_NOW(_glDrawBuffers, 2); |
| 201 | void Batch::do_glDrawBuffers(int ¶mOffset) { | 296 | } |
| 202 | glDrawBuffers(_params[paramOffset++]._uint, (const GLenum*) _params[paramOffset++]._constPointer); | 297 | void Batch::do_glDrawBuffers(uint32& paramOffset) { |
| 203 | } | 298 | glDrawBuffers(_params[paramOffset++]._uint, (const GLenum*) editData(_params[paramOffset++]._uint)); |
| 204 | 299 | } | |
| 205 | void Batch::_glUseProgram(GLuint program) { | 300 | |
| 206 | _commands.push_back(COMMAND_glUseProgram); | 301 | void Batch::_glUseProgram(GLuint program) { |
| 207 | _params.push_back(program); | 302 | ADD_COMMAND(glUseProgram); |
| 208 | 303 | ||
| 209 | DO_IT_NOW(_glUseProgram, 1); | 304 | _params.push_back(program); |
| 210 | } | 305 | |
| 211 | void Batch::do_glUseProgram(int ¶mOffset) { | 306 | DO_IT_NOW(_glUseProgram, 1); |
| 307 | } | ||
| 308 | void Batch::do_glUseProgram(uint32& paramOffset) { | ||
| 212 | glUseProgram(_params[paramOffset++]._uint); | 309 | glUseProgram(_params[paramOffset++]._uint); |
| 213 | } | 310 | } |
| 214 | 311 | ||
| 215 | void Batch::_glUniform1f(GLint location, GLfloat v0) { | 312 | void Batch::_glUniform1f(GLint location, GLfloat v0) { |
| 216 | _commands.push_back(COMMAND_glUniform1f); | 313 | ADD_COMMAND(glUniform1f); |
| 217 | _params.push_back(v0); | 314 | |
| 218 | _params.push_back(location); | 315 | _params.push_back(v0); |
| 219 | 316 | _params.push_back(location); | |
| 220 | DO_IT_NOW(_glUniform1f, 1); | 317 | |
| 221 | } | 318 | DO_IT_NOW(_glUniform1f, 1); |
| 222 | void Batch::do_glUniform1f(int ¶mOffset) { | 319 | } |
| 223 | glUniform1f(_params[paramOffset++]._float); | 320 | void Batch::do_glUniform1f(uint32& paramOffset) { |
| 224 | } | 321 | glUniform1f(_params[paramOffset++]._int, _params[paramOffset++]._float); |
| 225 | 322 | } | |
| 226 | void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { | 323 | |
| 227 | _commands.push_back(COMMAND_glUniformMatrix4fv); | 324 | void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { |
| 228 | _params.push_back(value); | 325 | ADD_COMMAND(glUniformMatrix4fv); |
| 229 | _params.push_back(transpose); | 326 | |
| 230 | _params.push_back(count); | 327 | const int MATRIX4_SIZE = 16 * sizeof(float); |
| 231 | _params.push_back(location); | 328 | _params.push_back(cacheData(count * MATRIX4_SIZE, value)); |
| 232 | 329 | _params.push_back(transpose); | |
| 233 | DO_IT_NOW(_glUniformMatrix4fv, 4); | 330 | _params.push_back(count); |
| 234 | } | 331 | _params.push_back(location); |
| 235 | void Batch::do_glUniformMatrix4fv(int ¶mOffset) { | 332 | |
| 236 | glUniformMatrix4fv(_params[paramOffset++]._int, _params[paramOffset++]._uint, _params[paramOffset++]._uint, _params[paramOffset++]._constPointer); | 333 | DO_IT_NOW(_glUniformMatrix4fv, 4); |
| 237 | } | 334 | } |
| 238 | 335 | void Batch::do_glUniformMatrix4fv(uint32& paramOffset) { | |
| 239 | void Batch::_glMatrixMode(GLenum mode) { | 336 | glUniformMatrix4fv(_params[paramOffset++]._int, _params[paramOffset++]._uint, |
| 240 | _commands.push_back(COMMAND_glMatrixMode); | 337 | _params[paramOffset++]._uint, (const GLfloat*) editData(_params[paramOffset++]._uint)); |
| 241 | _params.push_back(mode); | 338 | } |
| 242 | 339 | ||
| 243 | DO_IT_NOW(_glMatrixMode, 1); | 340 | void Batch::_glMatrixMode(GLenum mode) { |
| 244 | } | 341 | ADD_COMMAND(glMatrixMode); |
| 245 | void Batch::do_glMatrixMode(int ¶mOffset) { | 342 | |
| 343 | _params.push_back(mode); | ||
| 344 | |||
| 345 | DO_IT_NOW(_glMatrixMode, 1); | ||
| 346 | } | ||
| 347 | void Batch::do_glMatrixMode(uint32& paramOffset) { | ||
| 246 | glMatrixMode(_params[paramOffset++]._uint); | 348 | glMatrixMode(_params[paramOffset++]._uint); |
| 247 | } | 349 | } |
| 248 | 350 | ||
| 249 | void Batch::_glPushMatrix() { | 351 | void Batch::_glPushMatrix() { |
| 250 | _commands.push_back(COMMAND_glPushMatrix); | 352 | ADD_COMMAND(glPushMatrix); |
| 251 | 353 | ||
| 252 | DO_IT_NOW(_glPushMatrix, 0); | 354 | DO_IT_NOW(_glPushMatrix, 0); |
| 253 | } | 355 | } |
| 254 | void Batch::do_glPushMatrix(int ¶mOffset) { | 356 | void Batch::do_glPushMatrix(uint32& paramOffset) { |
| 255 | glPushMatrix(); | 357 | glPushMatrix(); |
| 256 | } | 358 | } |
| 257 | 359 | ||
| 258 | void Batch::_glPopMatrix() { | 360 | void Batch::_glPopMatrix() { |
| 259 | _commands.push_back(COMMAND_glPopMatrix); | 361 | ADD_COMMAND(glPopMatrix); |
| 260 | 362 | ||
| 261 | DO_IT_NOW(_glPopMatrix, 0); | 363 | DO_IT_NOW(_glPopMatrix, 0); |
| 262 | } | 364 | } |
| 263 | void Batch::do_glPopMatrix(int ¶mOffset) { | 365 | void Batch::do_glPopMatrix(uint32& paramOffset) { |
| 264 | glPopMatrix(); | 366 | glPopMatrix(); |
| 265 | } | 367 | } |
| 266 | 368 | ||
| 267 | void Batch::_glMultMatrixf(const GLfloat *m) { | 369 | void Batch::_glMultMatrixf(const GLfloat *m) { |
| 268 | _commands.push_back(COMMAND_glMultMatrixf); | 370 | ADD_COMMAND(glMultMatrixf); |
| 269 | _params.push_back(m); | 371 | |
| 270 | 372 | const int MATRIX4_SIZE = 16 * sizeof(float); | |
| 373 | _params.push_back(cacheData(MATRIX4_SIZE, m)); | ||
| 374 | |||
| 271 | DO_IT_NOW(_glMultMatrixf, 1); | 375 | DO_IT_NOW(_glMultMatrixf, 1); |
| 272 | } | 376 | } |
| 273 | void Batch::do_glMultMatrixf(int ¶mOffset) { | 377 | void Batch::do_glMultMatrixf(uint32& paramOffset) { |
| 274 | glMultMatrixf((const GLfloat*) _params[paramOffset++]._constPointer); | 378 | glMultMatrixf((const GLfloat*) editData(_params[paramOffset++]._uint)); |
| 275 | } | 379 | } |
| 276 | 380 | ||
| 277 | void Batch::_glLoadMatrixf(const GLfloat *m) { | 381 | void Batch::_glLoadMatrixf(const GLfloat *m) { |
| 278 | _commands.push_back(COMMAND_glLoadMatrixf); | 382 | ADD_COMMAND(glLoadMatrixf); |
| 279 | _params.push_back(m); | 383 | |
| 280 | 384 | const int MATRIX4_SIZE = 16 * sizeof(float); | |
| 281 | DO_IT_NOW(_glLoadMatrixf, 1); | 385 | _params.push_back(cacheData(MATRIX4_SIZE, m)); |
| 282 | } | 386 | |
| 283 | void Batch::do_glLoadMatrixf(int ¶mOffset) { | 387 | DO_IT_NOW(_glLoadMatrixf, 1); |
| 284 | glLoadMatrixf((const GLfloat*)_params[paramOffset++]._constPointer); | 388 | } |
| 285 | } | 389 | void Batch::do_glLoadMatrixf(uint32& paramOffset) { |
| 286 | 390 | glLoadMatrixf((const GLfloat*)editData(_params[paramOffset++]._uint)); | |
| 287 | void Batch::_glLoadIdentity(void) { | 391 | } |
| 288 | _commands.push_back(COMMAND_glLoadIdentity); | 392 | |
| 289 | 393 | void Batch::_glLoadIdentity(void) { | |
| 290 | DO_IT_NOW(_glLoadIdentity, 0); | 394 | ADD_COMMAND(glLoadIdentity); |
| 291 | } | 395 | |
| 292 | void Batch::do_glLoadIdentity(int ¶mOffset) { | 396 | DO_IT_NOW(_glLoadIdentity, 0); |
| 397 | } | ||
| 398 | void Batch::do_glLoadIdentity(uint32& paramOffset) { | ||
| 293 | glLoadIdentity(); | 399 | glLoadIdentity(); |
| 294 | } | 400 | } |
| 295 | 401 | ||
| 296 | void Batch::_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { | 402 | void Batch::_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { |
| 297 | _commands.push_back(COMMAND_glRotatef); | 403 | ADD_COMMAND(glRotatef); |
| 298 | _params.push_back(z); | 404 | |
| 299 | _params.push_back(y); | 405 | _params.push_back(z); |
| 300 | _params.push_back(x); | 406 | _params.push_back(y); |
| 301 | _params.push_back(angle); | 407 | _params.push_back(x); |
| 302 | 408 | _params.push_back(angle); | |
| 303 | DO_IT_NOW(_glRotatef, 4); | 409 | |
| 304 | } | 410 | DO_IT_NOW(_glRotatef, 4); |
| 305 | void Batch::do_glRotatef(int ¶mOffset) { | 411 | } |
| 412 | void Batch::do_glRotatef(uint32& paramOffset) { | ||
| 306 | glRotatef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); | 413 | glRotatef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); |
| 307 | } | 414 | } |
| 308 | 415 | ||
| 309 | void Batch::_glScalef(GLfloat x, GLfloat y, GLfloat z) { | 416 | void Batch::_glScalef(GLfloat x, GLfloat y, GLfloat z) { |
| 310 | _commands.push_back(COMMAND_glScalef); | 417 | ADD_COMMAND(glScalef); |
| 311 | _params.push_back(z); | 418 | |
| 312 | _params.push_back(y); | 419 | _params.push_back(z); |
| 313 | _params.push_back(x); | 420 | _params.push_back(y); |
| 314 | 421 | _params.push_back(x); | |
| 315 | DO_IT_NOW(_glScalef, 3); | 422 | |
| 316 | } | 423 | DO_IT_NOW(_glScalef, 3); |
| 317 | void Batch::do_glScalef(int ¶mOffset) { | 424 | } |
| 425 | void Batch::do_glScalef(uint32& paramOffset) { | ||
| 318 | glScalef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); | 426 | glScalef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); |
| 319 | } | 427 | } |
| 320 | 428 | ||
| 321 | void Batch::_glTranslatef(GLfloat x, GLfloat y, GLfloat z) { | 429 | void Batch::_glTranslatef(GLfloat x, GLfloat y, GLfloat z) { |
| 322 | _commands.push_back(COMMAND_glTranslatef); | 430 | ADD_COMMAND(glTranslatef); |
| 323 | _params.push_back(z); | 431 | |
| 324 | _params.push_back(y); | 432 | _params.push_back(z); |
| 325 | _params.push_back(x); | 433 | _params.push_back(y); |
| 326 | 434 | _params.push_back(x); | |
| 327 | DO_IT_NOW(_glTranslatef, 3); | 435 | |
| 328 | } | 436 | DO_IT_NOW(_glTranslatef, 3); |
| 329 | void Batch::do_glTranslatef(int ¶mOffset) { | 437 | } |
| 438 | void Batch::do_glTranslatef(uint32& paramOffset) { | ||
| 330 | glTranslatef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); | 439 | glTranslatef(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); |
| 331 | } | 440 | } |
| 332 | 441 | ||
| 333 | void Batch::_glDrawArrays(GLenum mode, GLint first, GLsizei count) { | 442 | void Batch::_glDrawArrays(GLenum mode, GLint first, GLsizei count) { |
| 334 | _commands.push_back(COMMAND_glDrawArrays); | 443 | ADD_COMMAND(glDrawArrays); |
| 335 | _params.push_back(count); | 444 | |
| 336 | _params.push_back(first); | 445 | _params.push_back(count); |
| 337 | _params.push_back(mode); | 446 | _params.push_back(first); |
| 338 | 447 | _params.push_back(mode); | |
| 339 | DO_IT_NOW(_glDrawArrays, 3); | 448 | |
| 340 | } | 449 | DO_IT_NOW(_glDrawArrays, 3); |
| 341 | void Batch::do_glDrawArrays(int ¶mOffset) { | 450 | } |
| 451 | void Batch::do_glDrawArrays(uint32& paramOffset) { | ||
| 342 | glDrawArrays(_params[paramOffset++]._uint, _params[paramOffset++]._int, _params[paramOffset++]._int); | 452 | glDrawArrays(_params[paramOffset++]._uint, _params[paramOffset++]._int, _params[paramOffset++]._int); |
| 343 | } | ||
| 344 | |||
| 345 | void Batch::_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices) { | ||
| 346 | _commands.push_back(COMMAND_glDrawRangeElements); | ||
| 347 | _params.push_back(indices); | ||
| 348 | _params.push_back(type); | ||
| 349 | _params.push_back(count); | ||
| 350 | _params.push_back(end); | ||
| 351 | _params.push_back(start); | ||
| 352 | _params.push_back(mode); | ||
| 353 | |||
| 354 | DO_IT_NOW(_glDrawRangeElements, 6); | ||
| 355 | } | ||
| 356 | void Batch::do_glDrawRangeElements(int ¶mOffset) { | ||
| 357 | glDrawRangeElements(_params[paramOffset++]._uint, _params[paramOffset++]._uint, _params[paramOffset++]._uint, _params[paramOffset++]._int, _params[paramOffset++]._uint, _params[paramOffset++]._constPointer); | ||
| 358 | } | ||
| 359 | |||
| 360 | void Batch::_glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { | ||
| 361 | _commands.push_back(COMMAND_glColorPointer); | ||
| 362 | _params.push_back(pointer); | ||
| 363 | _params.push_back(stride); | ||
| 364 | _params.push_back(type); | ||
| 365 | _params.push_back(size); | ||
| 366 | |||
| 367 | DO_IT_NOW(_glColorPointer, 4); | ||
| 368 | } | ||
| 369 | void Batch::do_glColorPointer(int ¶mOffset) { | ||
| 370 | glColorPointer(_params[paramOffset++]._int, _params[paramOffset++]._uint, _params[paramOffset++]._int, _params[paramOffset++]._constPointer); | ||
| 371 | } | ||
| 372 | |||
| 373 | void Batch::_glNormalPointer(GLenum type, GLsizei stride, const void *pointer) { | ||
| 374 | _commands.push_back(COMMAND_glNormalPointer); | ||
| 375 | _params.push_back(pointer); | ||
| 376 | _params.push_back(stride); | ||
| 377 | _params.push_back(type); | ||
| 378 | |||
| 379 | DO_IT_NOW(_glNormalPointer, 4); | ||
| 380 | } | ||
| 381 | void Batch::do_glNormalPointer(int ¶mOffset) { | ||
| 382 | glNormalPointer(_params[paramOffset++]._uint, _params[paramOffset++]._int, _params[paramOffset++]._constPointer); | ||
| 383 | } | ||
| 384 | |||
| 385 | void Batch::_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { | ||
| 386 | _commands.push_back(COMMAND_glTexCoordPointer); | ||
| 387 | _params.push_back(pointer); | ||
| 388 | _params.push_back(stride); | ||
| 389 | _params.push_back(type); | ||
| 390 | _params.push_back(size); | ||
| 391 | } | ||
| 392 | void Batch::do_glCullFace(int ¶mOffset) { | ||
| 393 | glCullFace(_params[paramOffset++]._uint); | ||
| 394 | } | ||
| 395 | |||
| 396 | void Batch::_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { | ||
| 397 | _commands.push_back(COMMAND_glVertexPointer); | ||
| 398 | _params.push_back(pointer); | ||
| 399 | _params.push_back(stride); | ||
| 400 | _params.push_back(type); | ||
| 401 | _params.push_back(size); | ||
| 402 | } | ||
| 403 | void Batch::do_glCullFace(int ¶mOffset) { | ||
| 404 | glCullFace(_params[paramOffset++]._uint); | ||
| 405 | } | 453 | } |
| 406 | 454 | ||
| 455 | void Batch::_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices) { | ||
| 456 | ADD_COMMAND(glDrawRangeElements); | ||
| 407 | 457 | ||
| 408 | void Batch::_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) { | 458 | _params.push_back(cacheResource(indices)); |
| 409 | _commands.push_back(COMMAND_glVertexPointer); | 459 | _params.push_back(type); |
| 410 | _params.push_back(pointer); | 460 | _params.push_back(count); |
| 411 | _params.push_back(stride); | 461 | _params.push_back(end); |
| 412 | _params.push_back(normalized); | 462 | _params.push_back(start); |
| 413 | _params.push_back(type); | 463 | _params.push_back(mode); |
| 414 | _params.push_back(size); | 464 | |
| 415 | _params.push_back(index); | 465 | //do_glDrawRangeElements(_commandOffsets.back()); |
| 416 | } | 466 | // runCommand(_commands.size() - 1); |
| 417 | void Batch::do_glCullFace(int ¶mOffset) { | 467 | DO_IT_NOW(_glDrawRangeElements, 6); |
| 418 | glCullFace(_params[paramOffset++]._uint); | 468 | } |
| 469 | void Batch::do_glDrawRangeElements(uint32& paramOffset) { | ||
| 470 | glDrawRangeElements(_params[paramOffset++]._uint, _params[paramOffset++]._uint, | ||
| 471 | _params[paramOffset++]._uint, _params[paramOffset++]._int, | ||
| 472 | _params[paramOffset++]._uint, editResource(_params[paramOffset++]._uint)->_pointer); | ||
| 419 | } | 473 | } |
| 420 | 474 | ||
| 421 | void Batch::_glEnableVertexArrayAttrib(GLint location) { | 475 | void Batch::_glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { |
| 422 | _commands.push_back(COMMAND_glEnableVertexArrayAttrib); | 476 | ADD_COMMAND(glColorPointer); |
| 423 | _params.push_back(location); | 477 | |
| 424 | } | 478 | _params.push_back(cacheResource(pointer)); |
| 425 | void Batch::do_glCullFace(int ¶mOffset) { | 479 | _params.push_back(stride); |
| 426 | glCullFace(_params[paramOffset++]._uint); | 480 | _params.push_back(type); |
| 481 | _params.push_back(size); | ||
| 482 | |||
| 483 | DO_IT_NOW(_glColorPointer, 4); | ||
| 484 | } | ||
| 485 | void Batch::do_glColorPointer(uint32& paramOffset) { | ||
| 486 | glColorPointer(_params[paramOffset++]._int, _params[paramOffset++]._uint, | ||
| 487 | _params[paramOffset++]._int, editResource(_params[paramOffset++]._uint)->_pointer); | ||
| 427 | } | 488 | } |
| 428 | 489 | ||
| 429 | void Batch::_glDisableVertexArrayAttrib(GLint location) { | 490 | void Batch::_glNormalPointer(GLenum type, GLsizei stride, const void *pointer) { |
| 430 | _commands.push_back(COMMAND_glDisableVertexArrayAttrib); | 491 | ADD_COMMAND(glNormalPointer); |
| 431 | _params.push_back(location); | 492 | |
| 432 | } | 493 | _params.push_back(cacheResource(pointer)); |
| 433 | void Batch::do_glCullFace(int ¶mOffset) { | 494 | _params.push_back(stride); |
| 434 | glCullFace(_params[paramOffset++]._uint); | 495 | _params.push_back(type); |
| 496 | |||
| 497 | DO_IT_NOW(_glNormalPointer, 3); | ||
| 498 | } | ||
| 499 | void Batch::do_glNormalPointer(uint32& paramOffset) { | ||
| 500 | glNormalPointer(_params[paramOffset++]._uint, _params[paramOffset++]._int, | ||
| 501 | editResource(_params[paramOffset++]._uint)->_pointer); | ||
| 435 | } | 502 | } |
| 436 | 503 | ||
| 437 | void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { | 504 | void Batch::_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { |
| 438 | _commands.push_back(COMMAND_glColor4f); | 505 | ADD_COMMAND(glTexCoordPointer); |
| 439 | _params.push_back(alpha); | 506 | |
| 440 | _params.push_back(blue); | 507 | _params.push_back(cacheResource(pointer)); |
| 441 | _params.push_back(green); | 508 | _params.push_back(stride); |
| 442 | _params.push_back(red); | 509 | _params.push_back(type); |
| 443 | } | 510 | _params.push_back(size); |
| 444 | void Batch::do_glCullFace(int ¶mOffset) { | 511 | |
| 445 | glCullFace(_params[paramOffset++]._uint); | 512 | DO_IT_NOW(_glTexCoordPointer, 4); |
| 513 | } | ||
| 514 | void Batch::do_glTexCoordPointer(uint32& paramOffset) { | ||
| 515 | glTexCoordPointer(_params[paramOffset++]._int, _params[paramOffset++]._uint, | ||
| 516 | _params[paramOffset++]._int, editResource(_params[paramOffset++]._uint)->_pointer); | ||
| 446 | } | 517 | } |
| 447 | 518 | ||
| 448 | void Batch::_glMaterialf(GLenum face, GLenum pname, GLfloat param) { | 519 | void Batch::_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { |
| 449 | _commands.push_back(COMMAND_glMaterialf); | 520 | ADD_COMMAND(glVertexPointer); |
| 450 | _params.push_back(param); | 521 | |
| 451 | _params.push_back(pname); | 522 | _params.push_back(cacheResource(pointer)); |
| 452 | _params.push_back(face); | 523 | _params.push_back(stride); |
| 453 | } | 524 | _params.push_back(type); |
| 454 | void Batch::do_glCullFace(int ¶mOffset) { | 525 | _params.push_back(size); |
| 455 | glCullFace(_params[paramOffset++]._uint); | 526 | |
| 456 | } | 527 | DO_IT_NOW(_glVertexPointer, 4); |
| 457 | 528 | } | |
| 458 | void Batch::_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { | 529 | void Batch::do_glVertexPointer(uint32& paramOffset) { |
| 459 | _commands.push_back(COMMAND_glMaterialfv); | 530 | glVertexPointer(_params[paramOffset++]._int, _params[paramOffset++]._uint, |
| 460 | _params.push_back(params); | 531 | _params[paramOffset++]._int, editResource(_params[paramOffset++]._uint)->_pointer); |
| 461 | _params.push_back(pname); | 532 | } |
| 462 | _params.push_back(face); | 533 | |
| 463 | } | 534 | |
| 464 | void Batch::do_glCullFace(int ¶mOffset) { | 535 | void Batch::_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer) { |
| 465 | glCullFace(_params[paramOffset++]._uint); | 536 | ADD_COMMAND(glVertexAttribPointer); |
| 537 | |||
| 538 | _params.push_back(cacheResource(pointer)); | ||
| 539 | _params.push_back(stride); | ||
| 540 | _params.push_back(normalized); | ||
| 541 | _params.push_back(type); | ||
| 542 | _params.push_back(size); | ||
| 543 | _params.push_back(index); | ||
| 544 | |||
| 545 | DO_IT_NOW(_glVertexAttribPointer, 6); | ||
| 546 | } | ||
| 547 | void Batch::do_glVertexAttribPointer(uint32& paramOffset) { | ||
| 548 | glVertexAttribPointer(_params[paramOffset++]._uint, _params[paramOffset++]._int, | ||
| 549 | _params[paramOffset++]._uint, _params[paramOffset++]._uint, | ||
| 550 | _params[paramOffset++]._int, editResource(_params[paramOffset++]._uint)->_pointer); | ||
| 551 | } | ||
| 552 | |||
| 553 | |||
| 554 | |||
| 555 | void Batch::_glEnableVertexAttribArray(GLint location) { | ||
| 556 | ADD_COMMAND(glEnableVertexAttribArray); | ||
| 557 | |||
| 558 | _params.push_back(location); | ||
| 559 | |||
| 560 | DO_IT_NOW(_glEnableVertexAttribArray, 1); | ||
| 561 | } | ||
| 562 | void Batch::do_glEnableVertexAttribArray(uint32& paramOffset) { | ||
| 563 | glEnableVertexAttribArray(_params[paramOffset++]._uint); | ||
| 466 | } | 564 | } |
| 467 | 565 | ||
| 566 | void Batch::_glDisableVertexAttribArray(GLint location) { | ||
| 567 | ADD_COMMAND(glDisableVertexAttribArray); | ||
| 568 | |||
| 569 | _params.push_back(location); | ||
| 570 | |||
| 571 | DO_IT_NOW(_glDisableVertexAttribArray, 1); | ||
| 572 | } | ||
| 573 | void Batch::do_glDisableVertexAttribArray(uint32& paramOffset) { | ||
| 574 | glDisableVertexAttribArray(_params[paramOffset++]._uint); | ||
| 575 | } | ||
| 576 | |||
| 577 | void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { | ||
| 578 | ADD_COMMAND(glColor4f); | ||
| 579 | |||
| 580 | _params.push_back(alpha); | ||
| 581 | _params.push_back(blue); | ||
| 582 | _params.push_back(green); | ||
| 583 | _params.push_back(red); | ||
| 584 | |||
| 585 | DO_IT_NOW(_glColor4f, 4); | ||
| 586 | } | ||
| 587 | void Batch::do_glColor4f(uint32& paramOffset) { | ||
| 588 | glColor4f(_params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float, _params[paramOffset++]._float); | ||
| 589 | } | ||
| 590 | |||
| 591 | void Batch::_glMaterialf(GLenum face, GLenum pname, GLfloat param) { | ||
| 592 | ADD_COMMAND(glMaterialf); | ||
| 593 | |||
| 594 | _params.push_back(param); | ||
| 595 | _params.push_back(pname); | ||
| 596 | _params.push_back(face); | ||
| 597 | |||
| 598 | DO_IT_NOW(_glMaterialf, 3); | ||
| 599 | } | ||
| 600 | void Batch::do_glMaterialf(uint32& paramOffset) { | ||
| 601 | glMaterialf(_params[paramOffset++]._uint, _params[paramOffset++]._uint, _params[paramOffset++]._float); | ||
| 602 | } | ||
| 603 | |||
| 604 | void Batch::_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { | ||
| 605 | ADD_COMMAND(glMaterialfv); | ||
| 606 | |||
| 607 | _params.push_back(cacheData(4 * sizeof(float), params)); | ||
| 608 | _params.push_back(pname); | ||
| 609 | _params.push_back(face); | ||
| 610 | |||
| 611 | DO_IT_NOW(_glMaterialfv, 3); | ||
| 612 | } | ||
| 613 | void Batch::do_glMaterialfv(uint32& paramOffset) { | ||
| 614 | glMaterialfv(_params[paramOffset++]._uint, _params[paramOffset++]._uint, (const GLfloat*) editData(_params[paramOffset++]._uint)); | ||
| 615 | } | ||
| 616 | |||
| 617 | |||
| 468 | 618 | ||
| 619 | void backend::renderBatch(Batch& batch) { | ||
| 620 | for (int i = 0; i < batch._commands.size(); i++) { | ||
| 621 | batch.runCommand(i); | ||
| 622 | } | ||
| 623 | } | ||