| 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 596c1098a9da2a2330d005ee586a9c7e6d419344..bb83d48bfa1bed7b672c0312bb6ee20b44f085ff 100644
|
| --- a/gpu/command_buffer/service/texture_manager.cc
|
| +++ b/gpu/command_buffer/service/texture_manager.cc
|
| @@ -20,6 +20,7 @@ static GLsizei ComputeMipMapCount(
|
| static size_t GLTargetToFaceIndex(GLenum target) {
|
| switch (target) {
|
| case GL_TEXTURE_2D:
|
| + case GL_TEXTURE_EXTERNAL_OES:
|
| return 0;
|
| case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
|
| return 0;
|
| @@ -142,7 +143,8 @@ bool TextureManager::TextureInfo::MarkMipmapsGenerated(
|
| bool TextureManager::TextureInfo::CanGenerateMipmaps(
|
| const FeatureInfo* feature_info) const {
|
| if ((npot() && !feature_info->feature_flags().npot_ok) ||
|
| - level_infos_.empty() || IsDeleted()) {
|
| + level_infos_.empty() || IsDeleted() ||
|
| + target_ == GL_TEXTURE_EXTERNAL_OES) {
|
| return false;
|
| }
|
| const TextureInfo::LevelInfo& first = level_infos_[0][0];
|
| @@ -259,6 +261,16 @@ bool TextureManager::TextureInfo::GetLevelType(
|
| bool TextureManager::TextureInfo::SetParameter(
|
| const FeatureInfo* feature_info, GLenum pname, GLint param) {
|
| DCHECK(feature_info);
|
| +
|
| + if (target_ == GL_TEXTURE_EXTERNAL_OES) {
|
| + if (pname == GL_TEXTURE_MIN_FILTER &&
|
| + (param != GL_NEAREST && param != GL_LINEAR))
|
| + return false;
|
| + if ((pname == GL_TEXTURE_WRAP_S || pname == GL_TEXTURE_WRAP_T) &&
|
| + param != GL_CLAMP_TO_EDGE)
|
| + return false;
|
| + }
|
| +
|
| switch (pname) {
|
| case GL_TEXTURE_MIN_FILTER:
|
| if (!feature_info->validators()->texture_min_filter_mode.IsValid(param)) {
|
| @@ -391,7 +403,7 @@ TextureManager::TextureManager(
|
| black_cube_texture_id_(0) {
|
| }
|
|
|
| -bool TextureManager::Initialize() {
|
| +bool TextureManager::Initialize(const FeatureInfo* feature_info) {
|
| // TODO(gman): The default textures have to be real textures, not the 0
|
| // texture because we simulate non shared resources on top of shared
|
| // resources and all contexts that share resource share the same default
|
| @@ -430,6 +442,31 @@ bool TextureManager::Initialize() {
|
| black_2d_texture_id_ = ids[0];
|
| black_cube_texture_id_ = ids[2];
|
|
|
| + if (feature_info->feature_flags().oes_egl_image_external) {
|
| + GLuint external_ids[2];
|
| + glGenTextures(arraysize(external_ids), external_ids);
|
| + glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
|
| + default_texture_external_oes_ = TextureInfo::Ref(
|
| + new TextureInfo(external_ids[0]));
|
| + SetInfoTarget(default_texture_external_oes_, GL_TEXTURE_EXTERNAL_OES);
|
| + default_texture_external_oes_->SetLevelInfo(
|
| + &temp_feature_info, GL_TEXTURE_EXTERNAL_OES, 0,
|
| + GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE);
|
| + default_texture_external_oes_->SetParameter(feature_info,
|
| + GL_TEXTURE_MIN_FILTER,
|
| + GL_LINEAR);
|
| + default_texture_external_oes_->SetParameter(feature_info,
|
| + GL_TEXTURE_WRAP_S,
|
| + GL_CLAMP_TO_EDGE);
|
| + default_texture_external_oes_->SetParameter(feature_info,
|
| + GL_TEXTURE_WRAP_T,
|
| + GL_CLAMP_TO_EDGE);
|
| +
|
| + // Sampling a texture not associated with any EGLImage sibling will return
|
| + // black values according to the spec.
|
| + black_oes_external_texture_id_ = external_ids[1];
|
| + }
|
| +
|
| return true;
|
| }
|
|
|
|
|