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

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

Issue 1335873002: Initialize default texture for GL_TEXTURE_3D and GL_TEXTURE_2D_ARRAY (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gpu_unittests Created 5 years, 3 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/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 2dc27e7ddc8e29e15f15fc10598784f7a3f7f94b..c3c43852ae856d95a68a446d79ba0722b6f61d6b 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -1413,6 +1413,13 @@ bool TextureManager::Initialize() {
default_textures_[kCubeMap] = CreateDefaultAndBlackTextures(
GL_TEXTURE_CUBE_MAP, &black_texture_ids_[kCubeMap]);
+ if (feature_info_->IsES3Capable()) {
Zhenyao Mo 2015/09/14 21:12:06 IsES3Enabled(). Otherwise we are still emulating E
qiankun 2015/09/15 09:14:59 Done.
+ default_textures_[kTexture3D] = CreateDefaultAndBlackTextures(
+ GL_TEXTURE_3D, &black_texture_ids_[kTexture3D]);
+ default_textures_[kTexture2DArray] = CreateDefaultAndBlackTextures(
+ GL_TEXTURE_2D_ARRAY, &black_texture_ids_[kTexture2DArray]);
+ }
+
if (feature_info_->feature_flags().oes_egl_image_external) {
default_textures_[kExternalOES] = CreateDefaultAndBlackTextures(
GL_TEXTURE_EXTERNAL_OES, &black_texture_ids_[kExternalOES]);
@@ -1443,6 +1450,8 @@ scoped_refptr<TextureRef>
// black values according to the spec.
bool needs_initialization = (target != GL_TEXTURE_EXTERNAL_OES);
bool needs_faces = (target == GL_TEXTURE_CUBE_MAP);
+ bool is_3d_or_2d_array_target = (target == GL_TEXTURE_3D ||
+ target == GL_TEXTURE_2D_ARRAY);
// Make default textures and texture for replacing non-renderable textures.
GLuint ids[2];
@@ -1457,8 +1466,13 @@ scoped_refptr<TextureRef>
GL_RGBA, GL_UNSIGNED_BYTE, black);
}
} else {
- glTexImage2D(target, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, black);
+ if (is_3d_or_2d_array_target) {
+ glTexImage3D(target, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, black);
+ } else {
+ glTexImage2D(target, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, black);
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698