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

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

Issue 1058833004: Make CreateAndConsumeTexture always associate client_id with a service_id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« 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.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index d1d1d9ce97e67a92688eff24a752e9cb06fd542a..4652c38b229ddf58da8775ee4f000c6e17c6b47f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -967,6 +967,7 @@ class GLES2DecoderImpl : public GLES2Decoder,
void ProduceTextureRef(std::string func_name, TextureRef* texture_ref,
GLenum target, const GLbyte* data);
+ void EnsureTextureForClientId(GLuint client_id);
void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key);
void DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* key,
GLuint client_id);
@@ -11679,6 +11680,19 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
}
}
+void GLES2DecoderImpl::EnsureTextureForClientId(GLuint client_id) {
+ TextureRef* texture_ref = GetTexture(client_id);
+ if (!texture_ref) {
+ GLuint service_id;
+ glGenTextures(1, &service_id);
+ DCHECK_NE(0u, service_id);
+ CreateTexture(client_id, service_id);
piman 2015/04/03 18:17:14 I think we also want to do the texture_manager()->
+ }
+}
+
+// If CreateAndConsumeTexture fails we still need to ensure that the client_id
+// provided is associated with a service_id/TextureRef for consistency, even if
+// the resulting texture is incomplete.
error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate(
uint32_t immediate_data_size,
const void* cmd_data) {
@@ -11687,24 +11701,28 @@ error::Error GLES2DecoderImpl::HandleCreateAndConsumeTextureCHROMIUMImmediate(
const gles2::cmds::CreateAndConsumeTextureCHROMIUMImmediate*>(
cmd_data);
GLenum target = static_cast<GLenum>(c.target);
+ uint32_t client_id = c.client_id;
uint32_t data_size;
if (!ComputeDataSize(1, sizeof(GLbyte), 64, &data_size)) {
+ EnsureTextureForClientId(client_id);
piman 2015/04/03 18:17:14 I think it's ok to skip here. We're losing the con
return error::kOutOfBounds;
}
if (data_size > immediate_data_size) {
+ EnsureTextureForClientId(client_id);
piman 2015/04/03 18:17:15 Here too.
return error::kOutOfBounds;
}
const GLbyte* mailbox =
GetImmediateDataAs<const GLbyte*>(c, data_size, immediate_data_size);
if (!validators_->texture_bind_target.IsValid(target)) {
+ EnsureTextureForClientId(client_id);
piman 2015/04/03 18:17:14 Here too. Because we don't have a valid target, af
LOCAL_SET_GL_ERROR_INVALID_ENUM(
"glCreateAndConsumeTextureCHROMIUM", target, "target");
return error::kNoError;
}
if (mailbox == NULL) {
+ EnsureTextureForClientId(client_id);
piman 2015/04/03 18:17:14 Here too.
return error::kOutOfBounds;
}
- uint32_t client_id = c.client_id;
DoCreateAndConsumeTextureCHROMIUM(target, mailbox, client_id);
return error::kNoError;
}
@@ -11721,6 +11739,8 @@ void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target,
TextureRef* texture_ref = GetTexture(client_id);
if (texture_ref) {
+ // No need to call EnsureTextureForClientId here, the client_id already has
+ // an associated texture.
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCreateAndConsumeTextureCHROMIUM", "client id already in use");
@@ -11728,12 +11748,15 @@ void GLES2DecoderImpl::DoCreateAndConsumeTextureCHROMIUM(GLenum target,
}
Texture* texture = group_->mailbox_manager()->ConsumeTexture(mailbox);
if (!texture) {
+ EnsureTextureForClientId(client_id);
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCreateAndConsumeTextureCHROMIUM", "invalid mailbox name");
return;
}
+
if (texture->target() != target) {
+ EnsureTextureForClientId(client_id);
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
"glCreateAndConsumeTextureCHROMIUM", "invalid target");
« 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