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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 10012057: Add GL_EXT_unpack_subimage support to command buffer client code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder.cc (revision 131422)
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy)
@@ -1658,8 +1658,9 @@
bool success = glGetError() == GL_NO_ERROR;
if (success) {
uint32 image_size = 0;
- GLES2Util::ComputeImageDataSize(
- size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size);
+ GLES2Util::ComputeImageDataSizes(
+ size.width(), size.height(), format, GL_UNSIGNED_BYTE, 4, &image_size,
+ NULL, NULL);
estimated_size_ = image_size;
decoder_->UpdateBackbufferMemoryAccounting();
}
@@ -5972,8 +5973,8 @@
}
typedef gles2::ReadPixels::Result Result;
uint32 pixels_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, pack_alignment_, &pixels_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, pack_alignment_, &pixels_size, NULL, NULL)) {
return error::kOutOfBounds;
}
void* pixels = GetSharedMemoryAs<void*>(
@@ -6018,27 +6019,20 @@
// The user requested an out of range area. Get the results 1 line
// at a time.
uint32 temp_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, 1, format, type, pack_alignment_, &temp_size)) {
+ uint32 unpadded_row_size;
+ uint32 padded_row_size;
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, 2, format, type, pack_alignment_, &temp_size,
+ &unpadded_row_size, &padded_row_size)) {
SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
return error::kNoError;
}
- GLsizei unpadded_row_size = temp_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, 2, format, type, pack_alignment_, &temp_size)) {
- SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
- return error::kNoError;
- }
- GLsizei padded_row_size = temp_size - unpadded_row_size;
- if (padded_row_size < 0 || unpadded_row_size < 0) {
- SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
- return error::kNoError;
- }
GLint dest_x_offset = std::max(-x, 0);
uint32 dest_row_offset;
- if (!GLES2Util::ComputeImageDataSize(
- dest_x_offset, 1, format, type, pack_alignment_, &dest_row_offset)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ dest_x_offset, 1, format, type, pack_alignment_, &dest_row_offset, NULL,
+ NULL)) {
SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
return error::kNoError;
}
@@ -6073,22 +6067,15 @@
if ((channels_exist & 0x0008) == 0) {
// Set the alpha to 255 because some drivers are buggy in this regard.
uint32 temp_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, 1, format, type, pack_alignment_, &temp_size)) {
+
+ uint32 unpadded_row_size;
+ uint32 padded_row_size;
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, 2, format, type, pack_alignment_, &temp_size,
+ &unpadded_row_size, &padded_row_size)) {
SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
return error::kNoError;
}
- GLsizei unpadded_row_size = temp_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, 2, format, type, pack_alignment_, &temp_size)) {
- SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
- return error::kNoError;
- }
- GLsizei padded_row_size = temp_size - unpadded_row_size;
- if (padded_row_size < 0 || unpadded_row_size < 0) {
- SetGLError(GL_INVALID_VALUE, "glReadPixels: dimensions out of range");
- return error::kNoError;
- }
// NOTE: Assumes the type is GL_UNSIGNED_BYTE which was true at the time
// of this implementation.
if (type != GL_UNSIGNED_BYTE) {
@@ -6464,8 +6451,9 @@
bool is_texture_immutable) {
// Assumes the size has already been checked.
uint32 pixels_size = 0;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &pixels_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &pixels_size, NULL,
+ NULL)) {
return false;
}
scoped_array<char> zero(new char[pixels_size]);
@@ -6772,8 +6760,9 @@
uint32 pixels_shm_id = static_cast<uint32>(c.pixels_shm_id);
uint32 pixels_shm_offset = static_cast<uint32>(c.pixels_shm_offset);
uint32 pixels_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &pixels_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &pixels_size, NULL,
+ NULL)) {
return error::kOutOfBounds;
}
const void* pixels = NULL;
@@ -6800,8 +6789,8 @@
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
uint32 size;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &size, NULL, NULL)) {
return error::kOutOfBounds;
}
const void* pixels = GetImmediateDataAs<const void*>(
@@ -7027,8 +7016,9 @@
copyHeight != height) {
// some part was clipped so clear the sub rect.
uint32 pixels_size = 0;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &pixels_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &pixels_size, NULL,
+ NULL)) {
SetGLError(GL_INVALID_VALUE, "glCopyTexSubImage2D: dimensions too large");
return;
}
@@ -7135,8 +7125,8 @@
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
uint32 data_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &data_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) {
return error::kOutOfBounds;
}
const void* pixels = GetSharedMemoryAs<const void*>(
@@ -7184,8 +7174,8 @@
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
uint32 data_size;
- if (!GLES2Util::ComputeImageDataSize(
- width, height, format, type, unpack_alignment_, &data_size)) {
+ if (!GLES2Util::ComputeImageDataSizes(
+ width, height, format, type, unpack_alignment_, &data_size, NULL, NULL)) {
return error::kOutOfBounds;
}
const void* pixels = GetImmediateDataAs<const void*>(
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils_unittest.cc ('k') | gpu/command_buffer/service/texture_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698