| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2411 buffer->shm_id(), buffer->shm_offset() + offset); | 2411 buffer->shm_id(), buffer->shm_offset() + offset); |
| 2412 buffer->set_last_usage_token(helper_->InsertToken()); | 2412 buffer->set_last_usage_token(helper_->InsertToken()); |
| 2413 CheckGLError(); | 2413 CheckGLError(); |
| 2414 } | 2414 } |
| 2415 return; | 2415 return; |
| 2416 } | 2416 } |
| 2417 if (bound_pixel_unpack_buffer_) { | 2417 if (bound_pixel_unpack_buffer_) { |
| 2418 helper_->CompressedTexSubImage2D( | 2418 helper_->CompressedTexSubImage2D( |
| 2419 target, level, xoffset, yoffset, width, height, format, image_size, | 2419 target, level, xoffset, yoffset, width, height, format, image_size, |
| 2420 0, ToGLuint(data)); | 2420 0, ToGLuint(data)); |
| 2421 } else { | 2421 } else if (data) { |
| 2422 SetBucketContents(kResultBucketId, data, image_size); | 2422 SetBucketContents(kResultBucketId, data, image_size); |
| 2423 helper_->CompressedTexSubImage2DBucket( | 2423 helper_->CompressedTexSubImage2DBucket( |
| 2424 target, level, xoffset, yoffset, width, height, format, | 2424 target, level, xoffset, yoffset, width, height, format, |
| 2425 kResultBucketId); | 2425 kResultBucketId); |
| 2426 // Free the bucket. This is not required but it does free up the memory. | 2426 // Free the bucket. This is not required but it does free up the memory. |
| 2427 // and we don't have to wait for the result so from the client's perspective | 2427 // and we don't have to wait for the result so from the client's perspective |
| 2428 // it's cheap. | 2428 // it's cheap. |
| 2429 helper_->SetBucketSize(kResultBucketId, 0); | 2429 helper_->SetBucketSize(kResultBucketId, 0); |
| 2430 } else { |
| 2431 helper_->CompressedTexSubImage2D(target, level, xoffset, yoffset, width, |
| 2432 height, format, image_size, 0, 0); |
| 2430 } | 2433 } |
| 2431 CheckGLError(); | 2434 CheckGLError(); |
| 2432 } | 2435 } |
| 2433 | 2436 |
| 2434 void GLES2Implementation::CompressedTexImage3D( | 2437 void GLES2Implementation::CompressedTexImage3D( |
| 2435 GLenum target, GLint level, GLenum internalformat, GLsizei width, | 2438 GLenum target, GLint level, GLenum internalformat, GLsizei width, |
| 2436 GLsizei height, GLsizei depth, GLint border, GLsizei image_size, | 2439 GLsizei height, GLsizei depth, GLint border, GLsizei image_size, |
| 2437 const void* data) { | 2440 const void* data) { |
| 2438 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 2441 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
| 2439 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexImage3D(" | 2442 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexImage3D(" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 buffer->shm_id(), buffer->shm_offset() + offset); | 2517 buffer->shm_id(), buffer->shm_offset() + offset); |
| 2515 buffer->set_last_usage_token(helper_->InsertToken()); | 2518 buffer->set_last_usage_token(helper_->InsertToken()); |
| 2516 CheckGLError(); | 2519 CheckGLError(); |
| 2517 } | 2520 } |
| 2518 return; | 2521 return; |
| 2519 } | 2522 } |
| 2520 if (bound_pixel_unpack_buffer_) { | 2523 if (bound_pixel_unpack_buffer_) { |
| 2521 helper_->CompressedTexSubImage3D( | 2524 helper_->CompressedTexSubImage3D( |
| 2522 target, level, xoffset, yoffset, zoffset, width, height, depth, format, | 2525 target, level, xoffset, yoffset, zoffset, width, height, depth, format, |
| 2523 image_size, 0, ToGLuint(data)); | 2526 image_size, 0, ToGLuint(data)); |
| 2524 } else { | 2527 } else if (data) { |
| 2525 SetBucketContents(kResultBucketId, data, image_size); | 2528 SetBucketContents(kResultBucketId, data, image_size); |
| 2526 helper_->CompressedTexSubImage3DBucket( | 2529 helper_->CompressedTexSubImage3DBucket( |
| 2527 target, level, xoffset, yoffset, zoffset, width, height, depth, format, | 2530 target, level, xoffset, yoffset, zoffset, width, height, depth, format, |
| 2528 kResultBucketId); | 2531 kResultBucketId); |
| 2529 // Free the bucket. This is not required but it does free up the memory. | 2532 // Free the bucket. This is not required but it does free up the memory. |
| 2530 // and we don't have to wait for the result so from the client's perspective | 2533 // and we don't have to wait for the result so from the client's perspective |
| 2531 // it's cheap. | 2534 // it's cheap. |
| 2532 helper_->SetBucketSize(kResultBucketId, 0); | 2535 helper_->SetBucketSize(kResultBucketId, 0); |
| 2536 } else { |
| 2537 helper_->CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, |
| 2538 width, height, depth, format, image_size, |
| 2539 0, 0); |
| 2533 } | 2540 } |
| 2534 CheckGLError(); | 2541 CheckGLError(); |
| 2535 } | 2542 } |
| 2536 | 2543 |
| 2537 PixelStoreParams GLES2Implementation::GetUnpackParameters(Dimension dimension) { | 2544 PixelStoreParams GLES2Implementation::GetUnpackParameters(Dimension dimension) { |
| 2538 PixelStoreParams params; | 2545 PixelStoreParams params; |
| 2539 params.alignment = unpack_alignment_; | 2546 params.alignment = unpack_alignment_; |
| 2540 params.row_length = unpack_row_length_; | 2547 params.row_length = unpack_row_length_; |
| 2541 params.skip_pixels = unpack_skip_pixels_; | 2548 params.skip_pixels = unpack_skip_pixels_; |
| 2542 params.skip_rows = unpack_skip_rows_; | 2549 params.skip_rows = unpack_skip_rows_; |
| (...skipping 4529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7072 CheckGLError(); | 7079 CheckGLError(); |
| 7073 } | 7080 } |
| 7074 | 7081 |
| 7075 // Include the auto-generated part of this file. We split this because it means | 7082 // Include the auto-generated part of this file. We split this because it means |
| 7076 // we can easily edit the non-auto generated parts right here in this file | 7083 // we can easily edit the non-auto generated parts right here in this file |
| 7077 // instead of having to edit some template or the code generator. | 7084 // instead of having to edit some template or the code generator. |
| 7078 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 7085 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 7079 | 7086 |
| 7080 } // namespace gles2 | 7087 } // namespace gles2 |
| 7081 } // namespace gpu | 7088 } // namespace gpu |
| OLD | NEW |