Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2447423002: Handle CompressedTex{Sub}Image{2|3}D interaction with PBO. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 "glCompressedTexSubImage2D", offset, image_size); 2373 "glCompressedTexSubImage2D", offset, image_size);
2374 if (buffer && buffer->shm_id() != -1) { 2374 if (buffer && buffer->shm_id() != -1) {
2375 helper_->CompressedTexSubImage2D( 2375 helper_->CompressedTexSubImage2D(
2376 target, level, xoffset, yoffset, width, height, format, image_size, 2376 target, level, xoffset, yoffset, width, height, format, image_size,
2377 buffer->shm_id(), buffer->shm_offset() + offset); 2377 buffer->shm_id(), buffer->shm_offset() + offset);
2378 buffer->set_last_usage_token(helper_->InsertToken()); 2378 buffer->set_last_usage_token(helper_->InsertToken());
2379 CheckGLError(); 2379 CheckGLError();
2380 } 2380 }
2381 return; 2381 return;
2382 } 2382 }
2383 SetBucketContents(kResultBucketId, data, image_size); 2383 if (bound_pixel_unpack_buffer_) {
2384 helper_->CompressedTexSubImage2DBucket( 2384 helper_->CompressedTexSubImage2D(
2385 target, level, xoffset, yoffset, width, height, format, kResultBucketId); 2385 target, level, xoffset, yoffset, width, height, format, image_size,
2386 // Free the bucket. This is not required but it does free up the memory. 2386 0, ToGLuint(data));
2387 // and we don't have to wait for the result so from the client's perspective 2387 } else {
2388 // it's cheap. 2388 SetBucketContents(kResultBucketId, data, image_size);
2389 helper_->SetBucketSize(kResultBucketId, 0); 2389 helper_->CompressedTexSubImage2DBucket(
2390 target, level, xoffset, yoffset, width, height, format,
2391 kResultBucketId);
2392 // Free the bucket. This is not required but it does free up the memory.
2393 // and we don't have to wait for the result so from the client's perspective
2394 // it's cheap.
2395 helper_->SetBucketSize(kResultBucketId, 0);
2396 }
2390 CheckGLError(); 2397 CheckGLError();
2391 } 2398 }
2392 2399
2393 void GLES2Implementation::CompressedTexImage3D( 2400 void GLES2Implementation::CompressedTexImage3D(
2394 GLenum target, GLint level, GLenum internalformat, GLsizei width, 2401 GLenum target, GLint level, GLenum internalformat, GLsizei width,
2395 GLsizei height, GLsizei depth, GLint border, GLsizei image_size, 2402 GLsizei height, GLsizei depth, GLint border, GLsizei image_size,
2396 const void* data) { 2403 const void* data) {
2397 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2404 GPU_CLIENT_SINGLE_THREAD_CHECK();
2398 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexImage3D(" 2405 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCompressedTexImage3D("
2399 << GLES2Util::GetStringTexture3DTarget(target) << ", " << level << ", " 2406 << GLES2Util::GetStringTexture3DTarget(target) << ", " << level << ", "
(...skipping 16 matching lines...) Expand all
2416 bound_pixel_unpack_transfer_buffer_id_, 2423 bound_pixel_unpack_transfer_buffer_id_,
2417 "glCompressedTexImage3D", offset, image_size); 2424 "glCompressedTexImage3D", offset, image_size);
2418 if (buffer && buffer->shm_id() != -1) { 2425 if (buffer && buffer->shm_id() != -1) {
2419 helper_->CompressedTexImage3D( 2426 helper_->CompressedTexImage3D(
2420 target, level, internalformat, width, height, depth, image_size, 2427 target, level, internalformat, width, height, depth, image_size,
2421 buffer->shm_id(), buffer->shm_offset() + offset); 2428 buffer->shm_id(), buffer->shm_offset() + offset);
2422 buffer->set_last_usage_token(helper_->InsertToken()); 2429 buffer->set_last_usage_token(helper_->InsertToken());
2423 } 2430 }
2424 return; 2431 return;
2425 } 2432 }
2426 if (data) { 2433 if (bound_pixel_unpack_buffer_) {
2434 helper_->CompressedTexImage3D(
2435 target, level, internalformat, width, height, depth, image_size,
2436 0, ToGLuint(data));
2437 } else if (data) {
2427 SetBucketContents(kResultBucketId, data, image_size); 2438 SetBucketContents(kResultBucketId, data, image_size);
2428 helper_->CompressedTexImage3DBucket(target, level, internalformat, width, 2439 helper_->CompressedTexImage3DBucket(target, level, internalformat, width,
2429 height, depth, kResultBucketId); 2440 height, depth, kResultBucketId);
2430 // Free the bucket. This is not required but it does free up the memory. 2441 // Free the bucket. This is not required but it does free up the memory.
2431 // and we don't have to wait for the result so from the client's perspective 2442 // and we don't have to wait for the result so from the client's perspective
2432 // it's cheap. 2443 // it's cheap.
2433 helper_->SetBucketSize(kResultBucketId, 0); 2444 helper_->SetBucketSize(kResultBucketId, 0);
2434 } else { 2445 } else {
2435 helper_->CompressedTexImage3D(target, level, internalformat, width, height, 2446 helper_->CompressedTexImage3D(target, level, internalformat, width, height,
2436 depth, image_size, 0, 0); 2447 depth, image_size, 0, 0);
(...skipping 28 matching lines...) Expand all
2465 if (buffer && buffer->shm_id() != -1) { 2476 if (buffer && buffer->shm_id() != -1) {
2466 helper_->CompressedTexSubImage3D( 2477 helper_->CompressedTexSubImage3D(
2467 target, level, xoffset, yoffset, zoffset, 2478 target, level, xoffset, yoffset, zoffset,
2468 width, height, depth, format, image_size, 2479 width, height, depth, format, image_size,
2469 buffer->shm_id(), buffer->shm_offset() + offset); 2480 buffer->shm_id(), buffer->shm_offset() + offset);
2470 buffer->set_last_usage_token(helper_->InsertToken()); 2481 buffer->set_last_usage_token(helper_->InsertToken());
2471 CheckGLError(); 2482 CheckGLError();
2472 } 2483 }
2473 return; 2484 return;
2474 } 2485 }
2475 SetBucketContents(kResultBucketId, data, image_size); 2486 if (bound_pixel_unpack_buffer_) {
2476 helper_->CompressedTexSubImage3DBucket( 2487 helper_->CompressedTexSubImage3D(
2477 target, level, xoffset, yoffset, zoffset, width, height, depth, format, 2488 target, level, xoffset, yoffset, zoffset, width, height, depth, format,
2478 kResultBucketId); 2489 image_size, 0, ToGLuint(data));
2479 // Free the bucket. This is not required but it does free up the memory. 2490 } else {
2480 // and we don't have to wait for the result so from the client's perspective 2491 SetBucketContents(kResultBucketId, data, image_size);
2481 // it's cheap. 2492 helper_->CompressedTexSubImage3DBucket(
2482 helper_->SetBucketSize(kResultBucketId, 0); 2493 target, level, xoffset, yoffset, zoffset, width, height, depth, format,
2494 kResultBucketId);
2495 // Free the bucket. This is not required but it does free up the memory.
2496 // and we don't have to wait for the result so from the client's perspective
2497 // it's cheap.
2498 helper_->SetBucketSize(kResultBucketId, 0);
2499 }
2483 CheckGLError(); 2500 CheckGLError();
2484 } 2501 }
2485 2502
2486 PixelStoreParams GLES2Implementation::GetUnpackParameters(Dimension dimension) { 2503 PixelStoreParams GLES2Implementation::GetUnpackParameters(Dimension dimension) {
2487 PixelStoreParams params; 2504 PixelStoreParams params;
2488 params.alignment = unpack_alignment_; 2505 params.alignment = unpack_alignment_;
2489 params.row_length = unpack_row_length_; 2506 params.row_length = unpack_row_length_;
2490 params.skip_pixels = unpack_skip_pixels_; 2507 params.skip_pixels = unpack_skip_pixels_;
2491 params.skip_rows = unpack_skip_rows_; 2508 params.skip_rows = unpack_skip_rows_;
2492 if (dimension == k3D) { 2509 if (dimension == k3D) {
(...skipping 4515 matching lines...) Expand 10 before | Expand all | Expand 10 after
7008 cached_extensions_.clear(); 7025 cached_extensions_.clear();
7009 } 7026 }
7010 7027
7011 // Include the auto-generated part of this file. We split this because it means 7028 // Include the auto-generated part of this file. We split this because it means
7012 // we can easily edit the non-auto generated parts right here in this file 7029 // we can easily edit the non-auto generated parts right here in this file
7013 // instead of having to edit some template or the code generator. 7030 // instead of having to edit some template or the code generator.
7014 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 7031 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
7015 7032
7016 } // namespace gles2 7033 } // namespace gles2
7017 } // namespace gpu 7034 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698