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

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

Issue 7458008: Support GL_OES_EGL_image_external (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 5 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 e989af649316a19fca2633158c46c5b2e5cb8a93..922abda143ff1dc5a996d7b337141c8685fd9899 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -517,6 +517,10 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
// texture currently bound to this unit's GL_TEXTURE_CUBE_MAP with
// glBindTexture
TextureManager::TextureInfo::Ref bound_texture_cube_map;
+
+ // texture currently bound to this unit's GL_TEXTURE_EXTERNAL_OES with
+ // glBindTexture
+ TextureManager::TextureInfo::Ref bound_texture_external_oes;
};
// Initialize or re-initialize the shader translator.
@@ -1094,6 +1098,9 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
info = unit.bound_texture_cube_map;
break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ info = unit.bound_texture_external_oes;
+ break;
// Note: If we ever support TEXTURE_RECTANGLE as a target, be sure to
// track |texture_| with the currently bound TEXTURE_RECTANGLE texture,
// because |texture_| is used by the FBO rendering mechanism for readback
@@ -1727,9 +1734,14 @@ bool GLES2DecoderImpl::Initialize(
new TextureUnit[group_->max_texture_units()]);
for (uint32 tt = 0; tt < group_->max_texture_units(); ++tt) {
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);
+ // We want the last bind to be 2D.
+ TextureManager::TextureInfo* info;
+ if (feature_info_->feature_flags().oes_egl_image_external) {
+ info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_EXTERNAL_OES);
+ texture_units_[tt].bound_texture_external_oes = info;
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, info->service_id());
+ }
+ 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);
@@ -2819,6 +2831,12 @@ void GLES2DecoderImpl::DoBindTexture(GLenum target, GLuint client_id) {
case GL_TEXTURE_CUBE_MAP:
unit.bound_texture_cube_map = info;
break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ if (feature_info_->feature_flags().oes_egl_image_external)
greggman 2011/07/20 01:41:18 I don't think you need to check here. If the featu
+ unit.bound_texture_external_oes = info;
+ else
+ NOTREACHED(); // Validation should prevent us getting here.
+ break;
default:
NOTREACHED(); // Validation should prevent us getting here.
break;
@@ -3113,6 +3131,20 @@ bool GLES2DecoderImpl::GetHelper(
}
}
return true;
+ case GL_TEXTURE_BINDING_EXTERNAL_OES:
+ *num_written = 1;
+ if (params) {
+ TextureUnit& unit = texture_units_[active_texture_unit_];
+ if (unit.bound_texture_external_oes) {
+ GLuint client_id = 0;
+ texture_manager()->GetClientId(
+ unit.bound_texture_external_oes->service_id(), &client_id);
+ *params = client_id;
+ } else {
+ *params = 0;
+ }
+ }
+ return true;
default:
*num_written = util_.GLGetNumValuesReturned(pname);
return false;
@@ -3882,7 +3914,8 @@ void GLES2DecoderImpl::DoUniform1iv(
if (!PrepForSetUniformByLocation(location, "glUniform1iv", &type, &count)) {
return;
}
- if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE) {
+ if (type == GL_SAMPLER_2D || type == GL_SAMPLER_CUBE ||
+ type == GL_SAMPLER_EXTERNAL_OES) {
current_program_->SetSamplers(location, count, value);
}
glUniform1iv(location, count, value);
@@ -4110,13 +4143,16 @@ bool GLES2DecoderImpl::SetBlackTextureForNonRenderableTextures() {
TextureManager::TextureInfo* texture_info =
greggman 2011/07/20 01:41:18 This seems like it should be a function now that i
uniform_info->type == GL_SAMPLER_2D ?
texture_unit.bound_texture_2d :
- texture_unit.bound_texture_cube_map;
+ (uniform_info->type == GL_SAMPLER_EXTERNAL_OES ?
+ texture_unit.bound_texture_external_oes :
+ texture_unit.bound_texture_cube_map);
if (!texture_info || !texture_info->CanRender(feature_info_)) {
textures_set = true;
glActiveTexture(GL_TEXTURE0 + texture_unit_index);
glBindTexture(
uniform_info->type == GL_SAMPLER_2D ? GL_TEXTURE_2D :
- GL_TEXTURE_CUBE_MAP,
+ (uniform_info->type == GL_SAMPLER_EXTERNAL_OES ?
greggman 2011/07/20 01:41:18 This also seems like it might be better as a funct
+ GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_CUBE_MAP),
texture_manager()->black_texture_id(uniform_info->type));
}
}

Powered by Google App Engine
This is Rietveld 408576698