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

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

Issue 2587583002: gles2_cmd_decoder_passthrough: Handle Tex[Sub]Image[2/3]D with empty shm (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc
index d07e49b7fd5a818432e6429098db405fec6886b7..aba98b61a3d750ea5d67f7c867e44ba33c48db2e 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_handlers.cc
@@ -926,22 +926,23 @@ error::Error GLES2DecoderPassthroughImpl::HandleTexImage2D(
GLint border = static_cast<GLint>(c.border);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
+ uint32_t pixels_shm_id = c.pixels_shm_id;
+ uint32_t pixels_shm_offset = c.pixels_shm_offset;
- GLsizei imagesize = 0;
- const void* pixels = NULL;
- if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) {
- unsigned int buffer_size = 0;
+ unsigned int buffer_size = 0;
+ const void* pixels = nullptr;
+
+ if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
- c.pixels_shm_id, c.pixels_shm_offset, &buffer_size);
+ pixels_shm_id, pixels_shm_offset, &buffer_size);
if (!pixels) {
return error::kOutOfBounds;
}
- imagesize = buffer_size;
}
error::Error error =
DoTexImage2D(target, level, internal_format, width, height, border,
- format, type, imagesize, pixels);
+ format, type, buffer_size, pixels);
if (error != error::kNoError) {
return error;
}
@@ -963,22 +964,23 @@ error::Error GLES2DecoderPassthroughImpl::HandleTexImage3D(
GLint border = static_cast<GLint>(c.border);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
+ uint32_t pixels_shm_id = c.pixels_shm_id;
+ uint32_t pixels_shm_offset = c.pixels_shm_offset;
+
+ unsigned int buffer_size = 0;
+ const void* pixels = nullptr;
- GLsizei imagesize = 0;
- const void* pixels = NULL;
- if (c.pixels_shm_id != 0 || c.pixels_shm_offset != 0) {
- unsigned int buffer_size = 0;
+ if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
- c.pixels_shm_id, c.pixels_shm_offset, &buffer_size);
+ pixels_shm_id, pixels_shm_offset, &buffer_size);
if (!pixels) {
return error::kOutOfBounds;
}
- imagesize = buffer_size;
}
error::Error error =
DoTexImage3D(target, level, internal_format, width, height, depth, border,
- format, type, imagesize, pixels);
+ format, type, buffer_size, pixels);
if (error != error::kNoError) {
return error;
}
@@ -999,17 +1001,23 @@ error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage2D(
GLsizei height = static_cast<GLsizei>(c.height);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
+ uint32_t pixels_shm_id = c.pixels_shm_id;
+ uint32_t pixels_shm_offset = c.pixels_shm_offset;
unsigned int buffer_size = 0;
- const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
- c.pixels_shm_id, c.pixels_shm_offset, &buffer_size);
- if (!pixels) {
- return error::kOutOfBounds;
+ const void* pixels = nullptr;
+
+ if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
+ pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
+ pixels_shm_id, pixels_shm_offset, &buffer_size);
+ if (!pixels) {
+ return error::kOutOfBounds;
+ }
}
- GLsizei imagesize = buffer_size;
- error::Error error = DoTexSubImage2D(target, level, xoffset, yoffset, width,
- height, format, type, imagesize, pixels);
+ error::Error error =
+ DoTexSubImage2D(target, level, xoffset, yoffset, width, height, format,
+ type, buffer_size, pixels);
if (error != error::kNoError) {
return error;
}
@@ -1032,18 +1040,23 @@ error::Error GLES2DecoderPassthroughImpl::HandleTexSubImage3D(
GLsizei depth = static_cast<GLsizei>(c.depth);
GLenum format = static_cast<GLenum>(c.format);
GLenum type = static_cast<GLenum>(c.type);
+ uint32_t pixels_shm_id = c.pixels_shm_id;
+ uint32_t pixels_shm_offset = c.pixels_shm_offset;
unsigned int buffer_size = 0;
- const void* pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
- c.pixels_shm_id, c.pixels_shm_offset, &buffer_size);
- if (!pixels) {
- return error::kOutOfBounds;
+ const void* pixels = nullptr;
+
+ if (pixels_shm_id != 0 || pixels_shm_offset != 0) {
+ pixels = GetSharedMemoryAndSizeAs<uint8_t*>(
+ pixels_shm_id, pixels_shm_offset, &buffer_size);
+ if (!pixels) {
+ return error::kOutOfBounds;
+ }
}
- GLsizei imagesize = buffer_size;
error::Error error =
DoTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height,
- depth, format, type, imagesize, pixels);
+ depth, format, type, buffer_size, pixels);
if (error != error::kNoError) {
return error;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698