| 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 43a5b8816f1c0b3191032a3faee66d13bba4349f..24fbaf6940e9184619084180ab260604b7d57376 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) {
|
| @@ -308,6 +310,24 @@ GLenum GetSwizzleForChannel(GLenum channel,
|
| }
|
| }
|
|
|
| +bool SizedFormatAvailable(const FeatureInfo* feature_info,
|
| + bool immutable,
|
| + GLenum internal_format) {
|
| + if (immutable)
|
| + return true;
|
| +
|
| + // TODO(dshwang): check if it's possible to remove
|
| + // CHROMIUM_color_buffer_float_rgb. crbug.com/329605
|
| + if ((feature_info->feature_flags().chromium_color_buffer_float_rgb &&
|
| + internal_format == GL_RGB32F) ||
|
| + (feature_info->feature_flags().chromium_color_buffer_float_rgba &&
|
| + internal_format == GL_RGBA32F)) {
|
| + return true;
|
| + }
|
| +
|
| + return feature_info->IsES3Enabled();
|
| +}
|
| +
|
| // A 32-bit and 64-bit compatible way of converting a pointer to a GLuint.
|
| GLuint ToGLuint(const void* ptr) {
|
| return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
|
| @@ -601,9 +621,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 +748,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 +828,24 @@ 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);
|
| +
|
| + return SizedFormatAvailable(feature_info, immutable, internal_format) &&
|
| + 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 +858,10 @@ bool Texture::TextureFilterable(const FeatureInfo* feature_info,
|
| return true;
|
| }
|
| }
|
| - return feature_info->validators()->
|
| - texture_sized_texture_filterable_internal_format.IsValid(internal_format);
|
| + return SizedFormatAvailable(feature_info, immutable, internal_format) &&
|
| + feature_info->validators()
|
| + ->texture_sized_texture_filterable_internal_format.IsValid(
|
| + internal_format);
|
| }
|
|
|
| void Texture::SetLevelClearedRect(GLenum target,
|
| @@ -1711,15 +1738,15 @@ bool Texture::CanRenderTo(const FeatureInfo* feature_info, GLint level) const {
|
| level < static_cast<GLint>(face_infos_[0].level_infos.size()));
|
| GLenum internal_format = face_infos_[0].level_infos[level].internal_format;
|
| 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));
|
| + (SizedFormatAvailable(feature_info, immutable_, internal_format) &&
|
| + feature_info->validators()
|
| + ->texture_sized_color_renderable_internal_format.IsValid(
|
| + internal_format)));
|
| bool depth_renderable = feature_info->validators()->
|
| texture_depth_renderable_internal_format.IsValid(internal_format);
|
| bool stencil_renderable = feature_info->validators()->
|
|
|