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

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

Issue 2117183006: gpu: Clarify sized texture format is available only if ES3 context or immutable texture is supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix oes-texture-float.html Created 4 years, 2 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 0ab416a494992fb4217fb1430d632b767d676489..a16ea7529bc50f3272e2124e3f0195474e6aa852 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;
+ }
dshwang 2016/10/14 12:03:34 following test failed. https://www.khronos.org/reg
Ken Russell (switch to Gerrit) 2016/10/20 04:59:40 Sorry, I don't remember. The ultimate goal was to
+
+ 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()->
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/tests/gl_texture_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698