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

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

Issue 3150026: Fixes for the default texture.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 57082)
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy)
@@ -273,7 +273,7 @@
};
#if defined(GLES2_GPU_SERVICE_TRANSLATE_SHADER)
-void FinalizeShaderTranslator(void*) {
+void FinalizeShaderTranslator(void* /* dummy */) {
ShFinalize();
}
@@ -1226,12 +1226,6 @@
// Which textures are bound to texture units through glActiveTexture.
scoped_array<TextureUnit> texture_units_;
- // Black (0,0,0,1) textures for when non-renderable textures are used.
- // NOTE: There is no corresponding TextureInfo for these textures.
- // TextureInfos are only for textures the client side can access.
- GLuint black_2d_texture_id_;
- GLuint black_cube_texture_id_;
-
// state saved for clearing so we can clear render buffers and then
// restore to these values.
GLclampf clear_red_;
@@ -1525,8 +1519,6 @@
attrib_0_buffer_id_(0),
attrib_0_size_(0),
active_texture_unit_(0),
- black_2d_texture_id_(0),
- black_cube_texture_id_(0),
clear_red_(0),
clear_green_(0),
clear_blue_(0),
@@ -1616,28 +1608,17 @@
texture_units_.reset(
new TextureUnit[group_->max_texture_units()]);
for (uint32 tt = 0; tt < group_->max_texture_units(); ++tt) {
- texture_units_[tt].bound_texture_2d =
- texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
- texture_units_[tt].bound_texture_cube_map =
+ glActiveTexture(GL_TEXTURE0 + tt);
+ // Do cube map first because we want the last bind to be 2D.
+ TextureManager::TextureInfo* info =
texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
+ texture_units_[tt].bound_texture_cube_map = info;
+ glBindTexture(GL_TEXTURE_CUBE_MAP, info->service_id());
+ info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
+ texture_units_[tt].bound_texture_2d = info;
+ glBindTexture(GL_TEXTURE_2D, info->service_id());
}
-
- GLuint ids[2];
- glGenTextures(2, ids);
- // Make black textures for replacing non-renderable textures.
- black_2d_texture_id_ = ids[0];
- black_cube_texture_id_ = ids[1];
- static uint8 black[] = {0, 0, 0, 255};
- glBindTexture(GL_TEXTURE_2D, black_2d_texture_id_);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, black);
- glBindTexture(GL_TEXTURE_2D, 0);
- glBindTexture(GL_TEXTURE_CUBE_MAP, black_cube_texture_id_);
- for (int ii = 0; ii < GLES2Util::kNumFaces; ++ii) {
- glTexImage2D(GLES2Util::IndexToGLFaceTarget(ii), 0, GL_RGBA, 1, 1, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, black);
- }
- glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
+ glActiveTexture(GL_TEXTURE0);
CHECK_GL_ERROR();
if (context_->IsOffscreen()) {
@@ -2115,12 +2096,6 @@
if (context_.get()) {
MakeCurrent();
- if (black_2d_texture_id_) {
- glDeleteTextures(1, &black_2d_texture_id_);
- }
- if (black_cube_texture_id_) {
- glDeleteTextures(1, &black_cube_texture_id_);
- }
if (attrib_0_buffer_id_) {
glDeleteBuffersARB(1, &attrib_0_buffer_id_);
}
@@ -3464,8 +3439,7 @@
glBindTexture(
uniform_info->type == GL_SAMPLER_2D ? GL_TEXTURE_2D :
GL_TEXTURE_CUBE_MAP,
- uniform_info->type == GL_SAMPLER_2D ? black_2d_texture_id_ :
- black_cube_texture_id_);
+ texture_manager()->black_texture_id(uniform_info->type));
}
}
// else: should this be an error?
« no previous file with comments | « gpu/command_buffer/service/context_group_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