| OLD | NEW |
| 1 // This file is auto-generated. DO NOT EDIT! | 1 // This file is auto-generated. DO NOT EDIT! |
| 2 | 2 |
| 3 // It is included by gles2_cmd_decoder.cc | 3 // It is included by gles2_cmd_decoder.cc |
| 4 | 4 |
| 5 parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( | 5 parse_error::ParseError GLES2DecoderImpl::HandleActiveTexture( |
| 6 uint32 immediate_data_size, const gles2::ActiveTexture& c) { | 6 uint32 immediate_data_size, const gles2::ActiveTexture& c) { |
| 7 GLenum texture = static_cast<GLenum>(c.texture); | 7 GLenum texture = static_cast<GLenum>(c.texture); |
| 8 glActiveTexture(texture); | 8 glActiveTexture(texture); |
| 9 return parse_error::kParseNoError; | 9 return parse_error::kParseNoError; |
| 10 } | 10 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( | 47 parse_error::ParseError GLES2DecoderImpl::HandleBindAttribLocationImmediate( |
| 48 uint32 immediate_data_size, const gles2::BindAttribLocationImmediate& c) { | 48 uint32 immediate_data_size, const gles2::BindAttribLocationImmediate& c) { |
| 49 GLuint program; | 49 GLuint program; |
| 50 if (!id_map_.GetServiceId(c.program, &program)) { | 50 if (!id_map_.GetServiceId(c.program, &program)) { |
| 51 SetGLError(GL_INVALID_VALUE); | 51 SetGLError(GL_INVALID_VALUE); |
| 52 return parse_error::kParseNoError; | 52 return parse_error::kParseNoError; |
| 53 } | 53 } |
| 54 GLuint index = static_cast<GLuint>(c.index); | 54 GLuint index = static_cast<GLuint>(c.index); |
| 55 uint32 name_size = c.data_size; | 55 uint32 name_size = c.data_size; |
| 56 const char* name = GetImmediateDataAs<const char*>(c); | 56 const char* name = GetImmediateDataAs<const char*>( |
| 57 // TODO(gman): Make sure validate checks | 57 c, name_size, immediate_data_size); |
| 58 // immediate_data_size covers data_size. | |
| 59 if (name == NULL) { | 58 if (name == NULL) { |
| 60 return parse_error::kParseOutOfBounds; | 59 return parse_error::kParseOutOfBounds; |
| 61 } | 60 } |
| 62 String name_str(name, name_size); | 61 String name_str(name, name_size); |
| 63 glBindAttribLocation(program, index, name_str.c_str()); | 62 glBindAttribLocation(program, index, name_str.c_str()); |
| 64 return parse_error::kParseNoError; | 63 return parse_error::kParseNoError; |
| 65 } | 64 } |
| 66 | 65 |
| 67 parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( | 66 parse_error::ParseError GLES2DecoderImpl::HandleBindBuffer( |
| 68 uint32 immediate_data_size, const gles2::BindBuffer& c) { | 67 uint32 immediate_data_size, const gles2::BindBuffer& c) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 204 } |
| 206 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); | 205 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
| 207 return parse_error::kParseNoError; | 206 return parse_error::kParseNoError; |
| 208 } | 207 } |
| 209 | 208 |
| 210 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( | 209 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubData( |
| 211 uint32 immediate_data_size, const gles2::BufferSubData& c) { | 210 uint32 immediate_data_size, const gles2::BufferSubData& c) { |
| 212 GLenum target = static_cast<GLenum>(c.target); | 211 GLenum target = static_cast<GLenum>(c.target); |
| 213 GLintptr offset = static_cast<GLintptr>(c.offset); | 212 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 214 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 213 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 215 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | |
| 216 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | |
| 217 uint32 data_size = size; | 214 uint32 data_size = size; |
| 218 const void* data = GetSharedMemoryAs<const void*>( | 215 const void* data = GetSharedMemoryAs<const void*>( |
| 219 data_shm_id, data_shm_offset, data_size); | 216 c.data_shm_id, c.data_shm_offset, data_size); |
| 220 if (!ValidateGLenumBufferTarget(target)) { | 217 if (!ValidateGLenumBufferTarget(target)) { |
| 221 SetGLError(GL_INVALID_VALUE); | 218 SetGLError(GL_INVALID_VALUE); |
| 222 return parse_error::kParseNoError; | 219 return parse_error::kParseNoError; |
| 223 } | 220 } |
| 224 if (data == NULL) { | 221 if (data == NULL) { |
| 225 return parse_error::kParseOutOfBounds; | 222 return parse_error::kParseOutOfBounds; |
| 226 } | 223 } |
| 227 glBufferSubData(target, offset, size, data); | 224 glBufferSubData(target, offset, size, data); |
| 228 return parse_error::kParseNoError; | 225 return parse_error::kParseNoError; |
| 229 } | 226 } |
| 230 | 227 |
| 231 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( | 228 parse_error::ParseError GLES2DecoderImpl::HandleBufferSubDataImmediate( |
| 232 uint32 immediate_data_size, const gles2::BufferSubDataImmediate& c) { | 229 uint32 immediate_data_size, const gles2::BufferSubDataImmediate& c) { |
| 233 GLenum target = static_cast<GLenum>(c.target); | 230 GLenum target = static_cast<GLenum>(c.target); |
| 234 GLintptr offset = static_cast<GLintptr>(c.offset); | 231 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 235 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 232 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 236 const void* data = GetImmediateDataAs<const void*>(c); | 233 uint32 data_size = size; |
| 234 const void* data = GetImmediateDataAs<const void*>( |
| 235 c, data_size, immediate_data_size); |
| 237 if (!ValidateGLenumBufferTarget(target)) { | 236 if (!ValidateGLenumBufferTarget(target)) { |
| 238 SetGLError(GL_INVALID_VALUE); | 237 SetGLError(GL_INVALID_VALUE); |
| 239 return parse_error::kParseNoError; | 238 return parse_error::kParseNoError; |
| 240 } | 239 } |
| 241 if (data == NULL) { | 240 if (data == NULL) { |
| 242 return parse_error::kParseOutOfBounds; | 241 return parse_error::kParseOutOfBounds; |
| 243 } | 242 } |
| 244 // Immediate version. | |
| 245 if (!ValidateGLenumBufferTarget(target)) { | |
| 246 SetGLError(GL_INVALID_VALUE); | |
| 247 return parse_error::kParseNoError; | |
| 248 } | |
| 249 if (data == NULL) { | |
| 250 return parse_error::kParseOutOfBounds; | |
| 251 } | |
| 252 glBufferSubData(target, offset, size, data); | 243 glBufferSubData(target, offset, size, data); |
| 253 return parse_error::kParseNoError; | 244 return parse_error::kParseNoError; |
| 254 } | 245 } |
| 255 | 246 |
| 256 parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( | 247 parse_error::ParseError GLES2DecoderImpl::HandleCheckFramebufferStatus( |
| 257 uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) { | 248 uint32 immediate_data_size, const gles2::CheckFramebufferStatus& c) { |
| 258 GLenum target = static_cast<GLenum>(c.target); | 249 GLenum target = static_cast<GLenum>(c.target); |
| 259 if (!ValidateGLenumFrameBufferTarget(target)) { | 250 if (!ValidateGLenumFrameBufferTarget(target)) { |
| 260 SetGLError(GL_INVALID_VALUE); | 251 SetGLError(GL_INVALID_VALUE); |
| 261 return parse_error::kParseNoError; | 252 return parse_error::kParseNoError; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( | 310 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2D( |
| 320 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) { | 311 uint32 immediate_data_size, const gles2::CompressedTexSubImage2D& c) { |
| 321 GLenum target = static_cast<GLenum>(c.target); | 312 GLenum target = static_cast<GLenum>(c.target); |
| 322 GLint level = static_cast<GLint>(c.level); | 313 GLint level = static_cast<GLint>(c.level); |
| 323 GLint xoffset = static_cast<GLint>(c.xoffset); | 314 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 324 GLint yoffset = static_cast<GLint>(c.yoffset); | 315 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 325 GLsizei width = static_cast<GLsizei>(c.width); | 316 GLsizei width = static_cast<GLsizei>(c.width); |
| 326 GLsizei height = static_cast<GLsizei>(c.height); | 317 GLsizei height = static_cast<GLsizei>(c.height); |
| 327 GLenum format = static_cast<GLenum>(c.format); | 318 GLenum format = static_cast<GLenum>(c.format); |
| 328 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | 319 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); |
| 329 uint32 data_shm_id = static_cast<uint32>(c.data_shm_id); | |
| 330 uint32 data_shm_offset = static_cast<uint32>(c.data_shm_offset); | |
| 331 uint32 data_size = imageSize; | 320 uint32 data_size = imageSize; |
| 332 const void* data = GetSharedMemoryAs<const void*>( | 321 const void* data = GetSharedMemoryAs<const void*>( |
| 333 data_shm_id, data_shm_offset, data_size); | 322 c.data_shm_id, c.data_shm_offset, data_size); |
| 334 if (!ValidateGLenumTextureTarget(target)) { | 323 if (!ValidateGLenumTextureTarget(target)) { |
| 335 SetGLError(GL_INVALID_VALUE); | 324 SetGLError(GL_INVALID_VALUE); |
| 336 return parse_error::kParseNoError; | 325 return parse_error::kParseNoError; |
| 337 } | 326 } |
| 338 if (data == NULL) { | 327 if (data == NULL) { |
| 339 return parse_error::kParseOutOfBounds; | 328 return parse_error::kParseOutOfBounds; |
| 340 } | 329 } |
| 341 glCompressedTexSubImage2D( | 330 glCompressedTexSubImage2D( |
| 342 target, level, xoffset, yoffset, width, height, format, imageSize, data); | 331 target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 343 return parse_error::kParseNoError; | 332 return parse_error::kParseNoError; |
| 344 } | 333 } |
| 345 | 334 |
| 346 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate
( | 335 parse_error::ParseError GLES2DecoderImpl::HandleCompressedTexSubImage2DImmediate
( |
| 347 | 336 |
| 348 uint32 immediate_data_size, | 337 uint32 immediate_data_size, |
| 349 const gles2::CompressedTexSubImage2DImmediate& c) { | 338 const gles2::CompressedTexSubImage2DImmediate& c) { |
| 350 GLenum target = static_cast<GLenum>(c.target); | 339 GLenum target = static_cast<GLenum>(c.target); |
| 351 GLint level = static_cast<GLint>(c.level); | 340 GLint level = static_cast<GLint>(c.level); |
| 352 GLint xoffset = static_cast<GLint>(c.xoffset); | 341 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 353 GLint yoffset = static_cast<GLint>(c.yoffset); | 342 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 354 GLsizei width = static_cast<GLsizei>(c.width); | 343 GLsizei width = static_cast<GLsizei>(c.width); |
| 355 GLsizei height = static_cast<GLsizei>(c.height); | 344 GLsizei height = static_cast<GLsizei>(c.height); |
| 356 GLenum format = static_cast<GLenum>(c.format); | 345 GLenum format = static_cast<GLenum>(c.format); |
| 357 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | 346 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); |
| 358 const void* data = GetImmediateDataAs<const void*>(c); | 347 uint32 data_size = imageSize; |
| 348 const void* data = GetImmediateDataAs<const void*>( |
| 349 c, data_size, immediate_data_size); |
| 359 if (!ValidateGLenumTextureTarget(target)) { | 350 if (!ValidateGLenumTextureTarget(target)) { |
| 360 SetGLError(GL_INVALID_VALUE); | 351 SetGLError(GL_INVALID_VALUE); |
| 361 return parse_error::kParseNoError; | 352 return parse_error::kParseNoError; |
| 362 } | 353 } |
| 363 if (data == NULL) { | 354 if (data == NULL) { |
| 364 return parse_error::kParseOutOfBounds; | 355 return parse_error::kParseOutOfBounds; |
| 365 } | 356 } |
| 366 // Immediate version. | |
| 367 if (!ValidateGLenumTextureTarget(target)) { | |
| 368 SetGLError(GL_INVALID_VALUE); | |
| 369 return parse_error::kParseNoError; | |
| 370 } | |
| 371 if (data == NULL) { | |
| 372 return parse_error::kParseOutOfBounds; | |
| 373 } | |
| 374 glCompressedTexSubImage2D( | 357 glCompressedTexSubImage2D( |
| 375 target, level, xoffset, yoffset, width, height, format, imageSize, data); | 358 target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 376 return parse_error::kParseNoError; | 359 return parse_error::kParseNoError; |
| 377 } | 360 } |
| 378 | 361 |
| 379 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( | 362 parse_error::ParseError GLES2DecoderImpl::HandleCopyTexImage2D( |
| 380 uint32 immediate_data_size, const gles2::CopyTexImage2D& c) { | 363 uint32 immediate_data_size, const gles2::CopyTexImage2D& c) { |
| 381 GLenum target = static_cast<GLenum>(c.target); | 364 GLenum target = static_cast<GLenum>(c.target); |
| 382 GLint level = static_cast<GLint>(c.level); | 365 GLint level = static_cast<GLint>(c.level); |
| 383 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 366 GLenum internalformat = static_cast<GLenum>(c.internalformat); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 403 } |
| 421 | 404 |
| 422 parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( | 405 parse_error::ParseError GLES2DecoderImpl::HandleCreateShader( |
| 423 uint32 immediate_data_size, const gles2::CreateShader& c) { | 406 uint32 immediate_data_size, const gles2::CreateShader& c) { |
| 424 GLenum type = static_cast<GLenum>(c.type); | 407 GLenum type = static_cast<GLenum>(c.type); |
| 425 if (!ValidateGLenumShaderType(type)) { | 408 if (!ValidateGLenumShaderType(type)) { |
| 426 SetGLError(GL_INVALID_VALUE); | 409 SetGLError(GL_INVALID_VALUE); |
| 427 return parse_error::kParseNoError; | 410 return parse_error::kParseNoError; |
| 428 } | 411 } |
| 429 uint32 client_id = c.client_id; | 412 uint32 client_id = c.client_id; |
| 430 if (!ValidateGLenumShaderType(type)) { | |
| 431 SetGLError(GL_INVALID_VALUE); | |
| 432 return parse_error::kParseNoError; | |
| 433 } | |
| 434 CreateShaderHelper(type, client_id); | 413 CreateShaderHelper(type, client_id); |
| 435 return parse_error::kParseNoError; | 414 return parse_error::kParseNoError; |
| 436 } | 415 } |
| 437 | 416 |
| 438 parse_error::ParseError GLES2DecoderImpl::HandleCullFace( | 417 parse_error::ParseError GLES2DecoderImpl::HandleCullFace( |
| 439 uint32 immediate_data_size, const gles2::CullFace& c) { | 418 uint32 immediate_data_size, const gles2::CullFace& c) { |
| 440 GLenum mode = static_cast<GLenum>(c.mode); | 419 GLenum mode = static_cast<GLenum>(c.mode); |
| 441 if (!ValidateGLenumFaceType(mode)) { | 420 if (!ValidateGLenumFaceType(mode)) { |
| 442 SetGLError(GL_INVALID_VALUE); | 421 SetGLError(GL_INVALID_VALUE); |
| 443 return parse_error::kParseNoError; | 422 return parse_error::kParseNoError; |
| 444 } | 423 } |
| 445 glCullFace(mode); | 424 glCullFace(mode); |
| 446 return parse_error::kParseNoError; | 425 return parse_error::kParseNoError; |
| 447 } | 426 } |
| 448 | 427 |
| 449 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( | 428 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffers( |
| 450 uint32 immediate_data_size, const gles2::DeleteBuffers& c) { | 429 uint32 immediate_data_size, const gles2::DeleteBuffers& c) { |
| 451 GLsizei n = static_cast<GLsizei>(c.n); | 430 GLsizei n = static_cast<GLsizei>(c.n); |
| 431 uint32 data_size = n * sizeof(GLuint); |
| 452 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( | 432 const GLuint* buffers = GetSharedMemoryAs<const GLuint*>( |
| 453 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); | 433 c.buffers_shm_id, c.buffers_shm_offset, data_size); |
| 454 if (buffers == NULL) { | |
| 455 return parse_error::kParseOutOfBounds; | |
| 456 } | |
| 457 if (buffers == NULL) { | 434 if (buffers == NULL) { |
| 458 return parse_error::kParseOutOfBounds; | 435 return parse_error::kParseOutOfBounds; |
| 459 } | 436 } |
| 460 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); | 437 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); |
| 461 return parse_error::kParseNoError; | 438 return parse_error::kParseNoError; |
| 462 } | 439 } |
| 463 | 440 |
| 464 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( | 441 parse_error::ParseError GLES2DecoderImpl::HandleDeleteBuffersImmediate( |
| 465 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { | 442 uint32 immediate_data_size, const gles2::DeleteBuffersImmediate& c) { |
| 466 GLsizei n = static_cast<GLsizei>(c.n); | 443 GLsizei n = static_cast<GLsizei>(c.n); |
| 467 const GLuint* buffers = GetImmediateDataAs<const GLuint*>(c); | 444 uint32 data_size = n * sizeof(GLuint); |
| 468 if (buffers == NULL) { | 445 const GLuint* buffers = GetImmediateDataAs<const GLuint*>( |
| 469 return parse_error::kParseOutOfBounds; | 446 c, data_size, immediate_data_size); |
| 470 } | |
| 471 if (buffers == NULL) { | 447 if (buffers == NULL) { |
| 472 return parse_error::kParseOutOfBounds; | 448 return parse_error::kParseOutOfBounds; |
| 473 } | 449 } |
| 474 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); | 450 DeleteGLObjects<GLDeleteBuffersHelper>(n, buffers); |
| 475 return parse_error::kParseNoError; | 451 return parse_error::kParseNoError; |
| 476 } | 452 } |
| 477 | 453 |
| 478 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( | 454 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffers( |
| 479 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) { | 455 uint32 immediate_data_size, const gles2::DeleteFramebuffers& c) { |
| 480 GLsizei n = static_cast<GLsizei>(c.n); | 456 GLsizei n = static_cast<GLsizei>(c.n); |
| 457 uint32 data_size = n * sizeof(GLuint); |
| 481 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( | 458 const GLuint* framebuffers = GetSharedMemoryAs<const GLuint*>( |
| 482 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( | 459 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); |
| 483 gman): size */); | |
| 484 if (framebuffers == NULL) { | |
| 485 return parse_error::kParseOutOfBounds; | |
| 486 } | |
| 487 if (framebuffers == NULL) { | 460 if (framebuffers == NULL) { |
| 488 return parse_error::kParseOutOfBounds; | 461 return parse_error::kParseOutOfBounds; |
| 489 } | 462 } |
| 490 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); | 463 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); |
| 491 return parse_error::kParseNoError; | 464 return parse_error::kParseNoError; |
| 492 } | 465 } |
| 493 | 466 |
| 494 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( | 467 parse_error::ParseError GLES2DecoderImpl::HandleDeleteFramebuffersImmediate( |
| 495 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { | 468 uint32 immediate_data_size, const gles2::DeleteFramebuffersImmediate& c) { |
| 496 GLsizei n = static_cast<GLsizei>(c.n); | 469 GLsizei n = static_cast<GLsizei>(c.n); |
| 497 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>(c); | 470 uint32 data_size = n * sizeof(GLuint); |
| 498 if (framebuffers == NULL) { | 471 const GLuint* framebuffers = GetImmediateDataAs<const GLuint*>( |
| 499 return parse_error::kParseOutOfBounds; | 472 c, data_size, immediate_data_size); |
| 500 } | |
| 501 if (framebuffers == NULL) { | 473 if (framebuffers == NULL) { |
| 502 return parse_error::kParseOutOfBounds; | 474 return parse_error::kParseOutOfBounds; |
| 503 } | 475 } |
| 504 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); | 476 DeleteGLObjects<GLDeleteFramebuffersHelper>(n, framebuffers); |
| 505 return parse_error::kParseNoError; | 477 return parse_error::kParseNoError; |
| 506 } | 478 } |
| 507 | 479 |
| 508 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( | 480 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffers( |
| 509 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { | 481 uint32 immediate_data_size, const gles2::DeleteRenderbuffers& c) { |
| 510 GLsizei n = static_cast<GLsizei>(c.n); | 482 GLsizei n = static_cast<GLsizei>(c.n); |
| 483 uint32 data_size = n * sizeof(GLuint); |
| 511 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( | 484 const GLuint* renderbuffers = GetSharedMemoryAs<const GLuint*>( |
| 512 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( | 485 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); |
| 513 gman): size */); | |
| 514 if (renderbuffers == NULL) { | |
| 515 return parse_error::kParseOutOfBounds; | |
| 516 } | |
| 517 if (renderbuffers == NULL) { | 486 if (renderbuffers == NULL) { |
| 518 return parse_error::kParseOutOfBounds; | 487 return parse_error::kParseOutOfBounds; |
| 519 } | 488 } |
| 520 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); | 489 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); |
| 521 return parse_error::kParseNoError; | 490 return parse_error::kParseNoError; |
| 522 } | 491 } |
| 523 | 492 |
| 524 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( | 493 parse_error::ParseError GLES2DecoderImpl::HandleDeleteRenderbuffersImmediate( |
| 525 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { | 494 uint32 immediate_data_size, const gles2::DeleteRenderbuffersImmediate& c) { |
| 526 GLsizei n = static_cast<GLsizei>(c.n); | 495 GLsizei n = static_cast<GLsizei>(c.n); |
| 527 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>(c); | 496 uint32 data_size = n * sizeof(GLuint); |
| 528 if (renderbuffers == NULL) { | 497 const GLuint* renderbuffers = GetImmediateDataAs<const GLuint*>( |
| 529 return parse_error::kParseOutOfBounds; | 498 c, data_size, immediate_data_size); |
| 530 } | |
| 531 if (renderbuffers == NULL) { | 499 if (renderbuffers == NULL) { |
| 532 return parse_error::kParseOutOfBounds; | 500 return parse_error::kParseOutOfBounds; |
| 533 } | 501 } |
| 534 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); | 502 DeleteGLObjects<GLDeleteRenderbuffersHelper>(n, renderbuffers); |
| 535 return parse_error::kParseNoError; | 503 return parse_error::kParseNoError; |
| 536 } | 504 } |
| 537 | 505 |
| 538 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( | 506 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTextures( |
| 539 uint32 immediate_data_size, const gles2::DeleteTextures& c) { | 507 uint32 immediate_data_size, const gles2::DeleteTextures& c) { |
| 540 GLsizei n = static_cast<GLsizei>(c.n); | 508 GLsizei n = static_cast<GLsizei>(c.n); |
| 509 uint32 data_size = n * sizeof(GLuint); |
| 541 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( | 510 const GLuint* textures = GetSharedMemoryAs<const GLuint*>( |
| 542 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); | 511 c.textures_shm_id, c.textures_shm_offset, data_size); |
| 543 if (textures == NULL) { | |
| 544 return parse_error::kParseOutOfBounds; | |
| 545 } | |
| 546 if (textures == NULL) { | 512 if (textures == NULL) { |
| 547 return parse_error::kParseOutOfBounds; | 513 return parse_error::kParseOutOfBounds; |
| 548 } | 514 } |
| 549 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); | 515 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); |
| 550 return parse_error::kParseNoError; | 516 return parse_error::kParseNoError; |
| 551 } | 517 } |
| 552 | 518 |
| 553 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( | 519 parse_error::ParseError GLES2DecoderImpl::HandleDeleteTexturesImmediate( |
| 554 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { | 520 uint32 immediate_data_size, const gles2::DeleteTexturesImmediate& c) { |
| 555 GLsizei n = static_cast<GLsizei>(c.n); | 521 GLsizei n = static_cast<GLsizei>(c.n); |
| 556 const GLuint* textures = GetImmediateDataAs<const GLuint*>(c); | 522 uint32 data_size = n * sizeof(GLuint); |
| 557 if (textures == NULL) { | 523 const GLuint* textures = GetImmediateDataAs<const GLuint*>( |
| 558 return parse_error::kParseOutOfBounds; | 524 c, data_size, immediate_data_size); |
| 559 } | |
| 560 if (textures == NULL) { | 525 if (textures == NULL) { |
| 561 return parse_error::kParseOutOfBounds; | 526 return parse_error::kParseOutOfBounds; |
| 562 } | 527 } |
| 563 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); | 528 DeleteGLObjects<GLDeleteTexturesHelper>(n, textures); |
| 564 return parse_error::kParseNoError; | 529 return parse_error::kParseNoError; |
| 565 } | 530 } |
| 566 | 531 |
| 567 parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( | 532 parse_error::ParseError GLES2DecoderImpl::HandleDepthFunc( |
| 568 uint32 immediate_data_size, const gles2::DepthFunc& c) { | 533 uint32 immediate_data_size, const gles2::DepthFunc& c) { |
| 569 GLenum func = static_cast<GLenum>(c.func); | 534 GLenum func = static_cast<GLenum>(c.func); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 SetGLError(GL_INVALID_VALUE); | 578 SetGLError(GL_INVALID_VALUE); |
| 614 return parse_error::kParseNoError; | 579 return parse_error::kParseNoError; |
| 615 } | 580 } |
| 616 glDisable(cap); | 581 glDisable(cap); |
| 617 return parse_error::kParseNoError; | 582 return parse_error::kParseNoError; |
| 618 } | 583 } |
| 619 | 584 |
| 620 parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( | 585 parse_error::ParseError GLES2DecoderImpl::HandleDisableVertexAttribArray( |
| 621 uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) { | 586 uint32 immediate_data_size, const gles2::DisableVertexAttribArray& c) { |
| 622 GLuint index = static_cast<GLuint>(c.index); | 587 GLuint index = static_cast<GLuint>(c.index); |
| 623 glDisableVertexAttribArray(index); | 588 DoDisableVertexAttribArray(index); |
| 624 return parse_error::kParseNoError; | 589 return parse_error::kParseNoError; |
| 625 } | 590 } |
| 626 | 591 |
| 627 parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( | 592 parse_error::ParseError GLES2DecoderImpl::HandleDrawArrays( |
| 628 uint32 immediate_data_size, const gles2::DrawArrays& c) { | 593 uint32 immediate_data_size, const gles2::DrawArrays& c) { |
| 629 GLenum mode = static_cast<GLenum>(c.mode); | 594 GLenum mode = static_cast<GLenum>(c.mode); |
| 630 GLint first = static_cast<GLint>(c.first); | 595 GLint first = static_cast<GLint>(c.first); |
| 631 GLsizei count = static_cast<GLsizei>(c.count); | 596 GLsizei count = static_cast<GLsizei>(c.count); |
| 632 if (!ValidateGLenumDrawMode(mode)) { | 597 if (!ValidateGLenumDrawMode(mode)) { |
| 633 SetGLError(GL_INVALID_VALUE); | 598 SetGLError(GL_INVALID_VALUE); |
| 634 return parse_error::kParseNoError; | 599 return parse_error::kParseNoError; |
| 635 } | 600 } |
| 636 glDrawArrays(mode, first, count); | 601 DoDrawArrays(mode, first, count); |
| 637 return parse_error::kParseNoError; | 602 return parse_error::kParseNoError; |
| 638 } | 603 } |
| 639 | 604 |
| 640 parse_error::ParseError GLES2DecoderImpl::HandleEnable( | 605 parse_error::ParseError GLES2DecoderImpl::HandleEnable( |
| 641 uint32 immediate_data_size, const gles2::Enable& c) { | 606 uint32 immediate_data_size, const gles2::Enable& c) { |
| 642 GLenum cap = static_cast<GLenum>(c.cap); | 607 GLenum cap = static_cast<GLenum>(c.cap); |
| 643 if (!ValidateGLenumCapability(cap)) { | 608 if (!ValidateGLenumCapability(cap)) { |
| 644 SetGLError(GL_INVALID_VALUE); | 609 SetGLError(GL_INVALID_VALUE); |
| 645 return parse_error::kParseNoError; | 610 return parse_error::kParseNoError; |
| 646 } | 611 } |
| 647 glEnable(cap); | 612 glEnable(cap); |
| 648 return parse_error::kParseNoError; | 613 return parse_error::kParseNoError; |
| 649 } | 614 } |
| 650 | 615 |
| 651 parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( | 616 parse_error::ParseError GLES2DecoderImpl::HandleEnableVertexAttribArray( |
| 652 uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) { | 617 uint32 immediate_data_size, const gles2::EnableVertexAttribArray& c) { |
| 653 GLuint index = static_cast<GLuint>(c.index); | 618 GLuint index = static_cast<GLuint>(c.index); |
| 654 glEnableVertexAttribArray(index); | 619 DoEnableVertexAttribArray(index); |
| 655 return parse_error::kParseNoError; | 620 return parse_error::kParseNoError; |
| 656 } | 621 } |
| 657 | 622 |
| 658 parse_error::ParseError GLES2DecoderImpl::HandleFinish( | 623 parse_error::ParseError GLES2DecoderImpl::HandleFinish( |
| 659 uint32 immediate_data_size, const gles2::Finish& c) { | 624 uint32 immediate_data_size, const gles2::Finish& c) { |
| 660 glFinish(); | 625 glFinish(); |
| 661 return parse_error::kParseNoError; | 626 return parse_error::kParseNoError; |
| 662 } | 627 } |
| 663 | 628 |
| 664 parse_error::ParseError GLES2DecoderImpl::HandleFlush( | 629 parse_error::ParseError GLES2DecoderImpl::HandleFlush( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 SetGLError(GL_INVALID_VALUE); | 693 SetGLError(GL_INVALID_VALUE); |
| 729 return parse_error::kParseNoError; | 694 return parse_error::kParseNoError; |
| 730 } | 695 } |
| 731 glFrontFace(mode); | 696 glFrontFace(mode); |
| 732 return parse_error::kParseNoError; | 697 return parse_error::kParseNoError; |
| 733 } | 698 } |
| 734 | 699 |
| 735 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( | 700 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffers( |
| 736 uint32 immediate_data_size, const gles2::GenBuffers& c) { | 701 uint32 immediate_data_size, const gles2::GenBuffers& c) { |
| 737 GLsizei n = static_cast<GLsizei>(c.n); | 702 GLsizei n = static_cast<GLsizei>(c.n); |
| 703 uint32 data_size = n * sizeof(GLuint); |
| 738 GLuint* buffers = GetSharedMemoryAs<GLuint*>( | 704 GLuint* buffers = GetSharedMemoryAs<GLuint*>( |
| 739 c.buffers_shm_id, c.buffers_shm_offset, 0 /* TODO(gman): size */); | 705 c.buffers_shm_id, c.buffers_shm_offset, data_size); |
| 740 if (buffers == NULL) { | |
| 741 return parse_error::kParseOutOfBounds; | |
| 742 } | |
| 743 if (buffers == NULL) { | 706 if (buffers == NULL) { |
| 744 return parse_error::kParseOutOfBounds; | 707 return parse_error::kParseOutOfBounds; |
| 745 } | 708 } |
| 746 GenGLObjects<GLGenBuffersHelper>(n, buffers); | 709 GenGLObjects<GLGenBuffersHelper>(n, buffers); |
| 747 return parse_error::kParseNoError; | 710 return parse_error::kParseNoError; |
| 748 } | 711 } |
| 749 | 712 |
| 750 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( | 713 parse_error::ParseError GLES2DecoderImpl::HandleGenBuffersImmediate( |
| 751 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { | 714 uint32 immediate_data_size, const gles2::GenBuffersImmediate& c) { |
| 752 GLsizei n = static_cast<GLsizei>(c.n); | 715 GLsizei n = static_cast<GLsizei>(c.n); |
| 753 GLuint* buffers = GetImmediateDataAs<GLuint*>(c); | 716 uint32 data_size = n * sizeof(GLuint); |
| 754 if (buffers == NULL) { | 717 GLuint* buffers = GetImmediateDataAs<GLuint*>( |
| 755 return parse_error::kParseOutOfBounds; | 718 c, data_size, immediate_data_size); |
| 756 } | |
| 757 if (buffers == NULL) { | 719 if (buffers == NULL) { |
| 758 return parse_error::kParseOutOfBounds; | 720 return parse_error::kParseOutOfBounds; |
| 759 } | 721 } |
| 760 GenGLObjects<GLGenBuffersHelper>(n, buffers); | 722 GenGLObjects<GLGenBuffersHelper>(n, buffers); |
| 761 return parse_error::kParseNoError; | 723 return parse_error::kParseNoError; |
| 762 } | 724 } |
| 763 | 725 |
| 764 parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( | 726 parse_error::ParseError GLES2DecoderImpl::HandleGenerateMipmap( |
| 765 uint32 immediate_data_size, const gles2::GenerateMipmap& c) { | 727 uint32 immediate_data_size, const gles2::GenerateMipmap& c) { |
| 766 GLenum target = static_cast<GLenum>(c.target); | 728 GLenum target = static_cast<GLenum>(c.target); |
| 767 if (!ValidateGLenumTextureBindTarget(target)) { | 729 if (!ValidateGLenumTextureBindTarget(target)) { |
| 768 SetGLError(GL_INVALID_VALUE); | 730 SetGLError(GL_INVALID_VALUE); |
| 769 return parse_error::kParseNoError; | 731 return parse_error::kParseNoError; |
| 770 } | 732 } |
| 771 glGenerateMipmapEXT(target); | 733 glGenerateMipmapEXT(target); |
| 772 return parse_error::kParseNoError; | 734 return parse_error::kParseNoError; |
| 773 } | 735 } |
| 774 | 736 |
| 775 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( | 737 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffers( |
| 776 uint32 immediate_data_size, const gles2::GenFramebuffers& c) { | 738 uint32 immediate_data_size, const gles2::GenFramebuffers& c) { |
| 777 GLsizei n = static_cast<GLsizei>(c.n); | 739 GLsizei n = static_cast<GLsizei>(c.n); |
| 740 uint32 data_size = n * sizeof(GLuint); |
| 778 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( | 741 GLuint* framebuffers = GetSharedMemoryAs<GLuint*>( |
| 779 c.framebuffers_shm_id, c.framebuffers_shm_offset, 0 /* TODO( | 742 c.framebuffers_shm_id, c.framebuffers_shm_offset, data_size); |
| 780 gman): size */); | |
| 781 if (framebuffers == NULL) { | |
| 782 return parse_error::kParseOutOfBounds; | |
| 783 } | |
| 784 if (framebuffers == NULL) { | 743 if (framebuffers == NULL) { |
| 785 return parse_error::kParseOutOfBounds; | 744 return parse_error::kParseOutOfBounds; |
| 786 } | 745 } |
| 787 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); | 746 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); |
| 788 return parse_error::kParseNoError; | 747 return parse_error::kParseNoError; |
| 789 } | 748 } |
| 790 | 749 |
| 791 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( | 750 parse_error::ParseError GLES2DecoderImpl::HandleGenFramebuffersImmediate( |
| 792 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { | 751 uint32 immediate_data_size, const gles2::GenFramebuffersImmediate& c) { |
| 793 GLsizei n = static_cast<GLsizei>(c.n); | 752 GLsizei n = static_cast<GLsizei>(c.n); |
| 794 GLuint* framebuffers = GetImmediateDataAs<GLuint*>(c); | 753 uint32 data_size = n * sizeof(GLuint); |
| 795 if (framebuffers == NULL) { | 754 GLuint* framebuffers = GetImmediateDataAs<GLuint*>( |
| 796 return parse_error::kParseOutOfBounds; | 755 c, data_size, immediate_data_size); |
| 797 } | |
| 798 if (framebuffers == NULL) { | 756 if (framebuffers == NULL) { |
| 799 return parse_error::kParseOutOfBounds; | 757 return parse_error::kParseOutOfBounds; |
| 800 } | 758 } |
| 801 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); | 759 GenGLObjects<GLGenFramebuffersHelper>(n, framebuffers); |
| 802 return parse_error::kParseNoError; | 760 return parse_error::kParseNoError; |
| 803 } | 761 } |
| 804 | 762 |
| 805 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( | 763 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffers( |
| 806 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) { | 764 uint32 immediate_data_size, const gles2::GenRenderbuffers& c) { |
| 807 GLsizei n = static_cast<GLsizei>(c.n); | 765 GLsizei n = static_cast<GLsizei>(c.n); |
| 766 uint32 data_size = n * sizeof(GLuint); |
| 808 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( | 767 GLuint* renderbuffers = GetSharedMemoryAs<GLuint*>( |
| 809 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, 0 /* TODO( | 768 c.renderbuffers_shm_id, c.renderbuffers_shm_offset, data_size); |
| 810 gman): size */); | |
| 811 if (renderbuffers == NULL) { | |
| 812 return parse_error::kParseOutOfBounds; | |
| 813 } | |
| 814 if (renderbuffers == NULL) { | 769 if (renderbuffers == NULL) { |
| 815 return parse_error::kParseOutOfBounds; | 770 return parse_error::kParseOutOfBounds; |
| 816 } | 771 } |
| 817 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); | 772 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); |
| 818 return parse_error::kParseNoError; | 773 return parse_error::kParseNoError; |
| 819 } | 774 } |
| 820 | 775 |
| 821 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( | 776 parse_error::ParseError GLES2DecoderImpl::HandleGenRenderbuffersImmediate( |
| 822 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { | 777 uint32 immediate_data_size, const gles2::GenRenderbuffersImmediate& c) { |
| 823 GLsizei n = static_cast<GLsizei>(c.n); | 778 GLsizei n = static_cast<GLsizei>(c.n); |
| 824 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>(c); | 779 uint32 data_size = n * sizeof(GLuint); |
| 825 if (renderbuffers == NULL) { | 780 GLuint* renderbuffers = GetImmediateDataAs<GLuint*>( |
| 826 return parse_error::kParseOutOfBounds; | 781 c, data_size, immediate_data_size); |
| 827 } | |
| 828 if (renderbuffers == NULL) { | 782 if (renderbuffers == NULL) { |
| 829 return parse_error::kParseOutOfBounds; | 783 return parse_error::kParseOutOfBounds; |
| 830 } | 784 } |
| 831 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); | 785 GenGLObjects<GLGenRenderbuffersHelper>(n, renderbuffers); |
| 832 return parse_error::kParseNoError; | 786 return parse_error::kParseNoError; |
| 833 } | 787 } |
| 834 | 788 |
| 835 parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( | 789 parse_error::ParseError GLES2DecoderImpl::HandleGenTextures( |
| 836 uint32 immediate_data_size, const gles2::GenTextures& c) { | 790 uint32 immediate_data_size, const gles2::GenTextures& c) { |
| 837 GLsizei n = static_cast<GLsizei>(c.n); | 791 GLsizei n = static_cast<GLsizei>(c.n); |
| 792 uint32 data_size = n * sizeof(GLuint); |
| 838 GLuint* textures = GetSharedMemoryAs<GLuint*>( | 793 GLuint* textures = GetSharedMemoryAs<GLuint*>( |
| 839 c.textures_shm_id, c.textures_shm_offset, 0 /* TODO(gman): size */); | 794 c.textures_shm_id, c.textures_shm_offset, data_size); |
| 840 if (textures == NULL) { | |
| 841 return parse_error::kParseOutOfBounds; | |
| 842 } | |
| 843 if (textures == NULL) { | 795 if (textures == NULL) { |
| 844 return parse_error::kParseOutOfBounds; | 796 return parse_error::kParseOutOfBounds; |
| 845 } | 797 } |
| 846 GenGLObjects<GLGenTexturesHelper>(n, textures); | 798 GenGLObjects<GLGenTexturesHelper>(n, textures); |
| 847 return parse_error::kParseNoError; | 799 return parse_error::kParseNoError; |
| 848 } | 800 } |
| 849 | 801 |
| 850 parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( | 802 parse_error::ParseError GLES2DecoderImpl::HandleGenTexturesImmediate( |
| 851 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { | 803 uint32 immediate_data_size, const gles2::GenTexturesImmediate& c) { |
| 852 GLsizei n = static_cast<GLsizei>(c.n); | 804 GLsizei n = static_cast<GLsizei>(c.n); |
| 853 GLuint* textures = GetImmediateDataAs<GLuint*>(c); | 805 uint32 data_size = n * sizeof(GLuint); |
| 854 if (textures == NULL) { | 806 GLuint* textures = GetImmediateDataAs<GLuint*>( |
| 855 return parse_error::kParseOutOfBounds; | 807 c, data_size, immediate_data_size); |
| 856 } | |
| 857 if (textures == NULL) { | 808 if (textures == NULL) { |
| 858 return parse_error::kParseOutOfBounds; | 809 return parse_error::kParseOutOfBounds; |
| 859 } | 810 } |
| 860 GenGLObjects<GLGenTexturesHelper>(n, textures); | 811 GenGLObjects<GLGenTexturesHelper>(n, textures); |
| 861 return parse_error::kParseNoError; | 812 return parse_error::kParseNoError; |
| 862 } | 813 } |
| 863 | 814 |
| 864 parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( | 815 parse_error::ParseError GLES2DecoderImpl::HandleGetBooleanv( |
| 865 uint32 immediate_data_size, const gles2::GetBooleanv& c) { | 816 uint32 immediate_data_size, const gles2::GetBooleanv& c) { |
| 866 GLenum pname = static_cast<GLenum>(c.pname); | 817 GLenum pname = static_cast<GLenum>(c.pname); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 } | 945 } |
| 995 | 946 |
| 996 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( | 947 parse_error::ParseError GLES2DecoderImpl::HandleGetProgramInfoLog( |
| 997 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { | 948 uint32 immediate_data_size, const gles2::GetProgramInfoLog& c) { |
| 998 GLuint program; | 949 GLuint program; |
| 999 if (!id_map_.GetServiceId(c.program, &program)) { | 950 if (!id_map_.GetServiceId(c.program, &program)) { |
| 1000 SetGLError(GL_INVALID_VALUE); | 951 SetGLError(GL_INVALID_VALUE); |
| 1001 return parse_error::kParseNoError; | 952 return parse_error::kParseNoError; |
| 1002 } | 953 } |
| 1003 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); | 954 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); |
| 1004 GLsizei* length = GetSharedMemoryAs<GLsizei*>( | 955 uint32 size_shm_id = c.length_shm_id; |
| 1005 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); | 956 uint32 size_shm_offset = c.length_shm_offset; |
| 957 GLsizei* length = NULL; |
| 958 if (size_shm_id != 0 || size_shm_offset != 0) { |
| 959 length = GetSharedMemoryAs<GLsizei*>( |
| 960 size_shm_id, size_shm_offset, sizeof(*length)); |
| 961 if (!length) { |
| 962 return parse_error::kParseOutOfBounds; |
| 963 } |
| 964 } |
| 1006 char* infolog = GetSharedMemoryAs<char*>( | 965 char* infolog = GetSharedMemoryAs<char*>( |
| 1007 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); | 966 c.infolog_shm_id, c.infolog_shm_offset, bufsize); |
| 1008 if (length == NULL) { | |
| 1009 return parse_error::kParseOutOfBounds; | |
| 1010 } | |
| 1011 if (infolog == NULL) { | 967 if (infolog == NULL) { |
| 1012 return parse_error::kParseOutOfBounds; | 968 return parse_error::kParseOutOfBounds; |
| 1013 } | 969 } |
| 1014 glGetProgramInfoLog(program, bufsize, length, infolog); | 970 glGetProgramInfoLog(program, bufsize, length, infolog); |
| 1015 return parse_error::kParseNoError; | 971 return parse_error::kParseNoError; |
| 1016 } | 972 } |
| 1017 | 973 |
| 1018 parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( | 974 parse_error::ParseError GLES2DecoderImpl::HandleGetRenderbufferParameteriv( |
| 1019 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) { | 975 uint32 immediate_data_size, const gles2::GetRenderbufferParameteriv& c) { |
| 1020 GLenum target = static_cast<GLenum>(c.target); | 976 GLenum target = static_cast<GLenum>(c.target); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 } | 1020 } |
| 1065 | 1021 |
| 1066 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( | 1022 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderInfoLog( |
| 1067 uint32 immediate_data_size, const gles2::GetShaderInfoLog& c) { | 1023 uint32 immediate_data_size, const gles2::GetShaderInfoLog& c) { |
| 1068 GLuint shader; | 1024 GLuint shader; |
| 1069 if (!id_map_.GetServiceId(c.shader, &shader)) { | 1025 if (!id_map_.GetServiceId(c.shader, &shader)) { |
| 1070 SetGLError(GL_INVALID_VALUE); | 1026 SetGLError(GL_INVALID_VALUE); |
| 1071 return parse_error::kParseNoError; | 1027 return parse_error::kParseNoError; |
| 1072 } | 1028 } |
| 1073 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); | 1029 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); |
| 1074 GLsizei* length = GetSharedMemoryAs<GLsizei*>( | 1030 uint32 size_shm_id = c.length_shm_id; |
| 1075 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); | 1031 uint32 size_shm_offset = c.length_shm_offset; |
| 1032 GLsizei* length = NULL; |
| 1033 if (size_shm_id != 0 || size_shm_offset != 0) { |
| 1034 length = GetSharedMemoryAs<GLsizei*>( |
| 1035 size_shm_id, size_shm_offset, sizeof(*length)); |
| 1036 if (!length) { |
| 1037 return parse_error::kParseOutOfBounds; |
| 1038 } |
| 1039 } |
| 1076 char* infolog = GetSharedMemoryAs<char*>( | 1040 char* infolog = GetSharedMemoryAs<char*>( |
| 1077 c.infolog_shm_id, c.infolog_shm_offset, 0 /* TODO(gman): size */); | 1041 c.infolog_shm_id, c.infolog_shm_offset, bufsize); |
| 1078 if (length == NULL) { | |
| 1079 return parse_error::kParseOutOfBounds; | |
| 1080 } | |
| 1081 if (infolog == NULL) { | 1042 if (infolog == NULL) { |
| 1082 return parse_error::kParseOutOfBounds; | 1043 return parse_error::kParseOutOfBounds; |
| 1083 } | 1044 } |
| 1084 glGetShaderInfoLog(shader, bufsize, length, infolog); | 1045 glGetShaderInfoLog(shader, bufsize, length, infolog); |
| 1085 return parse_error::kParseNoError; | 1046 return parse_error::kParseNoError; |
| 1086 } | 1047 } |
| 1087 | 1048 |
| 1088 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( | 1049 parse_error::ParseError GLES2DecoderImpl::HandleGetShaderSource( |
| 1089 uint32 immediate_data_size, const gles2::GetShaderSource& c) { | 1050 uint32 immediate_data_size, const gles2::GetShaderSource& c) { |
| 1090 GLuint shader; | 1051 GLuint shader; |
| 1091 if (!id_map_.GetServiceId(c.shader, &shader)) { | 1052 if (!id_map_.GetServiceId(c.shader, &shader)) { |
| 1092 SetGLError(GL_INVALID_VALUE); | 1053 SetGLError(GL_INVALID_VALUE); |
| 1093 return parse_error::kParseNoError; | 1054 return parse_error::kParseNoError; |
| 1094 } | 1055 } |
| 1095 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); | 1056 GLsizei bufsize = static_cast<GLsizei>(c.bufsize); |
| 1096 GLsizei* length = GetSharedMemoryAs<GLsizei*>( | 1057 uint32 size_shm_id = c.length_shm_id; |
| 1097 c.length_shm_id, c.length_shm_offset, 0 /* TODO(gman): size */); | 1058 uint32 size_shm_offset = c.length_shm_offset; |
| 1059 GLsizei* length = NULL; |
| 1060 if (size_shm_id != 0 || size_shm_offset != 0) { |
| 1061 length = GetSharedMemoryAs<GLsizei*>( |
| 1062 size_shm_id, size_shm_offset, sizeof(*length)); |
| 1063 if (!length) { |
| 1064 return parse_error::kParseOutOfBounds; |
| 1065 } |
| 1066 } |
| 1098 char* source = GetSharedMemoryAs<char*>( | 1067 char* source = GetSharedMemoryAs<char*>( |
| 1099 c.source_shm_id, c.source_shm_offset, 0 /* TODO(gman): size */); | 1068 c.source_shm_id, c.source_shm_offset, bufsize); |
| 1100 if (length == NULL) { | |
| 1101 return parse_error::kParseOutOfBounds; | |
| 1102 } | |
| 1103 if (source == NULL) { | 1069 if (source == NULL) { |
| 1104 return parse_error::kParseOutOfBounds; | 1070 return parse_error::kParseOutOfBounds; |
| 1105 } | 1071 } |
| 1106 glGetShaderSource(shader, bufsize, length, source); | 1072 glGetShaderSource(shader, bufsize, length, source); |
| 1107 return parse_error::kParseNoError; | 1073 return parse_error::kParseNoError; |
| 1108 } | 1074 } |
| 1109 | 1075 |
| 1110 parse_error::ParseError GLES2DecoderImpl::HandleGetString( | 1076 parse_error::ParseError GLES2DecoderImpl::HandleGetString( |
| 1111 uint32 immediate_data_size, const gles2::GetString& c) { | 1077 uint32 immediate_data_size, const gles2::GetString& c) { |
| 1112 GLenum name = static_cast<GLenum>(c.name); | 1078 GLenum name = static_cast<GLenum>(c.name); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 return parse_error::kParseNoError; | 1286 return parse_error::kParseNoError; |
| 1321 } | 1287 } |
| 1322 | 1288 |
| 1323 parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( | 1289 parse_error::ParseError GLES2DecoderImpl::HandleLinkProgram( |
| 1324 uint32 immediate_data_size, const gles2::LinkProgram& c) { | 1290 uint32 immediate_data_size, const gles2::LinkProgram& c) { |
| 1325 GLuint program; | 1291 GLuint program; |
| 1326 if (!id_map_.GetServiceId(c.program, &program)) { | 1292 if (!id_map_.GetServiceId(c.program, &program)) { |
| 1327 SetGLError(GL_INVALID_VALUE); | 1293 SetGLError(GL_INVALID_VALUE); |
| 1328 return parse_error::kParseNoError; | 1294 return parse_error::kParseNoError; |
| 1329 } | 1295 } |
| 1330 glLinkProgram(program); | 1296 DoLinkProgram(program); |
| 1331 return parse_error::kParseNoError; | 1297 return parse_error::kParseNoError; |
| 1332 } | 1298 } |
| 1333 | 1299 |
| 1334 parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( | 1300 parse_error::ParseError GLES2DecoderImpl::HandlePolygonOffset( |
| 1335 uint32 immediate_data_size, const gles2::PolygonOffset& c) { | 1301 uint32 immediate_data_size, const gles2::PolygonOffset& c) { |
| 1336 GLfloat factor = static_cast<GLfloat>(c.factor); | 1302 GLfloat factor = static_cast<GLfloat>(c.factor); |
| 1337 GLfloat units = static_cast<GLfloat>(c.units); | 1303 GLfloat units = static_cast<GLfloat>(c.units); |
| 1338 glPolygonOffset(factor, units); | 1304 glPolygonOffset(factor, units); |
| 1339 return parse_error::kParseNoError; | 1305 return parse_error::kParseNoError; |
| 1340 } | 1306 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 return parse_error::kParseNoError; | 1452 return parse_error::kParseNoError; |
| 1487 } | 1453 } |
| 1488 glTexParameterf(target, pname, param); | 1454 glTexParameterf(target, pname, param); |
| 1489 return parse_error::kParseNoError; | 1455 return parse_error::kParseNoError; |
| 1490 } | 1456 } |
| 1491 | 1457 |
| 1492 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( | 1458 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfv( |
| 1493 uint32 immediate_data_size, const gles2::TexParameterfv& c) { | 1459 uint32 immediate_data_size, const gles2::TexParameterfv& c) { |
| 1494 GLenum target = static_cast<GLenum>(c.target); | 1460 GLenum target = static_cast<GLenum>(c.target); |
| 1495 GLenum pname = static_cast<GLenum>(c.pname); | 1461 GLenum pname = static_cast<GLenum>(c.pname); |
| 1462 uint32 data_size = |
| 1463 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 1496 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( | 1464 const GLfloat* params = GetSharedMemoryAs<const GLfloat*>( |
| 1497 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); | 1465 c.params_shm_id, c.params_shm_offset, data_size); |
| 1498 if (!ValidateGLenumTextureBindTarget(target)) { | 1466 if (!ValidateGLenumTextureBindTarget(target)) { |
| 1499 SetGLError(GL_INVALID_VALUE); | 1467 SetGLError(GL_INVALID_VALUE); |
| 1500 return parse_error::kParseNoError; | 1468 return parse_error::kParseNoError; |
| 1501 } | 1469 } |
| 1502 if (!ValidateGLenumTextureParameter(pname)) { | 1470 if (!ValidateGLenumTextureParameter(pname)) { |
| 1503 SetGLError(GL_INVALID_VALUE); | 1471 SetGLError(GL_INVALID_VALUE); |
| 1504 return parse_error::kParseNoError; | 1472 return parse_error::kParseNoError; |
| 1505 } | 1473 } |
| 1506 if (params == NULL) { | 1474 if (params == NULL) { |
| 1507 return parse_error::kParseOutOfBounds; | 1475 return parse_error::kParseOutOfBounds; |
| 1508 } | 1476 } |
| 1509 glTexParameterfv(target, pname, params); | 1477 glTexParameterfv(target, pname, params); |
| 1510 return parse_error::kParseNoError; | 1478 return parse_error::kParseNoError; |
| 1511 } | 1479 } |
| 1512 | 1480 |
| 1513 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( | 1481 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterfvImmediate( |
| 1514 uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) { | 1482 uint32 immediate_data_size, const gles2::TexParameterfvImmediate& c) { |
| 1515 GLenum target = static_cast<GLenum>(c.target); | 1483 GLenum target = static_cast<GLenum>(c.target); |
| 1516 GLenum pname = static_cast<GLenum>(c.pname); | 1484 GLenum pname = static_cast<GLenum>(c.pname); |
| 1517 const GLfloat* params = GetImmediateDataAs<const GLfloat*>(c); | 1485 uint32 data_size = |
| 1486 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 1487 const GLfloat* params = GetImmediateDataAs<const GLfloat*>( |
| 1488 c, data_size, immediate_data_size); |
| 1518 if (!ValidateGLenumTextureBindTarget(target)) { | 1489 if (!ValidateGLenumTextureBindTarget(target)) { |
| 1519 SetGLError(GL_INVALID_VALUE); | 1490 SetGLError(GL_INVALID_VALUE); |
| 1520 return parse_error::kParseNoError; | 1491 return parse_error::kParseNoError; |
| 1521 } | 1492 } |
| 1522 if (!ValidateGLenumTextureParameter(pname)) { | 1493 if (!ValidateGLenumTextureParameter(pname)) { |
| 1523 SetGLError(GL_INVALID_VALUE); | 1494 SetGLError(GL_INVALID_VALUE); |
| 1524 return parse_error::kParseNoError; | 1495 return parse_error::kParseNoError; |
| 1525 } | 1496 } |
| 1526 if (params == NULL) { | 1497 if (params == NULL) { |
| 1527 return parse_error::kParseOutOfBounds; | 1498 return parse_error::kParseOutOfBounds; |
| 1528 } | 1499 } |
| 1529 if (!CheckImmediateDataSize<TexParameterfvImmediate>( | |
| 1530 immediate_data_size, 1, sizeof(GLfloat), 1)) { | |
| 1531 return parse_error::kParseOutOfBounds; | |
| 1532 } | |
| 1533 // Immediate version. | |
| 1534 if (!ValidateGLenumTextureBindTarget(target)) { | |
| 1535 SetGLError(GL_INVALID_VALUE); | |
| 1536 return parse_error::kParseNoError; | |
| 1537 } | |
| 1538 if (!ValidateGLenumTextureParameter(pname)) { | |
| 1539 SetGLError(GL_INVALID_VALUE); | |
| 1540 return parse_error::kParseNoError; | |
| 1541 } | |
| 1542 if (params == NULL) { | |
| 1543 return parse_error::kParseOutOfBounds; | |
| 1544 } | |
| 1545 if (!CheckImmediateDataSize<TexParameterfvImmediate>( | |
| 1546 immediate_data_size, 1, sizeof(GLfloat), 1)) { | |
| 1547 return parse_error::kParseOutOfBounds; | |
| 1548 } | |
| 1549 glTexParameterfv(target, pname, params); | 1500 glTexParameterfv(target, pname, params); |
| 1550 return parse_error::kParseNoError; | 1501 return parse_error::kParseNoError; |
| 1551 } | 1502 } |
| 1552 | 1503 |
| 1553 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( | 1504 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteri( |
| 1554 uint32 immediate_data_size, const gles2::TexParameteri& c) { | 1505 uint32 immediate_data_size, const gles2::TexParameteri& c) { |
| 1555 GLenum target = static_cast<GLenum>(c.target); | 1506 GLenum target = static_cast<GLenum>(c.target); |
| 1556 GLenum pname = static_cast<GLenum>(c.pname); | 1507 GLenum pname = static_cast<GLenum>(c.pname); |
| 1557 GLint param = static_cast<GLint>(c.param); | 1508 GLint param = static_cast<GLint>(c.param); |
| 1558 if (!ValidateGLenumTextureBindTarget(target)) { | 1509 if (!ValidateGLenumTextureBindTarget(target)) { |
| 1559 SetGLError(GL_INVALID_VALUE); | 1510 SetGLError(GL_INVALID_VALUE); |
| 1560 return parse_error::kParseNoError; | 1511 return parse_error::kParseNoError; |
| 1561 } | 1512 } |
| 1562 if (!ValidateGLenumTextureParameter(pname)) { | 1513 if (!ValidateGLenumTextureParameter(pname)) { |
| 1563 SetGLError(GL_INVALID_VALUE); | 1514 SetGLError(GL_INVALID_VALUE); |
| 1564 return parse_error::kParseNoError; | 1515 return parse_error::kParseNoError; |
| 1565 } | 1516 } |
| 1566 glTexParameteri(target, pname, param); | 1517 glTexParameteri(target, pname, param); |
| 1567 return parse_error::kParseNoError; | 1518 return parse_error::kParseNoError; |
| 1568 } | 1519 } |
| 1569 | 1520 |
| 1570 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( | 1521 parse_error::ParseError GLES2DecoderImpl::HandleTexParameteriv( |
| 1571 uint32 immediate_data_size, const gles2::TexParameteriv& c) { | 1522 uint32 immediate_data_size, const gles2::TexParameteriv& c) { |
| 1572 GLenum target = static_cast<GLenum>(c.target); | 1523 GLenum target = static_cast<GLenum>(c.target); |
| 1573 GLenum pname = static_cast<GLenum>(c.pname); | 1524 GLenum pname = static_cast<GLenum>(c.pname); |
| 1525 uint32 data_size = |
| 1526 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1); |
| 1574 const GLint* params = GetSharedMemoryAs<const GLint*>( | 1527 const GLint* params = GetSharedMemoryAs<const GLint*>( |
| 1575 c.params_shm_id, c.params_shm_offset, 0 /* TODO(gman): size */); | 1528 c.params_shm_id, c.params_shm_offset, data_size); |
| 1576 if (!ValidateGLenumTextureBindTarget(target)) { | 1529 if (!ValidateGLenumTextureBindTarget(target)) { |
| 1577 SetGLError(GL_INVALID_VALUE); | 1530 SetGLError(GL_INVALID_VALUE); |
| 1578 return parse_error::kParseNoError; | 1531 return parse_error::kParseNoError; |
| 1579 } | 1532 } |
| 1580 if (!ValidateGLenumTextureParameter(pname)) { | 1533 if (!ValidateGLenumTextureParameter(pname)) { |
| 1581 SetGLError(GL_INVALID_VALUE); | 1534 SetGLError(GL_INVALID_VALUE); |
| 1582 return parse_error::kParseNoError; | 1535 return parse_error::kParseNoError; |
| 1583 } | 1536 } |
| 1584 if (params == NULL) { | 1537 if (params == NULL) { |
| 1585 return parse_error::kParseOutOfBounds; | 1538 return parse_error::kParseOutOfBounds; |
| 1586 } | 1539 } |
| 1587 glTexParameteriv(target, pname, params); | 1540 glTexParameteriv(target, pname, params); |
| 1588 return parse_error::kParseNoError; | 1541 return parse_error::kParseNoError; |
| 1589 } | 1542 } |
| 1590 | 1543 |
| 1591 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( | 1544 parse_error::ParseError GLES2DecoderImpl::HandleTexParameterivImmediate( |
| 1592 uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) { | 1545 uint32 immediate_data_size, const gles2::TexParameterivImmediate& c) { |
| 1593 GLenum target = static_cast<GLenum>(c.target); | 1546 GLenum target = static_cast<GLenum>(c.target); |
| 1594 GLenum pname = static_cast<GLenum>(c.pname); | 1547 GLenum pname = static_cast<GLenum>(c.pname); |
| 1595 const GLint* params = GetImmediateDataAs<const GLint*>(c); | 1548 uint32 data_size = |
| 1549 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1); |
| 1550 const GLint* params = GetImmediateDataAs<const GLint*>( |
| 1551 c, data_size, immediate_data_size); |
| 1596 if (!ValidateGLenumTextureBindTarget(target)) { | 1552 if (!ValidateGLenumTextureBindTarget(target)) { |
| 1597 SetGLError(GL_INVALID_VALUE); | 1553 SetGLError(GL_INVALID_VALUE); |
| 1598 return parse_error::kParseNoError; | 1554 return parse_error::kParseNoError; |
| 1599 } | 1555 } |
| 1600 if (!ValidateGLenumTextureParameter(pname)) { | 1556 if (!ValidateGLenumTextureParameter(pname)) { |
| 1601 SetGLError(GL_INVALID_VALUE); | 1557 SetGLError(GL_INVALID_VALUE); |
| 1602 return parse_error::kParseNoError; | 1558 return parse_error::kParseNoError; |
| 1603 } | 1559 } |
| 1604 if (params == NULL) { | 1560 if (params == NULL) { |
| 1605 return parse_error::kParseOutOfBounds; | 1561 return parse_error::kParseOutOfBounds; |
| 1606 } | 1562 } |
| 1607 if (!CheckImmediateDataSize<TexParameterivImmediate>( | |
| 1608 immediate_data_size, 1, sizeof(GLint), 1)) { | |
| 1609 return parse_error::kParseOutOfBounds; | |
| 1610 } | |
| 1611 // Immediate version. | |
| 1612 if (!ValidateGLenumTextureBindTarget(target)) { | |
| 1613 SetGLError(GL_INVALID_VALUE); | |
| 1614 return parse_error::kParseNoError; | |
| 1615 } | |
| 1616 if (!ValidateGLenumTextureParameter(pname)) { | |
| 1617 SetGLError(GL_INVALID_VALUE); | |
| 1618 return parse_error::kParseNoError; | |
| 1619 } | |
| 1620 if (params == NULL) { | |
| 1621 return parse_error::kParseOutOfBounds; | |
| 1622 } | |
| 1623 if (!CheckImmediateDataSize<TexParameterivImmediate>( | |
| 1624 immediate_data_size, 1, sizeof(GLint), 1)) { | |
| 1625 return parse_error::kParseOutOfBounds; | |
| 1626 } | |
| 1627 glTexParameteriv(target, pname, params); | 1563 glTexParameteriv(target, pname, params); |
| 1628 return parse_error::kParseNoError; | 1564 return parse_error::kParseNoError; |
| 1629 } | 1565 } |
| 1630 | 1566 |
| 1631 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( | 1567 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2D( |
| 1632 uint32 immediate_data_size, const gles2::TexSubImage2D& c) { | 1568 uint32 immediate_data_size, const gles2::TexSubImage2D& c) { |
| 1633 GLenum target = static_cast<GLenum>(c.target); | 1569 GLenum target = static_cast<GLenum>(c.target); |
| 1634 GLint level = static_cast<GLint>(c.level); | 1570 GLint level = static_cast<GLint>(c.level); |
| 1635 GLint xoffset = static_cast<GLint>(c.xoffset); | 1571 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 1636 GLint yoffset = static_cast<GLint>(c.yoffset); | 1572 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 1637 GLsizei width = static_cast<GLsizei>(c.width); | 1573 GLsizei width = static_cast<GLsizei>(c.width); |
| 1638 GLsizei height = static_cast<GLsizei>(c.height); | 1574 GLsizei height = static_cast<GLsizei>(c.height); |
| 1639 GLenum format = static_cast<GLenum>(c.format); | 1575 GLenum format = static_cast<GLenum>(c.format); |
| 1640 GLenum type = static_cast<GLenum>(c.type); | 1576 GLenum type = static_cast<GLenum>(c.type); |
| 1641 uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id); | 1577 uint32 data_size = GLES2Util::ComputeImageDataSize( |
| 1642 uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset); | |
| 1643 uint32 pixels_size = GLES2Util::ComputeImageDataSize( | |
| 1644 width, height, format, type, unpack_alignment_); | 1578 width, height, format, type, unpack_alignment_); |
| 1645 const void* pixels = GetSharedMemoryAs<const void*>( | 1579 const void* pixels = GetSharedMemoryAs<const void*>( |
| 1646 pixels_shm_id, pixels_shm_offset, pixels_size); | 1580 c.pixels_shm_id, c.pixels_shm_offset, data_size); |
| 1647 if (!ValidateGLenumTextureTarget(target)) { | 1581 if (!ValidateGLenumTextureTarget(target)) { |
| 1648 SetGLError(GL_INVALID_VALUE); | 1582 SetGLError(GL_INVALID_VALUE); |
| 1649 return parse_error::kParseNoError; | 1583 return parse_error::kParseNoError; |
| 1650 } | 1584 } |
| 1651 if (!ValidateGLenumTextureFormat(format)) { | 1585 if (!ValidateGLenumTextureFormat(format)) { |
| 1652 SetGLError(GL_INVALID_VALUE); | 1586 SetGLError(GL_INVALID_VALUE); |
| 1653 return parse_error::kParseNoError; | 1587 return parse_error::kParseNoError; |
| 1654 } | 1588 } |
| 1655 if (!ValidateGLenumPixelType(type)) { | 1589 if (!ValidateGLenumPixelType(type)) { |
| 1656 SetGLError(GL_INVALID_VALUE); | 1590 SetGLError(GL_INVALID_VALUE); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1667 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( | 1601 parse_error::ParseError GLES2DecoderImpl::HandleTexSubImage2DImmediate( |
| 1668 uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) { | 1602 uint32 immediate_data_size, const gles2::TexSubImage2DImmediate& c) { |
| 1669 GLenum target = static_cast<GLenum>(c.target); | 1603 GLenum target = static_cast<GLenum>(c.target); |
| 1670 GLint level = static_cast<GLint>(c.level); | 1604 GLint level = static_cast<GLint>(c.level); |
| 1671 GLint xoffset = static_cast<GLint>(c.xoffset); | 1605 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 1672 GLint yoffset = static_cast<GLint>(c.yoffset); | 1606 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 1673 GLsizei width = static_cast<GLsizei>(c.width); | 1607 GLsizei width = static_cast<GLsizei>(c.width); |
| 1674 GLsizei height = static_cast<GLsizei>(c.height); | 1608 GLsizei height = static_cast<GLsizei>(c.height); |
| 1675 GLenum format = static_cast<GLenum>(c.format); | 1609 GLenum format = static_cast<GLenum>(c.format); |
| 1676 GLenum type = static_cast<GLenum>(c.type); | 1610 GLenum type = static_cast<GLenum>(c.type); |
| 1677 const void* pixels = GetImmediateDataAs<const void*>(c); | 1611 uint32 data_size = GLES2Util::ComputeImageDataSize( |
| 1612 width, height, format, type, unpack_alignment_); |
| 1613 const void* pixels = GetImmediateDataAs<const void*>( |
| 1614 c, data_size, immediate_data_size); |
| 1678 if (!ValidateGLenumTextureTarget(target)) { | 1615 if (!ValidateGLenumTextureTarget(target)) { |
| 1679 SetGLError(GL_INVALID_VALUE); | 1616 SetGLError(GL_INVALID_VALUE); |
| 1680 return parse_error::kParseNoError; | 1617 return parse_error::kParseNoError; |
| 1681 } | 1618 } |
| 1682 if (!ValidateGLenumTextureFormat(format)) { | 1619 if (!ValidateGLenumTextureFormat(format)) { |
| 1683 SetGLError(GL_INVALID_VALUE); | 1620 SetGLError(GL_INVALID_VALUE); |
| 1684 return parse_error::kParseNoError; | 1621 return parse_error::kParseNoError; |
| 1685 } | 1622 } |
| 1686 if (!ValidateGLenumPixelType(type)) { | 1623 if (!ValidateGLenumPixelType(type)) { |
| 1687 SetGLError(GL_INVALID_VALUE); | 1624 SetGLError(GL_INVALID_VALUE); |
| 1688 return parse_error::kParseNoError; | 1625 return parse_error::kParseNoError; |
| 1689 } | 1626 } |
| 1690 if (pixels == NULL) { | 1627 if (pixels == NULL) { |
| 1691 return parse_error::kParseOutOfBounds; | 1628 return parse_error::kParseOutOfBounds; |
| 1692 } | 1629 } |
| 1693 // Immediate version. | |
| 1694 if (!ValidateGLenumTextureTarget(target)) { | |
| 1695 SetGLError(GL_INVALID_VALUE); | |
| 1696 return parse_error::kParseNoError; | |
| 1697 } | |
| 1698 if (!ValidateGLenumTextureFormat(format)) { | |
| 1699 SetGLError(GL_INVALID_VALUE); | |
| 1700 return parse_error::kParseNoError; | |
| 1701 } | |
| 1702 if (!ValidateGLenumPixelType(type)) { | |
| 1703 SetGLError(GL_INVALID_VALUE); | |
| 1704 return parse_error::kParseNoError; | |
| 1705 } | |
| 1706 if (pixels == NULL) { | |
| 1707 return parse_error::kParseOutOfBounds; | |
| 1708 } | |
| 1709 glTexSubImage2D( | 1630 glTexSubImage2D( |
| 1710 target, level, xoffset, yoffset, width, height, format, type, pixels); | 1631 target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 1711 return parse_error::kParseNoError; | 1632 return parse_error::kParseNoError; |
| 1712 } | 1633 } |
| 1713 | 1634 |
| 1714 parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( | 1635 parse_error::ParseError GLES2DecoderImpl::HandleUniform1f( |
| 1715 uint32 immediate_data_size, const gles2::Uniform1f& c) { | 1636 uint32 immediate_data_size, const gles2::Uniform1f& c) { |
| 1716 GLint location = static_cast<GLint>(c.location); | 1637 GLint location = static_cast<GLint>(c.location); |
| 1717 GLfloat x = static_cast<GLfloat>(c.x); | 1638 GLfloat x = static_cast<GLfloat>(c.x); |
| 1718 glUniform1f(location, x); | 1639 glUniform1f(location, x); |
| 1719 return parse_error::kParseNoError; | 1640 return parse_error::kParseNoError; |
| 1720 } | 1641 } |
| 1721 | 1642 |
| 1722 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( | 1643 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fv( |
| 1723 uint32 immediate_data_size, const gles2::Uniform1fv& c) { | 1644 uint32 immediate_data_size, const gles2::Uniform1fv& c) { |
| 1724 GLint location = static_cast<GLint>(c.location); | 1645 GLint location = static_cast<GLint>(c.location); |
| 1725 GLsizei count = static_cast<GLsizei>(c.count); | 1646 GLsizei count = static_cast<GLsizei>(c.count); |
| 1647 uint32 data_size = |
| 1648 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 1726 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 1649 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
| 1727 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1650 c.v_shm_id, c.v_shm_offset, data_size); |
| 1728 if (v == NULL) { | 1651 if (v == NULL) { |
| 1729 return parse_error::kParseOutOfBounds; | 1652 return parse_error::kParseOutOfBounds; |
| 1730 } | 1653 } |
| 1731 glUniform1fv(location, count, v); | 1654 glUniform1fv(location, count, v); |
| 1732 return parse_error::kParseNoError; | 1655 return parse_error::kParseNoError; |
| 1733 } | 1656 } |
| 1734 | 1657 |
| 1735 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( | 1658 parse_error::ParseError GLES2DecoderImpl::HandleUniform1fvImmediate( |
| 1736 uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) { | 1659 uint32 immediate_data_size, const gles2::Uniform1fvImmediate& c) { |
| 1737 GLint location = static_cast<GLint>(c.location); | 1660 GLint location = static_cast<GLint>(c.location); |
| 1738 GLsizei count = static_cast<GLsizei>(c.count); | 1661 GLsizei count = static_cast<GLsizei>(c.count); |
| 1739 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); | 1662 uint32 data_size = |
| 1663 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 1664 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
| 1665 c, data_size, immediate_data_size); |
| 1740 if (v == NULL) { | 1666 if (v == NULL) { |
| 1741 return parse_error::kParseOutOfBounds; | 1667 return parse_error::kParseOutOfBounds; |
| 1742 } | 1668 } |
| 1743 if (!CheckImmediateDataSize<Uniform1fvImmediate>( | |
| 1744 immediate_data_size, count, sizeof(GLfloat), 1)) { | |
| 1745 return parse_error::kParseOutOfBounds; | |
| 1746 } | |
| 1747 // Immediate version. | |
| 1748 if (v == NULL) { | |
| 1749 return parse_error::kParseOutOfBounds; | |
| 1750 } | |
| 1751 if (!CheckImmediateDataSize<Uniform1fvImmediate>( | |
| 1752 immediate_data_size, count, sizeof(GLfloat), 1)) { | |
| 1753 return parse_error::kParseOutOfBounds; | |
| 1754 } | |
| 1755 glUniform1fv(location, count, v); | 1669 glUniform1fv(location, count, v); |
| 1756 return parse_error::kParseNoError; | 1670 return parse_error::kParseNoError; |
| 1757 } | 1671 } |
| 1758 | 1672 |
| 1759 parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( | 1673 parse_error::ParseError GLES2DecoderImpl::HandleUniform1i( |
| 1760 uint32 immediate_data_size, const gles2::Uniform1i& c) { | 1674 uint32 immediate_data_size, const gles2::Uniform1i& c) { |
| 1761 GLint location = static_cast<GLint>(c.location); | 1675 GLint location = static_cast<GLint>(c.location); |
| 1762 GLint x = static_cast<GLint>(c.x); | 1676 GLint x = static_cast<GLint>(c.x); |
| 1763 glUniform1i(location, x); | 1677 glUniform1i(location, x); |
| 1764 return parse_error::kParseNoError; | 1678 return parse_error::kParseNoError; |
| 1765 } | 1679 } |
| 1766 | 1680 |
| 1767 parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( | 1681 parse_error::ParseError GLES2DecoderImpl::HandleUniform1iv( |
| 1768 uint32 immediate_data_size, const gles2::Uniform1iv& c) { | 1682 uint32 immediate_data_size, const gles2::Uniform1iv& c) { |
| 1769 GLint location = static_cast<GLint>(c.location); | 1683 GLint location = static_cast<GLint>(c.location); |
| 1770 GLsizei count = static_cast<GLsizei>(c.count); | 1684 GLsizei count = static_cast<GLsizei>(c.count); |
| 1685 uint32 data_size = |
| 1686 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1); |
| 1771 const GLint* v = GetSharedMemoryAs<const GLint*>( | 1687 const GLint* v = GetSharedMemoryAs<const GLint*>( |
| 1772 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1688 c.v_shm_id, c.v_shm_offset, data_size); |
| 1773 if (v == NULL) { | 1689 if (v == NULL) { |
| 1774 return parse_error::kParseOutOfBounds; | 1690 return parse_error::kParseOutOfBounds; |
| 1775 } | 1691 } |
| 1776 glUniform1iv(location, count, v); | 1692 glUniform1iv(location, count, v); |
| 1777 return parse_error::kParseNoError; | 1693 return parse_error::kParseNoError; |
| 1778 } | 1694 } |
| 1779 | 1695 |
| 1780 parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( | 1696 parse_error::ParseError GLES2DecoderImpl::HandleUniform1ivImmediate( |
| 1781 uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) { | 1697 uint32 immediate_data_size, const gles2::Uniform1ivImmediate& c) { |
| 1782 GLint location = static_cast<GLint>(c.location); | 1698 GLint location = static_cast<GLint>(c.location); |
| 1783 GLsizei count = static_cast<GLsizei>(c.count); | 1699 GLsizei count = static_cast<GLsizei>(c.count); |
| 1784 const GLint* v = GetImmediateDataAs<const GLint*>(c); | 1700 uint32 data_size = |
| 1701 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 1); |
| 1702 const GLint* v = GetImmediateDataAs<const GLint*>( |
| 1703 c, data_size, immediate_data_size); |
| 1785 if (v == NULL) { | 1704 if (v == NULL) { |
| 1786 return parse_error::kParseOutOfBounds; | 1705 return parse_error::kParseOutOfBounds; |
| 1787 } | 1706 } |
| 1788 if (!CheckImmediateDataSize<Uniform1ivImmediate>( | |
| 1789 immediate_data_size, count, sizeof(GLint), 1)) { | |
| 1790 return parse_error::kParseOutOfBounds; | |
| 1791 } | |
| 1792 // Immediate version. | |
| 1793 if (v == NULL) { | |
| 1794 return parse_error::kParseOutOfBounds; | |
| 1795 } | |
| 1796 if (!CheckImmediateDataSize<Uniform1ivImmediate>( | |
| 1797 immediate_data_size, count, sizeof(GLint), 1)) { | |
| 1798 return parse_error::kParseOutOfBounds; | |
| 1799 } | |
| 1800 glUniform1iv(location, count, v); | 1707 glUniform1iv(location, count, v); |
| 1801 return parse_error::kParseNoError; | 1708 return parse_error::kParseNoError; |
| 1802 } | 1709 } |
| 1803 | 1710 |
| 1804 parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( | 1711 parse_error::ParseError GLES2DecoderImpl::HandleUniform2f( |
| 1805 uint32 immediate_data_size, const gles2::Uniform2f& c) { | 1712 uint32 immediate_data_size, const gles2::Uniform2f& c) { |
| 1806 GLint location = static_cast<GLint>(c.location); | 1713 GLint location = static_cast<GLint>(c.location); |
| 1807 GLfloat x = static_cast<GLfloat>(c.x); | 1714 GLfloat x = static_cast<GLfloat>(c.x); |
| 1808 GLfloat y = static_cast<GLfloat>(c.y); | 1715 GLfloat y = static_cast<GLfloat>(c.y); |
| 1809 glUniform2f(location, x, y); | 1716 glUniform2f(location, x, y); |
| 1810 return parse_error::kParseNoError; | 1717 return parse_error::kParseNoError; |
| 1811 } | 1718 } |
| 1812 | 1719 |
| 1813 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( | 1720 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fv( |
| 1814 uint32 immediate_data_size, const gles2::Uniform2fv& c) { | 1721 uint32 immediate_data_size, const gles2::Uniform2fv& c) { |
| 1815 GLint location = static_cast<GLint>(c.location); | 1722 GLint location = static_cast<GLint>(c.location); |
| 1816 GLsizei count = static_cast<GLsizei>(c.count); | 1723 GLsizei count = static_cast<GLsizei>(c.count); |
| 1724 uint32 data_size = |
| 1725 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2); |
| 1817 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 1726 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
| 1818 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1727 c.v_shm_id, c.v_shm_offset, data_size); |
| 1819 if (v == NULL) { | 1728 if (v == NULL) { |
| 1820 return parse_error::kParseOutOfBounds; | 1729 return parse_error::kParseOutOfBounds; |
| 1821 } | 1730 } |
| 1822 glUniform2fv(location, count, v); | 1731 glUniform2fv(location, count, v); |
| 1823 return parse_error::kParseNoError; | 1732 return parse_error::kParseNoError; |
| 1824 } | 1733 } |
| 1825 | 1734 |
| 1826 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( | 1735 parse_error::ParseError GLES2DecoderImpl::HandleUniform2fvImmediate( |
| 1827 uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) { | 1736 uint32 immediate_data_size, const gles2::Uniform2fvImmediate& c) { |
| 1828 GLint location = static_cast<GLint>(c.location); | 1737 GLint location = static_cast<GLint>(c.location); |
| 1829 GLsizei count = static_cast<GLsizei>(c.count); | 1738 GLsizei count = static_cast<GLsizei>(c.count); |
| 1830 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); | 1739 uint32 data_size = |
| 1740 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2); |
| 1741 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
| 1742 c, data_size, immediate_data_size); |
| 1831 if (v == NULL) { | 1743 if (v == NULL) { |
| 1832 return parse_error::kParseOutOfBounds; | 1744 return parse_error::kParseOutOfBounds; |
| 1833 } | 1745 } |
| 1834 if (!CheckImmediateDataSize<Uniform2fvImmediate>( | |
| 1835 immediate_data_size, count, sizeof(GLfloat), 2)) { | |
| 1836 return parse_error::kParseOutOfBounds; | |
| 1837 } | |
| 1838 // Immediate version. | |
| 1839 if (v == NULL) { | |
| 1840 return parse_error::kParseOutOfBounds; | |
| 1841 } | |
| 1842 if (!CheckImmediateDataSize<Uniform2fvImmediate>( | |
| 1843 immediate_data_size, count, sizeof(GLfloat), 2)) { | |
| 1844 return parse_error::kParseOutOfBounds; | |
| 1845 } | |
| 1846 glUniform2fv(location, count, v); | 1746 glUniform2fv(location, count, v); |
| 1847 return parse_error::kParseNoError; | 1747 return parse_error::kParseNoError; |
| 1848 } | 1748 } |
| 1849 | 1749 |
| 1850 parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( | 1750 parse_error::ParseError GLES2DecoderImpl::HandleUniform2i( |
| 1851 uint32 immediate_data_size, const gles2::Uniform2i& c) { | 1751 uint32 immediate_data_size, const gles2::Uniform2i& c) { |
| 1852 GLint location = static_cast<GLint>(c.location); | 1752 GLint location = static_cast<GLint>(c.location); |
| 1853 GLint x = static_cast<GLint>(c.x); | 1753 GLint x = static_cast<GLint>(c.x); |
| 1854 GLint y = static_cast<GLint>(c.y); | 1754 GLint y = static_cast<GLint>(c.y); |
| 1855 glUniform2i(location, x, y); | 1755 glUniform2i(location, x, y); |
| 1856 return parse_error::kParseNoError; | 1756 return parse_error::kParseNoError; |
| 1857 } | 1757 } |
| 1858 | 1758 |
| 1859 parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( | 1759 parse_error::ParseError GLES2DecoderImpl::HandleUniform2iv( |
| 1860 uint32 immediate_data_size, const gles2::Uniform2iv& c) { | 1760 uint32 immediate_data_size, const gles2::Uniform2iv& c) { |
| 1861 GLint location = static_cast<GLint>(c.location); | 1761 GLint location = static_cast<GLint>(c.location); |
| 1862 GLsizei count = static_cast<GLsizei>(c.count); | 1762 GLsizei count = static_cast<GLsizei>(c.count); |
| 1763 uint32 data_size = |
| 1764 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 2); |
| 1863 const GLint* v = GetSharedMemoryAs<const GLint*>( | 1765 const GLint* v = GetSharedMemoryAs<const GLint*>( |
| 1864 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1766 c.v_shm_id, c.v_shm_offset, data_size); |
| 1865 if (v == NULL) { | 1767 if (v == NULL) { |
| 1866 return parse_error::kParseOutOfBounds; | 1768 return parse_error::kParseOutOfBounds; |
| 1867 } | 1769 } |
| 1868 glUniform2iv(location, count, v); | 1770 glUniform2iv(location, count, v); |
| 1869 return parse_error::kParseNoError; | 1771 return parse_error::kParseNoError; |
| 1870 } | 1772 } |
| 1871 | 1773 |
| 1872 parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( | 1774 parse_error::ParseError GLES2DecoderImpl::HandleUniform2ivImmediate( |
| 1873 uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) { | 1775 uint32 immediate_data_size, const gles2::Uniform2ivImmediate& c) { |
| 1874 GLint location = static_cast<GLint>(c.location); | 1776 GLint location = static_cast<GLint>(c.location); |
| 1875 GLsizei count = static_cast<GLsizei>(c.count); | 1777 GLsizei count = static_cast<GLsizei>(c.count); |
| 1876 const GLint* v = GetImmediateDataAs<const GLint*>(c); | 1778 uint32 data_size = |
| 1779 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 2); |
| 1780 const GLint* v = GetImmediateDataAs<const GLint*>( |
| 1781 c, data_size, immediate_data_size); |
| 1877 if (v == NULL) { | 1782 if (v == NULL) { |
| 1878 return parse_error::kParseOutOfBounds; | 1783 return parse_error::kParseOutOfBounds; |
| 1879 } | 1784 } |
| 1880 if (!CheckImmediateDataSize<Uniform2ivImmediate>( | |
| 1881 immediate_data_size, count, sizeof(GLint), 2)) { | |
| 1882 return parse_error::kParseOutOfBounds; | |
| 1883 } | |
| 1884 // Immediate version. | |
| 1885 if (v == NULL) { | |
| 1886 return parse_error::kParseOutOfBounds; | |
| 1887 } | |
| 1888 if (!CheckImmediateDataSize<Uniform2ivImmediate>( | |
| 1889 immediate_data_size, count, sizeof(GLint), 2)) { | |
| 1890 return parse_error::kParseOutOfBounds; | |
| 1891 } | |
| 1892 glUniform2iv(location, count, v); | 1785 glUniform2iv(location, count, v); |
| 1893 return parse_error::kParseNoError; | 1786 return parse_error::kParseNoError; |
| 1894 } | 1787 } |
| 1895 | 1788 |
| 1896 parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( | 1789 parse_error::ParseError GLES2DecoderImpl::HandleUniform3f( |
| 1897 uint32 immediate_data_size, const gles2::Uniform3f& c) { | 1790 uint32 immediate_data_size, const gles2::Uniform3f& c) { |
| 1898 GLint location = static_cast<GLint>(c.location); | 1791 GLint location = static_cast<GLint>(c.location); |
| 1899 GLfloat x = static_cast<GLfloat>(c.x); | 1792 GLfloat x = static_cast<GLfloat>(c.x); |
| 1900 GLfloat y = static_cast<GLfloat>(c.y); | 1793 GLfloat y = static_cast<GLfloat>(c.y); |
| 1901 GLfloat z = static_cast<GLfloat>(c.z); | 1794 GLfloat z = static_cast<GLfloat>(c.z); |
| 1902 glUniform3f(location, x, y, z); | 1795 glUniform3f(location, x, y, z); |
| 1903 return parse_error::kParseNoError; | 1796 return parse_error::kParseNoError; |
| 1904 } | 1797 } |
| 1905 | 1798 |
| 1906 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( | 1799 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fv( |
| 1907 uint32 immediate_data_size, const gles2::Uniform3fv& c) { | 1800 uint32 immediate_data_size, const gles2::Uniform3fv& c) { |
| 1908 GLint location = static_cast<GLint>(c.location); | 1801 GLint location = static_cast<GLint>(c.location); |
| 1909 GLsizei count = static_cast<GLsizei>(c.count); | 1802 GLsizei count = static_cast<GLsizei>(c.count); |
| 1803 uint32 data_size = |
| 1804 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3); |
| 1910 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 1805 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
| 1911 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1806 c.v_shm_id, c.v_shm_offset, data_size); |
| 1912 if (v == NULL) { | 1807 if (v == NULL) { |
| 1913 return parse_error::kParseOutOfBounds; | 1808 return parse_error::kParseOutOfBounds; |
| 1914 } | 1809 } |
| 1915 glUniform3fv(location, count, v); | 1810 glUniform3fv(location, count, v); |
| 1916 return parse_error::kParseNoError; | 1811 return parse_error::kParseNoError; |
| 1917 } | 1812 } |
| 1918 | 1813 |
| 1919 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( | 1814 parse_error::ParseError GLES2DecoderImpl::HandleUniform3fvImmediate( |
| 1920 uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) { | 1815 uint32 immediate_data_size, const gles2::Uniform3fvImmediate& c) { |
| 1921 GLint location = static_cast<GLint>(c.location); | 1816 GLint location = static_cast<GLint>(c.location); |
| 1922 GLsizei count = static_cast<GLsizei>(c.count); | 1817 GLsizei count = static_cast<GLsizei>(c.count); |
| 1923 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); | 1818 uint32 data_size = |
| 1819 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3); |
| 1820 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
| 1821 c, data_size, immediate_data_size); |
| 1924 if (v == NULL) { | 1822 if (v == NULL) { |
| 1925 return parse_error::kParseOutOfBounds; | 1823 return parse_error::kParseOutOfBounds; |
| 1926 } | 1824 } |
| 1927 if (!CheckImmediateDataSize<Uniform3fvImmediate>( | |
| 1928 immediate_data_size, count, sizeof(GLfloat), 3)) { | |
| 1929 return parse_error::kParseOutOfBounds; | |
| 1930 } | |
| 1931 // Immediate version. | |
| 1932 if (v == NULL) { | |
| 1933 return parse_error::kParseOutOfBounds; | |
| 1934 } | |
| 1935 if (!CheckImmediateDataSize<Uniform3fvImmediate>( | |
| 1936 immediate_data_size, count, sizeof(GLfloat), 3)) { | |
| 1937 return parse_error::kParseOutOfBounds; | |
| 1938 } | |
| 1939 glUniform3fv(location, count, v); | 1825 glUniform3fv(location, count, v); |
| 1940 return parse_error::kParseNoError; | 1826 return parse_error::kParseNoError; |
| 1941 } | 1827 } |
| 1942 | 1828 |
| 1943 parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( | 1829 parse_error::ParseError GLES2DecoderImpl::HandleUniform3i( |
| 1944 uint32 immediate_data_size, const gles2::Uniform3i& c) { | 1830 uint32 immediate_data_size, const gles2::Uniform3i& c) { |
| 1945 GLint location = static_cast<GLint>(c.location); | 1831 GLint location = static_cast<GLint>(c.location); |
| 1946 GLint x = static_cast<GLint>(c.x); | 1832 GLint x = static_cast<GLint>(c.x); |
| 1947 GLint y = static_cast<GLint>(c.y); | 1833 GLint y = static_cast<GLint>(c.y); |
| 1948 GLint z = static_cast<GLint>(c.z); | 1834 GLint z = static_cast<GLint>(c.z); |
| 1949 glUniform3i(location, x, y, z); | 1835 glUniform3i(location, x, y, z); |
| 1950 return parse_error::kParseNoError; | 1836 return parse_error::kParseNoError; |
| 1951 } | 1837 } |
| 1952 | 1838 |
| 1953 parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( | 1839 parse_error::ParseError GLES2DecoderImpl::HandleUniform3iv( |
| 1954 uint32 immediate_data_size, const gles2::Uniform3iv& c) { | 1840 uint32 immediate_data_size, const gles2::Uniform3iv& c) { |
| 1955 GLint location = static_cast<GLint>(c.location); | 1841 GLint location = static_cast<GLint>(c.location); |
| 1956 GLsizei count = static_cast<GLsizei>(c.count); | 1842 GLsizei count = static_cast<GLsizei>(c.count); |
| 1843 uint32 data_size = |
| 1844 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 3); |
| 1957 const GLint* v = GetSharedMemoryAs<const GLint*>( | 1845 const GLint* v = GetSharedMemoryAs<const GLint*>( |
| 1958 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1846 c.v_shm_id, c.v_shm_offset, data_size); |
| 1959 if (v == NULL) { | 1847 if (v == NULL) { |
| 1960 return parse_error::kParseOutOfBounds; | 1848 return parse_error::kParseOutOfBounds; |
| 1961 } | 1849 } |
| 1962 glUniform3iv(location, count, v); | 1850 glUniform3iv(location, count, v); |
| 1963 return parse_error::kParseNoError; | 1851 return parse_error::kParseNoError; |
| 1964 } | 1852 } |
| 1965 | 1853 |
| 1966 parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( | 1854 parse_error::ParseError GLES2DecoderImpl::HandleUniform3ivImmediate( |
| 1967 uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) { | 1855 uint32 immediate_data_size, const gles2::Uniform3ivImmediate& c) { |
| 1968 GLint location = static_cast<GLint>(c.location); | 1856 GLint location = static_cast<GLint>(c.location); |
| 1969 GLsizei count = static_cast<GLsizei>(c.count); | 1857 GLsizei count = static_cast<GLsizei>(c.count); |
| 1970 const GLint* v = GetImmediateDataAs<const GLint*>(c); | 1858 uint32 data_size = |
| 1859 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 3); |
| 1860 const GLint* v = GetImmediateDataAs<const GLint*>( |
| 1861 c, data_size, immediate_data_size); |
| 1971 if (v == NULL) { | 1862 if (v == NULL) { |
| 1972 return parse_error::kParseOutOfBounds; | 1863 return parse_error::kParseOutOfBounds; |
| 1973 } | 1864 } |
| 1974 if (!CheckImmediateDataSize<Uniform3ivImmediate>( | |
| 1975 immediate_data_size, count, sizeof(GLint), 3)) { | |
| 1976 return parse_error::kParseOutOfBounds; | |
| 1977 } | |
| 1978 // Immediate version. | |
| 1979 if (v == NULL) { | |
| 1980 return parse_error::kParseOutOfBounds; | |
| 1981 } | |
| 1982 if (!CheckImmediateDataSize<Uniform3ivImmediate>( | |
| 1983 immediate_data_size, count, sizeof(GLint), 3)) { | |
| 1984 return parse_error::kParseOutOfBounds; | |
| 1985 } | |
| 1986 glUniform3iv(location, count, v); | 1865 glUniform3iv(location, count, v); |
| 1987 return parse_error::kParseNoError; | 1866 return parse_error::kParseNoError; |
| 1988 } | 1867 } |
| 1989 | 1868 |
| 1990 parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( | 1869 parse_error::ParseError GLES2DecoderImpl::HandleUniform4f( |
| 1991 uint32 immediate_data_size, const gles2::Uniform4f& c) { | 1870 uint32 immediate_data_size, const gles2::Uniform4f& c) { |
| 1992 GLint location = static_cast<GLint>(c.location); | 1871 GLint location = static_cast<GLint>(c.location); |
| 1993 GLfloat x = static_cast<GLfloat>(c.x); | 1872 GLfloat x = static_cast<GLfloat>(c.x); |
| 1994 GLfloat y = static_cast<GLfloat>(c.y); | 1873 GLfloat y = static_cast<GLfloat>(c.y); |
| 1995 GLfloat z = static_cast<GLfloat>(c.z); | 1874 GLfloat z = static_cast<GLfloat>(c.z); |
| 1996 GLfloat w = static_cast<GLfloat>(c.w); | 1875 GLfloat w = static_cast<GLfloat>(c.w); |
| 1997 glUniform4f(location, x, y, z, w); | 1876 glUniform4f(location, x, y, z, w); |
| 1998 return parse_error::kParseNoError; | 1877 return parse_error::kParseNoError; |
| 1999 } | 1878 } |
| 2000 | 1879 |
| 2001 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( | 1880 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fv( |
| 2002 uint32 immediate_data_size, const gles2::Uniform4fv& c) { | 1881 uint32 immediate_data_size, const gles2::Uniform4fv& c) { |
| 2003 GLint location = static_cast<GLint>(c.location); | 1882 GLint location = static_cast<GLint>(c.location); |
| 2004 GLsizei count = static_cast<GLsizei>(c.count); | 1883 GLsizei count = static_cast<GLsizei>(c.count); |
| 1884 uint32 data_size = |
| 1885 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 2005 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( | 1886 const GLfloat* v = GetSharedMemoryAs<const GLfloat*>( |
| 2006 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1887 c.v_shm_id, c.v_shm_offset, data_size); |
| 2007 if (v == NULL) { | 1888 if (v == NULL) { |
| 2008 return parse_error::kParseOutOfBounds; | 1889 return parse_error::kParseOutOfBounds; |
| 2009 } | 1890 } |
| 2010 glUniform4fv(location, count, v); | 1891 glUniform4fv(location, count, v); |
| 2011 return parse_error::kParseNoError; | 1892 return parse_error::kParseNoError; |
| 2012 } | 1893 } |
| 2013 | 1894 |
| 2014 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( | 1895 parse_error::ParseError GLES2DecoderImpl::HandleUniform4fvImmediate( |
| 2015 uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) { | 1896 uint32 immediate_data_size, const gles2::Uniform4fvImmediate& c) { |
| 2016 GLint location = static_cast<GLint>(c.location); | 1897 GLint location = static_cast<GLint>(c.location); |
| 2017 GLsizei count = static_cast<GLsizei>(c.count); | 1898 GLsizei count = static_cast<GLsizei>(c.count); |
| 2018 const GLfloat* v = GetImmediateDataAs<const GLfloat*>(c); | 1899 uint32 data_size = |
| 1900 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 1901 const GLfloat* v = GetImmediateDataAs<const GLfloat*>( |
| 1902 c, data_size, immediate_data_size); |
| 2019 if (v == NULL) { | 1903 if (v == NULL) { |
| 2020 return parse_error::kParseOutOfBounds; | 1904 return parse_error::kParseOutOfBounds; |
| 2021 } | 1905 } |
| 2022 if (!CheckImmediateDataSize<Uniform4fvImmediate>( | |
| 2023 immediate_data_size, count, sizeof(GLfloat), 4)) { | |
| 2024 return parse_error::kParseOutOfBounds; | |
| 2025 } | |
| 2026 // Immediate version. | |
| 2027 if (v == NULL) { | |
| 2028 return parse_error::kParseOutOfBounds; | |
| 2029 } | |
| 2030 if (!CheckImmediateDataSize<Uniform4fvImmediate>( | |
| 2031 immediate_data_size, count, sizeof(GLfloat), 4)) { | |
| 2032 return parse_error::kParseOutOfBounds; | |
| 2033 } | |
| 2034 glUniform4fv(location, count, v); | 1906 glUniform4fv(location, count, v); |
| 2035 return parse_error::kParseNoError; | 1907 return parse_error::kParseNoError; |
| 2036 } | 1908 } |
| 2037 | 1909 |
| 2038 parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( | 1910 parse_error::ParseError GLES2DecoderImpl::HandleUniform4i( |
| 2039 uint32 immediate_data_size, const gles2::Uniform4i& c) { | 1911 uint32 immediate_data_size, const gles2::Uniform4i& c) { |
| 2040 GLint location = static_cast<GLint>(c.location); | 1912 GLint location = static_cast<GLint>(c.location); |
| 2041 GLint x = static_cast<GLint>(c.x); | 1913 GLint x = static_cast<GLint>(c.x); |
| 2042 GLint y = static_cast<GLint>(c.y); | 1914 GLint y = static_cast<GLint>(c.y); |
| 2043 GLint z = static_cast<GLint>(c.z); | 1915 GLint z = static_cast<GLint>(c.z); |
| 2044 GLint w = static_cast<GLint>(c.w); | 1916 GLint w = static_cast<GLint>(c.w); |
| 2045 glUniform4i(location, x, y, z, w); | 1917 glUniform4i(location, x, y, z, w); |
| 2046 return parse_error::kParseNoError; | 1918 return parse_error::kParseNoError; |
| 2047 } | 1919 } |
| 2048 | 1920 |
| 2049 parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( | 1921 parse_error::ParseError GLES2DecoderImpl::HandleUniform4iv( |
| 2050 uint32 immediate_data_size, const gles2::Uniform4iv& c) { | 1922 uint32 immediate_data_size, const gles2::Uniform4iv& c) { |
| 2051 GLint location = static_cast<GLint>(c.location); | 1923 GLint location = static_cast<GLint>(c.location); |
| 2052 GLsizei count = static_cast<GLsizei>(c.count); | 1924 GLsizei count = static_cast<GLsizei>(c.count); |
| 1925 uint32 data_size = |
| 1926 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 4); |
| 2053 const GLint* v = GetSharedMemoryAs<const GLint*>( | 1927 const GLint* v = GetSharedMemoryAs<const GLint*>( |
| 2054 c.v_shm_id, c.v_shm_offset, 0 /* TODO(gman): size */); | 1928 c.v_shm_id, c.v_shm_offset, data_size); |
| 2055 if (v == NULL) { | 1929 if (v == NULL) { |
| 2056 return parse_error::kParseOutOfBounds; | 1930 return parse_error::kParseOutOfBounds; |
| 2057 } | 1931 } |
| 2058 glUniform4iv(location, count, v); | 1932 glUniform4iv(location, count, v); |
| 2059 return parse_error::kParseNoError; | 1933 return parse_error::kParseNoError; |
| 2060 } | 1934 } |
| 2061 | 1935 |
| 2062 parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( | 1936 parse_error::ParseError GLES2DecoderImpl::HandleUniform4ivImmediate( |
| 2063 uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) { | 1937 uint32 immediate_data_size, const gles2::Uniform4ivImmediate& c) { |
| 2064 GLint location = static_cast<GLint>(c.location); | 1938 GLint location = static_cast<GLint>(c.location); |
| 2065 GLsizei count = static_cast<GLsizei>(c.count); | 1939 GLsizei count = static_cast<GLsizei>(c.count); |
| 2066 const GLint* v = GetImmediateDataAs<const GLint*>(c); | 1940 uint32 data_size = |
| 1941 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLint), 4); |
| 1942 const GLint* v = GetImmediateDataAs<const GLint*>( |
| 1943 c, data_size, immediate_data_size); |
| 2067 if (v == NULL) { | 1944 if (v == NULL) { |
| 2068 return parse_error::kParseOutOfBounds; | 1945 return parse_error::kParseOutOfBounds; |
| 2069 } | 1946 } |
| 2070 if (!CheckImmediateDataSize<Uniform4ivImmediate>( | |
| 2071 immediate_data_size, count, sizeof(GLint), 4)) { | |
| 2072 return parse_error::kParseOutOfBounds; | |
| 2073 } | |
| 2074 // Immediate version. | |
| 2075 if (v == NULL) { | |
| 2076 return parse_error::kParseOutOfBounds; | |
| 2077 } | |
| 2078 if (!CheckImmediateDataSize<Uniform4ivImmediate>( | |
| 2079 immediate_data_size, count, sizeof(GLint), 4)) { | |
| 2080 return parse_error::kParseOutOfBounds; | |
| 2081 } | |
| 2082 glUniform4iv(location, count, v); | 1947 glUniform4iv(location, count, v); |
| 2083 return parse_error::kParseNoError; | 1948 return parse_error::kParseNoError; |
| 2084 } | 1949 } |
| 2085 | 1950 |
| 2086 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( | 1951 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fv( |
| 2087 uint32 immediate_data_size, const gles2::UniformMatrix2fv& c) { | 1952 uint32 immediate_data_size, const gles2::UniformMatrix2fv& c) { |
| 2088 GLint location = static_cast<GLint>(c.location); | 1953 GLint location = static_cast<GLint>(c.location); |
| 2089 GLsizei count = static_cast<GLsizei>(c.count); | 1954 GLsizei count = static_cast<GLsizei>(c.count); |
| 2090 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 1955 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 1956 uint32 data_size = |
| 1957 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 2091 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 1958 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
| 2092 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); | 1959 c.value_shm_id, c.value_shm_offset, data_size); |
| 2093 if (value == NULL) { | 1960 if (value == NULL) { |
| 2094 return parse_error::kParseOutOfBounds; | 1961 return parse_error::kParseOutOfBounds; |
| 2095 } | 1962 } |
| 2096 glUniformMatrix2fv(location, count, transpose, value); | 1963 glUniformMatrix2fv(location, count, transpose, value); |
| 2097 return parse_error::kParseNoError; | 1964 return parse_error::kParseNoError; |
| 2098 } | 1965 } |
| 2099 | 1966 |
| 2100 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( | 1967 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix2fvImmediate( |
| 2101 uint32 immediate_data_size, const gles2::UniformMatrix2fvImmediate& c) { | 1968 uint32 immediate_data_size, const gles2::UniformMatrix2fvImmediate& c) { |
| 2102 GLint location = static_cast<GLint>(c.location); | 1969 GLint location = static_cast<GLint>(c.location); |
| 2103 GLsizei count = static_cast<GLsizei>(c.count); | 1970 GLsizei count = static_cast<GLsizei>(c.count); |
| 2104 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 1971 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 2105 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); | 1972 uint32 data_size = |
| 1973 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 1974 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
| 1975 c, data_size, immediate_data_size); |
| 2106 if (value == NULL) { | 1976 if (value == NULL) { |
| 2107 return parse_error::kParseOutOfBounds; | 1977 return parse_error::kParseOutOfBounds; |
| 2108 } | 1978 } |
| 2109 if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>( | |
| 2110 immediate_data_size, count, sizeof(GLfloat), 4)) { | |
| 2111 return parse_error::kParseOutOfBounds; | |
| 2112 } | |
| 2113 // Immediate version. | |
| 2114 if (value == NULL) { | |
| 2115 return parse_error::kParseOutOfBounds; | |
| 2116 } | |
| 2117 if (!CheckImmediateDataSize<UniformMatrix2fvImmediate>( | |
| 2118 immediate_data_size, count, sizeof(GLfloat), 4)) { | |
| 2119 return parse_error::kParseOutOfBounds; | |
| 2120 } | |
| 2121 glUniformMatrix2fv(location, count, transpose, value); | 1979 glUniformMatrix2fv(location, count, transpose, value); |
| 2122 return parse_error::kParseNoError; | 1980 return parse_error::kParseNoError; |
| 2123 } | 1981 } |
| 2124 | 1982 |
| 2125 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( | 1983 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fv( |
| 2126 uint32 immediate_data_size, const gles2::UniformMatrix3fv& c) { | 1984 uint32 immediate_data_size, const gles2::UniformMatrix3fv& c) { |
| 2127 GLint location = static_cast<GLint>(c.location); | 1985 GLint location = static_cast<GLint>(c.location); |
| 2128 GLsizei count = static_cast<GLsizei>(c.count); | 1986 GLsizei count = static_cast<GLsizei>(c.count); |
| 2129 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 1987 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 1988 uint32 data_size = |
| 1989 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 9); |
| 2130 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 1990 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
| 2131 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); | 1991 c.value_shm_id, c.value_shm_offset, data_size); |
| 2132 if (value == NULL) { | 1992 if (value == NULL) { |
| 2133 return parse_error::kParseOutOfBounds; | 1993 return parse_error::kParseOutOfBounds; |
| 2134 } | 1994 } |
| 2135 glUniformMatrix3fv(location, count, transpose, value); | 1995 glUniformMatrix3fv(location, count, transpose, value); |
| 2136 return parse_error::kParseNoError; | 1996 return parse_error::kParseNoError; |
| 2137 } | 1997 } |
| 2138 | 1998 |
| 2139 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( | 1999 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix3fvImmediate( |
| 2140 uint32 immediate_data_size, const gles2::UniformMatrix3fvImmediate& c) { | 2000 uint32 immediate_data_size, const gles2::UniformMatrix3fvImmediate& c) { |
| 2141 GLint location = static_cast<GLint>(c.location); | 2001 GLint location = static_cast<GLint>(c.location); |
| 2142 GLsizei count = static_cast<GLsizei>(c.count); | 2002 GLsizei count = static_cast<GLsizei>(c.count); |
| 2143 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2003 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 2144 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); | 2004 uint32 data_size = |
| 2005 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 9); |
| 2006 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
| 2007 c, data_size, immediate_data_size); |
| 2145 if (value == NULL) { | 2008 if (value == NULL) { |
| 2146 return parse_error::kParseOutOfBounds; | 2009 return parse_error::kParseOutOfBounds; |
| 2147 } | 2010 } |
| 2148 if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>( | |
| 2149 immediate_data_size, count, sizeof(GLfloat), 9)) { | |
| 2150 return parse_error::kParseOutOfBounds; | |
| 2151 } | |
| 2152 // Immediate version. | |
| 2153 if (value == NULL) { | |
| 2154 return parse_error::kParseOutOfBounds; | |
| 2155 } | |
| 2156 if (!CheckImmediateDataSize<UniformMatrix3fvImmediate>( | |
| 2157 immediate_data_size, count, sizeof(GLfloat), 9)) { | |
| 2158 return parse_error::kParseOutOfBounds; | |
| 2159 } | |
| 2160 glUniformMatrix3fv(location, count, transpose, value); | 2011 glUniformMatrix3fv(location, count, transpose, value); |
| 2161 return parse_error::kParseNoError; | 2012 return parse_error::kParseNoError; |
| 2162 } | 2013 } |
| 2163 | 2014 |
| 2164 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( | 2015 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fv( |
| 2165 uint32 immediate_data_size, const gles2::UniformMatrix4fv& c) { | 2016 uint32 immediate_data_size, const gles2::UniformMatrix4fv& c) { |
| 2166 GLint location = static_cast<GLint>(c.location); | 2017 GLint location = static_cast<GLint>(c.location); |
| 2167 GLsizei count = static_cast<GLsizei>(c.count); | 2018 GLsizei count = static_cast<GLsizei>(c.count); |
| 2168 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2019 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 2020 uint32 data_size = |
| 2021 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 16); |
| 2169 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( | 2022 const GLfloat* value = GetSharedMemoryAs<const GLfloat*>( |
| 2170 c.value_shm_id, c.value_shm_offset, 0 /* TODO(gman): size */); | 2023 c.value_shm_id, c.value_shm_offset, data_size); |
| 2171 if (value == NULL) { | 2024 if (value == NULL) { |
| 2172 return parse_error::kParseOutOfBounds; | 2025 return parse_error::kParseOutOfBounds; |
| 2173 } | 2026 } |
| 2174 glUniformMatrix4fv(location, count, transpose, value); | 2027 glUniformMatrix4fv(location, count, transpose, value); |
| 2175 return parse_error::kParseNoError; | 2028 return parse_error::kParseNoError; |
| 2176 } | 2029 } |
| 2177 | 2030 |
| 2178 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( | 2031 parse_error::ParseError GLES2DecoderImpl::HandleUniformMatrix4fvImmediate( |
| 2179 uint32 immediate_data_size, const gles2::UniformMatrix4fvImmediate& c) { | 2032 uint32 immediate_data_size, const gles2::UniformMatrix4fvImmediate& c) { |
| 2180 GLint location = static_cast<GLint>(c.location); | 2033 GLint location = static_cast<GLint>(c.location); |
| 2181 GLsizei count = static_cast<GLsizei>(c.count); | 2034 GLsizei count = static_cast<GLsizei>(c.count); |
| 2182 GLboolean transpose = static_cast<GLboolean>(c.transpose); | 2035 GLboolean transpose = static_cast<GLboolean>(c.transpose); |
| 2183 const GLfloat* value = GetImmediateDataAs<const GLfloat*>(c); | 2036 uint32 data_size = |
| 2037 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 16); |
| 2038 const GLfloat* value = GetImmediateDataAs<const GLfloat*>( |
| 2039 c, data_size, immediate_data_size); |
| 2184 if (value == NULL) { | 2040 if (value == NULL) { |
| 2185 return parse_error::kParseOutOfBounds; | 2041 return parse_error::kParseOutOfBounds; |
| 2186 } | 2042 } |
| 2187 if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>( | |
| 2188 immediate_data_size, count, sizeof(GLfloat), 16)) { | |
| 2189 return parse_error::kParseOutOfBounds; | |
| 2190 } | |
| 2191 // Immediate version. | |
| 2192 if (value == NULL) { | |
| 2193 return parse_error::kParseOutOfBounds; | |
| 2194 } | |
| 2195 if (!CheckImmediateDataSize<UniformMatrix4fvImmediate>( | |
| 2196 immediate_data_size, count, sizeof(GLfloat), 16)) { | |
| 2197 return parse_error::kParseOutOfBounds; | |
| 2198 } | |
| 2199 glUniformMatrix4fv(location, count, transpose, value); | 2043 glUniformMatrix4fv(location, count, transpose, value); |
| 2200 return parse_error::kParseNoError; | 2044 return parse_error::kParseNoError; |
| 2201 } | 2045 } |
| 2202 | 2046 |
| 2203 parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( | 2047 parse_error::ParseError GLES2DecoderImpl::HandleUseProgram( |
| 2204 uint32 immediate_data_size, const gles2::UseProgram& c) { | 2048 uint32 immediate_data_size, const gles2::UseProgram& c) { |
| 2205 GLuint program; | 2049 GLuint program; |
| 2206 if (!id_map_.GetServiceId(c.program, &program)) { | 2050 if (!id_map_.GetServiceId(c.program, &program)) { |
| 2207 SetGLError(GL_INVALID_VALUE); | 2051 SetGLError(GL_INVALID_VALUE); |
| 2208 return parse_error::kParseNoError; | 2052 return parse_error::kParseNoError; |
| 2209 } | 2053 } |
| 2210 glUseProgram(program); | 2054 DoUseProgram(program); |
| 2211 return parse_error::kParseNoError; | 2055 return parse_error::kParseNoError; |
| 2212 } | 2056 } |
| 2213 | 2057 |
| 2214 parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( | 2058 parse_error::ParseError GLES2DecoderImpl::HandleValidateProgram( |
| 2215 uint32 immediate_data_size, const gles2::ValidateProgram& c) { | 2059 uint32 immediate_data_size, const gles2::ValidateProgram& c) { |
| 2216 GLuint program; | 2060 GLuint program; |
| 2217 if (!id_map_.GetServiceId(c.program, &program)) { | 2061 if (!id_map_.GetServiceId(c.program, &program)) { |
| 2218 SetGLError(GL_INVALID_VALUE); | 2062 SetGLError(GL_INVALID_VALUE); |
| 2219 return parse_error::kParseNoError; | 2063 return parse_error::kParseNoError; |
| 2220 } | 2064 } |
| 2221 glValidateProgram(program); | 2065 glValidateProgram(program); |
| 2222 return parse_error::kParseNoError; | 2066 return parse_error::kParseNoError; |
| 2223 } | 2067 } |
| 2224 | 2068 |
| 2225 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( | 2069 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1f( |
| 2226 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { | 2070 uint32 immediate_data_size, const gles2::VertexAttrib1f& c) { |
| 2227 GLuint indx = static_cast<GLuint>(c.indx); | 2071 GLuint indx = static_cast<GLuint>(c.indx); |
| 2228 GLfloat x = static_cast<GLfloat>(c.x); | 2072 GLfloat x = static_cast<GLfloat>(c.x); |
| 2229 glVertexAttrib1f(indx, x); | 2073 glVertexAttrib1f(indx, x); |
| 2230 return parse_error::kParseNoError; | 2074 return parse_error::kParseNoError; |
| 2231 } | 2075 } |
| 2232 | 2076 |
| 2233 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( | 2077 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fv( |
| 2234 uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) { | 2078 uint32 immediate_data_size, const gles2::VertexAttrib1fv& c) { |
| 2235 GLuint indx = static_cast<GLuint>(c.indx); | 2079 GLuint indx = static_cast<GLuint>(c.indx); |
| 2080 uint32 data_size = |
| 2081 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 2236 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2082 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
| 2237 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); | 2083 c.values_shm_id, c.values_shm_offset, data_size); |
| 2238 if (values == NULL) { | 2084 if (values == NULL) { |
| 2239 return parse_error::kParseOutOfBounds; | 2085 return parse_error::kParseOutOfBounds; |
| 2240 } | 2086 } |
| 2241 glVertexAttrib1fv(indx, values); | 2087 glVertexAttrib1fv(indx, values); |
| 2242 return parse_error::kParseNoError; | 2088 return parse_error::kParseNoError; |
| 2243 } | 2089 } |
| 2244 | 2090 |
| 2245 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( | 2091 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib1fvImmediate( |
| 2246 uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) { | 2092 uint32 immediate_data_size, const gles2::VertexAttrib1fvImmediate& c) { |
| 2247 GLuint indx = static_cast<GLuint>(c.indx); | 2093 GLuint indx = static_cast<GLuint>(c.indx); |
| 2248 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); | 2094 uint32 data_size = |
| 2095 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 1); |
| 2096 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
| 2097 c, data_size, immediate_data_size); |
| 2249 if (values == NULL) { | 2098 if (values == NULL) { |
| 2250 return parse_error::kParseOutOfBounds; | 2099 return parse_error::kParseOutOfBounds; |
| 2251 } | 2100 } |
| 2252 if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>( | |
| 2253 immediate_data_size, 1, sizeof(GLfloat), 1)) { | |
| 2254 return parse_error::kParseOutOfBounds; | |
| 2255 } | |
| 2256 // Immediate version. | |
| 2257 if (values == NULL) { | |
| 2258 return parse_error::kParseOutOfBounds; | |
| 2259 } | |
| 2260 if (!CheckImmediateDataSize<VertexAttrib1fvImmediate>( | |
| 2261 immediate_data_size, 1, sizeof(GLfloat), 1)) { | |
| 2262 return parse_error::kParseOutOfBounds; | |
| 2263 } | |
| 2264 glVertexAttrib1fv(indx, values); | 2101 glVertexAttrib1fv(indx, values); |
| 2265 return parse_error::kParseNoError; | 2102 return parse_error::kParseNoError; |
| 2266 } | 2103 } |
| 2267 | 2104 |
| 2268 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( | 2105 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2f( |
| 2269 uint32 immediate_data_size, const gles2::VertexAttrib2f& c) { | 2106 uint32 immediate_data_size, const gles2::VertexAttrib2f& c) { |
| 2270 GLuint indx = static_cast<GLuint>(c.indx); | 2107 GLuint indx = static_cast<GLuint>(c.indx); |
| 2271 GLfloat x = static_cast<GLfloat>(c.x); | 2108 GLfloat x = static_cast<GLfloat>(c.x); |
| 2272 GLfloat y = static_cast<GLfloat>(c.y); | 2109 GLfloat y = static_cast<GLfloat>(c.y); |
| 2273 glVertexAttrib2f(indx, x, y); | 2110 glVertexAttrib2f(indx, x, y); |
| 2274 return parse_error::kParseNoError; | 2111 return parse_error::kParseNoError; |
| 2275 } | 2112 } |
| 2276 | 2113 |
| 2277 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( | 2114 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fv( |
| 2278 uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) { | 2115 uint32 immediate_data_size, const gles2::VertexAttrib2fv& c) { |
| 2279 GLuint indx = static_cast<GLuint>(c.indx); | 2116 GLuint indx = static_cast<GLuint>(c.indx); |
| 2117 uint32 data_size = |
| 2118 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2); |
| 2280 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2119 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
| 2281 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); | 2120 c.values_shm_id, c.values_shm_offset, data_size); |
| 2282 if (values == NULL) { | 2121 if (values == NULL) { |
| 2283 return parse_error::kParseOutOfBounds; | 2122 return parse_error::kParseOutOfBounds; |
| 2284 } | 2123 } |
| 2285 glVertexAttrib2fv(indx, values); | 2124 glVertexAttrib2fv(indx, values); |
| 2286 return parse_error::kParseNoError; | 2125 return parse_error::kParseNoError; |
| 2287 } | 2126 } |
| 2288 | 2127 |
| 2289 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( | 2128 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib2fvImmediate( |
| 2290 uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) { | 2129 uint32 immediate_data_size, const gles2::VertexAttrib2fvImmediate& c) { |
| 2291 GLuint indx = static_cast<GLuint>(c.indx); | 2130 GLuint indx = static_cast<GLuint>(c.indx); |
| 2292 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); | 2131 uint32 data_size = |
| 2132 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 2); |
| 2133 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
| 2134 c, data_size, immediate_data_size); |
| 2293 if (values == NULL) { | 2135 if (values == NULL) { |
| 2294 return parse_error::kParseOutOfBounds; | 2136 return parse_error::kParseOutOfBounds; |
| 2295 } | 2137 } |
| 2296 if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>( | |
| 2297 immediate_data_size, 1, sizeof(GLfloat), 2)) { | |
| 2298 return parse_error::kParseOutOfBounds; | |
| 2299 } | |
| 2300 // Immediate version. | |
| 2301 if (values == NULL) { | |
| 2302 return parse_error::kParseOutOfBounds; | |
| 2303 } | |
| 2304 if (!CheckImmediateDataSize<VertexAttrib2fvImmediate>( | |
| 2305 immediate_data_size, 1, sizeof(GLfloat), 2)) { | |
| 2306 return parse_error::kParseOutOfBounds; | |
| 2307 } | |
| 2308 glVertexAttrib2fv(indx, values); | 2138 glVertexAttrib2fv(indx, values); |
| 2309 return parse_error::kParseNoError; | 2139 return parse_error::kParseNoError; |
| 2310 } | 2140 } |
| 2311 | 2141 |
| 2312 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( | 2142 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3f( |
| 2313 uint32 immediate_data_size, const gles2::VertexAttrib3f& c) { | 2143 uint32 immediate_data_size, const gles2::VertexAttrib3f& c) { |
| 2314 GLuint indx = static_cast<GLuint>(c.indx); | 2144 GLuint indx = static_cast<GLuint>(c.indx); |
| 2315 GLfloat x = static_cast<GLfloat>(c.x); | 2145 GLfloat x = static_cast<GLfloat>(c.x); |
| 2316 GLfloat y = static_cast<GLfloat>(c.y); | 2146 GLfloat y = static_cast<GLfloat>(c.y); |
| 2317 GLfloat z = static_cast<GLfloat>(c.z); | 2147 GLfloat z = static_cast<GLfloat>(c.z); |
| 2318 glVertexAttrib3f(indx, x, y, z); | 2148 glVertexAttrib3f(indx, x, y, z); |
| 2319 return parse_error::kParseNoError; | 2149 return parse_error::kParseNoError; |
| 2320 } | 2150 } |
| 2321 | 2151 |
| 2322 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( | 2152 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fv( |
| 2323 uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) { | 2153 uint32 immediate_data_size, const gles2::VertexAttrib3fv& c) { |
| 2324 GLuint indx = static_cast<GLuint>(c.indx); | 2154 GLuint indx = static_cast<GLuint>(c.indx); |
| 2155 uint32 data_size = |
| 2156 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3); |
| 2325 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2157 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
| 2326 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); | 2158 c.values_shm_id, c.values_shm_offset, data_size); |
| 2327 if (values == NULL) { | 2159 if (values == NULL) { |
| 2328 return parse_error::kParseOutOfBounds; | 2160 return parse_error::kParseOutOfBounds; |
| 2329 } | 2161 } |
| 2330 glVertexAttrib3fv(indx, values); | 2162 glVertexAttrib3fv(indx, values); |
| 2331 return parse_error::kParseNoError; | 2163 return parse_error::kParseNoError; |
| 2332 } | 2164 } |
| 2333 | 2165 |
| 2334 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( | 2166 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib3fvImmediate( |
| 2335 uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) { | 2167 uint32 immediate_data_size, const gles2::VertexAttrib3fvImmediate& c) { |
| 2336 GLuint indx = static_cast<GLuint>(c.indx); | 2168 GLuint indx = static_cast<GLuint>(c.indx); |
| 2337 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); | 2169 uint32 data_size = |
| 2170 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 3); |
| 2171 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
| 2172 c, data_size, immediate_data_size); |
| 2338 if (values == NULL) { | 2173 if (values == NULL) { |
| 2339 return parse_error::kParseOutOfBounds; | 2174 return parse_error::kParseOutOfBounds; |
| 2340 } | 2175 } |
| 2341 if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>( | |
| 2342 immediate_data_size, 1, sizeof(GLfloat), 3)) { | |
| 2343 return parse_error::kParseOutOfBounds; | |
| 2344 } | |
| 2345 // Immediate version. | |
| 2346 if (values == NULL) { | |
| 2347 return parse_error::kParseOutOfBounds; | |
| 2348 } | |
| 2349 if (!CheckImmediateDataSize<VertexAttrib3fvImmediate>( | |
| 2350 immediate_data_size, 1, sizeof(GLfloat), 3)) { | |
| 2351 return parse_error::kParseOutOfBounds; | |
| 2352 } | |
| 2353 glVertexAttrib3fv(indx, values); | 2176 glVertexAttrib3fv(indx, values); |
| 2354 return parse_error::kParseNoError; | 2177 return parse_error::kParseNoError; |
| 2355 } | 2178 } |
| 2356 | 2179 |
| 2357 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( | 2180 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4f( |
| 2358 uint32 immediate_data_size, const gles2::VertexAttrib4f& c) { | 2181 uint32 immediate_data_size, const gles2::VertexAttrib4f& c) { |
| 2359 GLuint indx = static_cast<GLuint>(c.indx); | 2182 GLuint indx = static_cast<GLuint>(c.indx); |
| 2360 GLfloat x = static_cast<GLfloat>(c.x); | 2183 GLfloat x = static_cast<GLfloat>(c.x); |
| 2361 GLfloat y = static_cast<GLfloat>(c.y); | 2184 GLfloat y = static_cast<GLfloat>(c.y); |
| 2362 GLfloat z = static_cast<GLfloat>(c.z); | 2185 GLfloat z = static_cast<GLfloat>(c.z); |
| 2363 GLfloat w = static_cast<GLfloat>(c.w); | 2186 GLfloat w = static_cast<GLfloat>(c.w); |
| 2364 glVertexAttrib4f(indx, x, y, z, w); | 2187 glVertexAttrib4f(indx, x, y, z, w); |
| 2365 return parse_error::kParseNoError; | 2188 return parse_error::kParseNoError; |
| 2366 } | 2189 } |
| 2367 | 2190 |
| 2368 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( | 2191 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fv( |
| 2369 uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) { | 2192 uint32 immediate_data_size, const gles2::VertexAttrib4fv& c) { |
| 2370 GLuint indx = static_cast<GLuint>(c.indx); | 2193 GLuint indx = static_cast<GLuint>(c.indx); |
| 2194 uint32 data_size = |
| 2195 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 2371 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( | 2196 const GLfloat* values = GetSharedMemoryAs<const GLfloat*>( |
| 2372 c.values_shm_id, c.values_shm_offset, 0 /* TODO(gman): size */); | 2197 c.values_shm_id, c.values_shm_offset, data_size); |
| 2373 if (values == NULL) { | 2198 if (values == NULL) { |
| 2374 return parse_error::kParseOutOfBounds; | 2199 return parse_error::kParseOutOfBounds; |
| 2375 } | 2200 } |
| 2376 glVertexAttrib4fv(indx, values); | 2201 glVertexAttrib4fv(indx, values); |
| 2377 return parse_error::kParseNoError; | 2202 return parse_error::kParseNoError; |
| 2378 } | 2203 } |
| 2379 | 2204 |
| 2380 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( | 2205 parse_error::ParseError GLES2DecoderImpl::HandleVertexAttrib4fvImmediate( |
| 2381 uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) { | 2206 uint32 immediate_data_size, const gles2::VertexAttrib4fvImmediate& c) { |
| 2382 GLuint indx = static_cast<GLuint>(c.indx); | 2207 GLuint indx = static_cast<GLuint>(c.indx); |
| 2383 const GLfloat* values = GetImmediateDataAs<const GLfloat*>(c); | 2208 uint32 data_size = |
| 2209 ComputeImmediateDataSize(immediate_data_size, 1, sizeof(GLfloat), 4); |
| 2210 const GLfloat* values = GetImmediateDataAs<const GLfloat*>( |
| 2211 c, data_size, immediate_data_size); |
| 2384 if (values == NULL) { | 2212 if (values == NULL) { |
| 2385 return parse_error::kParseOutOfBounds; | 2213 return parse_error::kParseOutOfBounds; |
| 2386 } | 2214 } |
| 2387 if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>( | |
| 2388 immediate_data_size, 1, sizeof(GLfloat), 4)) { | |
| 2389 return parse_error::kParseOutOfBounds; | |
| 2390 } | |
| 2391 // Immediate version. | |
| 2392 if (values == NULL) { | |
| 2393 return parse_error::kParseOutOfBounds; | |
| 2394 } | |
| 2395 if (!CheckImmediateDataSize<VertexAttrib4fvImmediate>( | |
| 2396 immediate_data_size, 1, sizeof(GLfloat), 4)) { | |
| 2397 return parse_error::kParseOutOfBounds; | |
| 2398 } | |
| 2399 glVertexAttrib4fv(indx, values); | 2215 glVertexAttrib4fv(indx, values); |
| 2400 return parse_error::kParseNoError; | 2216 return parse_error::kParseNoError; |
| 2401 } | 2217 } |
| 2402 | 2218 |
| 2403 parse_error::ParseError GLES2DecoderImpl::HandleViewport( | 2219 parse_error::ParseError GLES2DecoderImpl::HandleViewport( |
| 2404 uint32 immediate_data_size, const gles2::Viewport& c) { | 2220 uint32 immediate_data_size, const gles2::Viewport& c) { |
| 2405 GLint x = static_cast<GLint>(c.x); | 2221 GLint x = static_cast<GLint>(c.x); |
| 2406 GLint y = static_cast<GLint>(c.y); | 2222 GLint y = static_cast<GLint>(c.y); |
| 2407 GLsizei width = static_cast<GLsizei>(c.width); | 2223 GLsizei width = static_cast<GLsizei>(c.width); |
| 2408 GLsizei height = static_cast<GLsizei>(c.height); | 2224 GLsizei height = static_cast<GLsizei>(c.height); |
| 2409 glViewport(x, y, width, height); | 2225 glViewport(x, y, width, height); |
| 2410 return parse_error::kParseNoError; | 2226 return parse_error::kParseNoError; |
| 2411 } | 2227 } |
| 2412 | 2228 |
| 2413 parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers( | 2229 parse_error::ParseError GLES2DecoderImpl::HandleSwapBuffers( |
| 2414 uint32 immediate_data_size, const gles2::SwapBuffers& c) { | 2230 uint32 immediate_data_size, const gles2::SwapBuffers& c) { |
| 2415 DoSwapBuffers(); | 2231 DoSwapBuffers(); |
| 2416 return parse_error::kParseNoError; | 2232 return parse_error::kParseNoError; |
| 2417 } | 2233 } |
| 2418 | 2234 |
| OLD | NEW |