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

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

Issue 224763002: Remove default textures in (!bind_generates_resource) context groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use kBindGeneratesResource in context_group_unittest.cc. Created 6 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
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 c70a999faaf7ddbd539bfc30d84f70131766f72e..082a6a92ce5c8199e18eb7f756392c10feb45e1f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2394,20 +2394,20 @@ bool GLES2DecoderImpl::Initialize(
ref = texture_manager()->GetDefaultTextureInfo(
GL_TEXTURE_EXTERNAL_OES);
state_.texture_units[tt].bound_texture_external_oes = ref;
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref->service_id());
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, ref ? ref->service_id() : 0);
}
if (features().arb_texture_rectangle) {
ref = texture_manager()->GetDefaultTextureInfo(
GL_TEXTURE_RECTANGLE_ARB);
state_.texture_units[tt].bound_texture_rectangle_arb = ref;
- glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ref->service_id());
+ glBindTexture(GL_TEXTURE_RECTANGLE_ARB, ref ? ref->service_id() : 0);
}
ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
state_.texture_units[tt].bound_texture_cube_map = ref;
- glBindTexture(GL_TEXTURE_CUBE_MAP, ref->service_id());
+ glBindTexture(GL_TEXTURE_CUBE_MAP, ref ? ref->service_id() : 0);
ref = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
state_.texture_units[tt].bound_texture_2d = ref;
- glBindTexture(GL_TEXTURE_2D, ref->service_id());
+ glBindTexture(GL_TEXTURE_2D, ref ? ref->service_id() : 0);
}
glActiveTexture(GL_TEXTURE0);
CHECK_GL_ERROR();
@@ -4041,21 +4041,25 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
} else {
texture_ref = texture_manager()->GetDefaultTextureInfo(target);
}
- Texture* texture = texture_ref->texture();
// Check the texture exists
- // Check that we are not trying to bind it to a different target.
- if (texture->target() != 0 && texture->target() != target) {
- LOCAL_SET_GL_ERROR(
- GL_INVALID_OPERATION,
- "glBindTexture", "texture bound to more than 1 target.");
- return;
- }
- LogClientServiceForInfo(texture, client_id, "glBindTexture");
- if (texture->target() == 0) {
- texture_manager()->SetTarget(texture_ref, target);
+ if (texture_ref) {
+ Texture* texture = texture_ref->texture();
+ // Check that we are not trying to bind it to a different target.
+ if (texture->target() != 0 && texture->target() != target) {
+ LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION,
+ "glBindTexture",
+ "texture bound to more than 1 target.");
+ return;
+ }
+ LogClientServiceForInfo(texture, client_id, "glBindTexture");
+ if (texture->target() == 0) {
+ texture_manager()->SetTarget(texture_ref, target);
+ }
+ glBindTexture(target, texture->service_id());
+ } else {
+ glBindTexture(target, 0);
}
- glBindTexture(target, texture->service_id());
TextureUnit& unit = state_.texture_units[state_.active_texture_unit];
unit.bind_target = target;
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698