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 0ab416a494992fb4217fb1430d632b767d676489..71f5b2e83267ab0ecd1835ebf661a5c1957201d2 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -231,6 +231,8 @@ class FormatTypeValidator { |
{GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8}, |
{GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, |
GL_FLOAT_32_UNSIGNED_INT_24_8_REV}, |
+ // Exposed by GL_APPLE_texture_format_BGRA8888 |
+ {GL_BGRA8_EXT, GL_BGRA_EXT, GL_UNSIGNED_BYTE}, |
}; |
for (size_t ii = 0; ii < arraysize(kSupportedFormatTypes); ++ii) { |
@@ -601,9 +603,8 @@ bool Texture::CanRenderWithSampler(const FeatureInfo* feature_info, |
// TODO(zmo): The assumption that compressed textures are all filterable |
// may not be true in the future. |
} else { |
- if (!Texture::TextureFilterable(feature_info, |
- first_level.internal_format, |
- first_level.type)) { |
+ if (!Texture::TextureFilterable(feature_info, first_level.internal_format, |
+ first_level.type, immutable_)) { |
return false; |
} |
} |
@@ -729,9 +730,10 @@ bool Texture::CanGenerateMipmaps(const FeatureInfo* feature_info) const { |
return false; |
} |
- if (!Texture::ColorRenderable(feature_info, base.internal_format) || |
- !Texture::TextureFilterable( |
- feature_info, base.internal_format, base.type)) { |
+ if (!Texture::ColorRenderable(feature_info, base.internal_format, |
+ immutable_) || |
+ !Texture::TextureFilterable(feature_info, base.internal_format, base.type, |
+ immutable_)) { |
return false; |
} |
@@ -808,19 +810,25 @@ bool Texture::TextureMipComplete(const Texture::LevelInfo& base_level_face, |
// static |
bool Texture::ColorRenderable(const FeatureInfo* feature_info, |
- GLenum internal_format) { |
+ GLenum internal_format, |
+ bool immutable) { |
if (feature_info->validators()->texture_unsized_internal_format.IsValid( |
internal_format)) { |
return true; |
} |
- return feature_info->validators()-> |
- texture_sized_color_renderable_internal_format.IsValid(internal_format); |
+ |
+ bool sized_format_available = feature_info->IsES3Enabled() || immutable; |
+ return sized_format_available && |
+ feature_info->validators() |
+ ->texture_sized_color_renderable_internal_format.IsValid( |
+ internal_format); |
} |
// static |
bool Texture::TextureFilterable(const FeatureInfo* feature_info, |
GLenum internal_format, |
- GLenum type) { |
+ GLenum type, |
+ bool immutable) { |
if (feature_info->validators()->texture_unsized_internal_format.IsValid( |
internal_format)) { |
switch (type) { |
@@ -833,8 +841,11 @@ bool Texture::TextureFilterable(const FeatureInfo* feature_info, |
return true; |
} |
} |
- return feature_info->validators()-> |
- texture_sized_texture_filterable_internal_format.IsValid(internal_format); |
+ bool sized_format_available = feature_info->IsES3Enabled() || immutable; |
+ return sized_format_available && |
+ feature_info->validators() |
+ ->texture_sized_texture_filterable_internal_format.IsValid( |
+ internal_format); |
} |
void Texture::SetLevelClearedRect(GLenum target, |
@@ -1710,16 +1721,17 @@ bool Texture::CanRenderTo(const FeatureInfo* feature_info, GLint level) const { |
DCHECK(level >= 0 && |
level < static_cast<GLint>(face_infos_[0].level_infos.size())); |
GLenum internal_format = face_infos_[0].level_infos[level].internal_format; |
+ bool sized_format_available = feature_info->IsES3Enabled() || immutable_; |
bool color_renderable = |
- ((feature_info->validators()->texture_unsized_internal_format. |
- IsValid(internal_format) && |
- internal_format != GL_ALPHA && |
- internal_format != GL_LUMINANCE && |
+ ((feature_info->validators()->texture_unsized_internal_format.IsValid( |
+ internal_format) && |
+ internal_format != GL_ALPHA && internal_format != GL_LUMINANCE && |
internal_format != GL_LUMINANCE_ALPHA && |
internal_format != GL_SRGB_EXT) || |
- feature_info->validators()-> |
- texture_sized_color_renderable_internal_format.IsValid( |
- internal_format)); |
+ (sized_format_available && |
+ feature_info->validators() |
+ ->texture_sized_color_renderable_internal_format.IsValid( |
+ internal_format))); |
dshwang
2016/10/13 14:21:06
https://cs.chromium.org/chromium/src/gpu/command_b
|
bool depth_renderable = feature_info->validators()-> |
texture_depth_renderable_internal_format.IsValid(internal_format); |
bool stencil_renderable = feature_info->validators()-> |