OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
6 | 6 |
7 namespace gpu { | 7 namespace gpu { |
8 namespace gles2 { | 8 namespace gles2 { |
9 | 9 |
10 // Custom Handlers | 10 // Custom Handlers |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 return error::kNoError; | 2430 return error::kNoError; |
2431 } | 2431 } |
2432 | 2432 |
2433 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2DBucket( | 2433 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2DBucket( |
2434 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2434 uint32_t immediate_data_size, const volatile void* cmd_data) { |
2435 const volatile gles2::cmds::CompressedTexImage2DBucket& c = | 2435 const volatile gles2::cmds::CompressedTexImage2DBucket& c = |
2436 *static_cast<const volatile gles2::cmds::CompressedTexImage2DBucket*>( | 2436 *static_cast<const volatile gles2::cmds::CompressedTexImage2DBucket*>( |
2437 cmd_data); | 2437 cmd_data); |
2438 GLenum target = static_cast<GLenum>(c.target); | 2438 GLenum target = static_cast<GLenum>(c.target); |
2439 GLint level = static_cast<GLint>(c.level); | 2439 GLint level = static_cast<GLint>(c.level); |
2440 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 2440 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
2441 GLsizei width = static_cast<GLsizei>(c.width); | 2441 GLsizei width = static_cast<GLsizei>(c.width); |
2442 GLsizei height = static_cast<GLsizei>(c.height); | 2442 GLsizei height = static_cast<GLsizei>(c.height); |
2443 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); | 2443 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
2444 GLint border = static_cast<GLint>(c.border); | 2444 GLint border = static_cast<GLint>(c.border); |
2445 Bucket* bucket = GetBucket(bucket_id); | 2445 Bucket* bucket = GetBucket(bucket_id); |
2446 if (!bucket) | 2446 if (!bucket) |
2447 return error::kInvalidArguments; | 2447 return error::kInvalidArguments; |
2448 uint32_t data_size = bucket->size(); | 2448 uint32_t image_size = bucket->size(); |
2449 GLsizei imageSize = data_size; | 2449 const void* data = bucket->GetData(0, image_size); |
2450 const void* data = bucket->GetData(0, data_size); | 2450 DCHECK(data || !image_size); |
2451 if (imageSize && !data) { | 2451 return DoCompressedTexImage2D( |
2452 return error::kInvalidArguments; | 2452 target, level, internal_format, width, height, border, image_size, data); |
2453 } | |
2454 error::Error error = DoCompressedTexImage2D( | |
2455 target, level, internalformat, width, height, border, imageSize, data); | |
2456 if (error != error::kNoError) { | |
2457 return error; | |
2458 } | |
2459 return error::kNoError; | |
2460 } | 2453 } |
2461 | 2454 |
2462 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2D( | 2455 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage2D( |
2463 uint32_t immediate_data_size, const volatile void* cmd_data) { | 2456 uint32_t immediate_data_size, const volatile void* cmd_data) { |
2464 const volatile gles2::cmds::CompressedTexImage2D& c = | 2457 const volatile gles2::cmds::CompressedTexImage2D& c = |
2465 *static_cast<const volatile gles2::cmds::CompressedTexImage2D*>(cmd_data); | 2458 *static_cast<const volatile gles2::cmds::CompressedTexImage2D*>(cmd_data); |
2466 GLenum target = static_cast<GLenum>(c.target); | 2459 GLenum target = static_cast<GLenum>(c.target); |
2467 GLint level = static_cast<GLint>(c.level); | 2460 GLint level = static_cast<GLint>(c.level); |
2468 GLenum internalformat = static_cast<GLenum>(c.internalformat); | 2461 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
2469 GLsizei width = static_cast<GLsizei>(c.width); | 2462 GLsizei width = static_cast<GLsizei>(c.width); |
2470 GLsizei height = static_cast<GLsizei>(c.height); | 2463 GLsizei height = static_cast<GLsizei>(c.height); |
2471 GLint border = static_cast<GLint>(c.border); | 2464 GLint border = static_cast<GLint>(c.border); |
2472 GLsizei imageSize = static_cast<GLsizei>(c.imageSize); | 2465 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
2473 uint32_t data_size = imageSize; | |
2474 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. | 2466 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
2475 const void* data = GetSharedMemoryAs<const void*>( | 2467 const void* data = GetSharedMemoryAs<const void*>( |
2476 c.data_shm_id, c.data_shm_offset, data_size); | 2468 c.data_shm_id, c.data_shm_offset, image_size); |
2477 error::Error error = DoCompressedTexImage2D( | 2469 return DoCompressedTexImage2D( |
2478 target, level, internalformat, width, height, border, imageSize, data); | 2470 target, level, internal_format, width, height, border, image_size, data); |
2479 if (error != error::kNoError) { | 2471 } |
2480 return error; | 2472 |
2481 } | 2473 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2DBucket( |
2482 return error::kNoError; | 2474 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2475 const volatile gles2::cmds::CompressedTexSubImage2DBucket& c = |
| 2476 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2DBucket*>( |
| 2477 cmd_data); |
| 2478 GLenum target = static_cast<GLenum>(c.target); |
| 2479 GLint level = static_cast<GLint>(c.level); |
| 2480 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2481 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2482 GLsizei width = static_cast<GLsizei>(c.width); |
| 2483 GLsizei height = static_cast<GLsizei>(c.height); |
| 2484 GLenum format = static_cast<GLenum>(c.format); |
| 2485 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2486 Bucket* bucket = GetBucket(bucket_id); |
| 2487 if (!bucket) |
| 2488 return error::kInvalidArguments; |
| 2489 uint32_t image_size = bucket->size(); |
| 2490 const void* data = bucket->GetData(0, image_size); |
| 2491 DCHECK(data || !image_size); |
| 2492 return DoCompressedTexSubImage2D( |
| 2493 target, level, xoffset, yoffset, width, height, format, image_size, data); |
| 2494 } |
| 2495 |
| 2496 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage2D( |
| 2497 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2498 const volatile gles2::cmds::CompressedTexSubImage2D& c = |
| 2499 *static_cast<const volatile gles2::cmds::CompressedTexSubImage2D*>( |
| 2500 cmd_data); |
| 2501 GLenum target = static_cast<GLenum>(c.target); |
| 2502 GLint level = static_cast<GLint>(c.level); |
| 2503 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2504 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2505 GLsizei width = static_cast<GLsizei>(c.width); |
| 2506 GLsizei height = static_cast<GLsizei>(c.height); |
| 2507 GLenum format = static_cast<GLenum>(c.format); |
| 2508 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2509 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
| 2510 const void* data = GetSharedMemoryAs<const void*>( |
| 2511 c.data_shm_id, c.data_shm_offset, image_size); |
| 2512 return DoCompressedTexSubImage2D( |
| 2513 target, level, xoffset, yoffset, width, height, format, image_size, data); |
| 2514 } |
| 2515 |
| 2516 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3DBucket( |
| 2517 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2518 const volatile gles2::cmds::CompressedTexImage3DBucket& c = |
| 2519 *static_cast<const volatile gles2::cmds::CompressedTexImage3DBucket*>( |
| 2520 cmd_data); |
| 2521 GLenum target = static_cast<GLenum>(c.target); |
| 2522 GLint level = static_cast<GLint>(c.level); |
| 2523 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 2524 GLsizei width = static_cast<GLsizei>(c.width); |
| 2525 GLsizei height = static_cast<GLsizei>(c.height); |
| 2526 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2527 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2528 GLint border = static_cast<GLint>(c.border); |
| 2529 Bucket* bucket = GetBucket(bucket_id); |
| 2530 if (!bucket) |
| 2531 return error::kInvalidArguments; |
| 2532 GLsizei image_size = bucket->size(); |
| 2533 const void* data = bucket->GetData(0, image_size); |
| 2534 DCHECK(data || !image_size); |
| 2535 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 2536 depth, border, image_size, data); |
| 2537 } |
| 2538 |
| 2539 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexImage3D( |
| 2540 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2541 const volatile gles2::cmds::CompressedTexImage3D& c = |
| 2542 *static_cast<const volatile gles2::cmds::CompressedTexImage3D*>(cmd_data); |
| 2543 GLenum target = static_cast<GLenum>(c.target); |
| 2544 GLint level = static_cast<GLint>(c.level); |
| 2545 GLenum internal_format = static_cast<GLenum>(c.internalformat); |
| 2546 GLsizei width = static_cast<GLsizei>(c.width); |
| 2547 GLsizei height = static_cast<GLsizei>(c.height); |
| 2548 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2549 GLint border = static_cast<GLint>(c.border); |
| 2550 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2551 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
| 2552 const void* data = GetSharedMemoryAs<const void*>( |
| 2553 c.data_shm_id, c.data_shm_offset, image_size); |
| 2554 return DoCompressedTexImage3D(target, level, internal_format, width, height, |
| 2555 depth, border, image_size, data); |
| 2556 } |
| 2557 |
| 2558 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3DBucket( |
| 2559 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2560 const volatile gles2::cmds::CompressedTexSubImage3DBucket& c = |
| 2561 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3DBucket*>( |
| 2562 cmd_data); |
| 2563 GLenum target = static_cast<GLenum>(c.target); |
| 2564 GLint level = static_cast<GLint>(c.level); |
| 2565 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2566 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2567 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 2568 GLsizei width = static_cast<GLsizei>(c.width); |
| 2569 GLsizei height = static_cast<GLsizei>(c.height); |
| 2570 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2571 GLenum format = static_cast<GLenum>(c.format); |
| 2572 GLuint bucket_id = static_cast<GLuint>(c.bucket_id); |
| 2573 Bucket* bucket = GetBucket(bucket_id); |
| 2574 if (!bucket) |
| 2575 return error::kInvalidArguments; |
| 2576 uint32_t image_size = bucket->size(); |
| 2577 const void* data = bucket->GetData(0, image_size); |
| 2578 DCHECK(data || !image_size); |
| 2579 return DoCompressedTexSubImage3D( |
| 2580 target, level, xoffset, yoffset, zoffset, width, height, depth, |
| 2581 format, image_size, data); |
| 2582 } |
| 2583 |
| 2584 error::Error GLES2DecoderPassthroughImpl::HandleCompressedTexSubImage3D( |
| 2585 uint32_t immediate_data_size, const volatile void* cmd_data) { |
| 2586 const volatile gles2::cmds::CompressedTexSubImage3D& c = |
| 2587 *static_cast<const volatile gles2::cmds::CompressedTexSubImage3D*>( |
| 2588 cmd_data); |
| 2589 GLenum target = static_cast<GLenum>(c.target); |
| 2590 GLint level = static_cast<GLint>(c.level); |
| 2591 GLint xoffset = static_cast<GLint>(c.xoffset); |
| 2592 GLint yoffset = static_cast<GLint>(c.yoffset); |
| 2593 GLint zoffset = static_cast<GLint>(c.zoffset); |
| 2594 GLsizei width = static_cast<GLsizei>(c.width); |
| 2595 GLsizei height = static_cast<GLsizei>(c.height); |
| 2596 GLsizei depth = static_cast<GLsizei>(c.depth); |
| 2597 GLenum format = static_cast<GLenum>(c.format); |
| 2598 GLsizei image_size = static_cast<GLsizei>(c.imageSize); |
| 2599 // TODO(geofflang): Handle PIXEL_UNPACK_BUFFER case. |
| 2600 const void* data = GetSharedMemoryAs<const void*>( |
| 2601 c.data_shm_id, c.data_shm_offset, image_size); |
| 2602 return DoCompressedTexSubImage3D( |
| 2603 target, level, xoffset, yoffset, zoffset, width, height, depth, |
| 2604 format, image_size, data); |
2483 } | 2605 } |
2484 | 2606 |
2485 } // namespace gles2 | 2607 } // namespace gles2 |
2486 } // namespace gpu | 2608 } // namespace gpu |
OLD | NEW |