Commit e4f31cdf authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Assume float and half float formats are renderable on Mac.

From histogram data, they are 100% renderable on all Mac.

Avoid runtime check, where CheckFramebufferStatus() hangs
from time to time.

Also, limit this to AMD/Intel/Nvidia GPUs.

BUG=1127387
TEST=bots
R=kbr@chromium.org

Change-Id: If7567f3410090241c2ab861b93bd45c117051c6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436386Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811863}
parent 23343e59
...@@ -1823,13 +1823,27 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( ...@@ -1823,13 +1823,27 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
if (may_enable_chromium_color_buffer_float && if (may_enable_chromium_color_buffer_float &&
!had_native_chromium_color_buffer_float_ext) { !had_native_chromium_color_buffer_float_ext) {
static_assert(GL_RGBA32F_ARB == GL_RGBA32F && if (workarounds_.force_enable_color_buffer_float) {
GL_RGBA32F_EXT == GL_RGBA32F && if (enable_es3)
enable_ext_color_buffer_float = true;
if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float &&
gl_version_info_->IsAtLeastGL(3, 0)) {
enable_ext_color_buffer_half_float = true;
}
feature_flags_.chromium_color_buffer_float_rgba = true;
if (!disallowed_features_.chromium_color_buffer_float_rgba)
EnableCHROMIUMColorBufferFloatRGBA();
feature_flags_.chromium_color_buffer_float_rgb = true;
if (!disallowed_features_.chromium_color_buffer_float_rgb)
EnableCHROMIUMColorBufferFloatRGB();
} else {
static_assert(
GL_RGBA32F_ARB == GL_RGBA32F && GL_RGBA32F_EXT == GL_RGBA32F &&
GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F, GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F,
"sized float internal format variations must match"); "sized float internal format variations must match");
// We don't check extension support beyond ARB_texture_float on desktop GL, // We don't check extension support beyond ARB_texture_float on desktop
// and format support varies between GL configurations. For example, spec // GL, and format support varies between GL configurations. For example,
// prior to OpenGL 3.0 mandates framebuffer support only for one // spec prior to OpenGL 3.0 mandates framebuffer support only for one
// implementation-chosen format, and ES3.0 EXT_color_buffer_float does not // implementation-chosen format, and ES3.0 EXT_color_buffer_float does not
// support rendering to RGB32F. Check for framebuffer completeness with // support rendering to RGB32F. Check for framebuffer completeness with
// formats that the extensions expose, and only enable an extension when a // formats that the extensions expose, and only enable an extension when a
...@@ -1854,8 +1868,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( ...@@ -1854,8 +1868,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, tex_id, 0); GL_TEXTURE_2D, tex_id, 0);
GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, GL_FLOAT, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB,
nullptr); GL_FLOAT, nullptr);
GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA32F.FLOAT", base::UmaHistogramBoolean("GPU.RenderableFormat.RGBA32F.FLOAT",
status_rgba == GL_FRAMEBUFFER_COMPLETE); status_rgba == GL_FRAMEBUFFER_COMPLETE);
...@@ -1886,7 +1900,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( ...@@ -1886,7 +1900,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
kFormats[i], GL_FLOAT, nullptr); kFormats[i], GL_FLOAT, nullptr);
bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == bool supported = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ==
GL_FRAMEBUFFER_COMPLETE; GL_FRAMEBUFFER_COMPLETE;
base::UmaHistogramBoolean(kInternalFormatHistogramNames[i], supported); base::UmaHistogramBoolean(kInternalFormatHistogramNames[i],
supported);
full_float_support &= supported; full_float_support &= supported;
} }
enable_ext_color_buffer_float = full_float_support; enable_ext_color_buffer_float = full_float_support;
...@@ -1898,8 +1913,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( ...@@ -1898,8 +1913,8 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
gl_version_info_->IsAtLeastGL(3, 0))) { gl_version_info_->IsAtLeastGL(3, 0))) {
// EXT_color_buffer_half_float requires at least one of the formats is // EXT_color_buffer_half_float requires at least one of the formats is
// supported to be color-renderable. WebGL's extension requires RGBA16F // supported to be color-renderable. WebGL's extension requires RGBA16F
// to be the supported effective format. Here we only expose the extension // to be the supported effective format. Here we only expose the
// if RGBA16F is color-renderable. // extension if RGBA16F is color-renderable.
GLenum internal_format = GL_RGBA16F; GLenum internal_format = GL_RGBA16F;
GLenum format = GL_RGBA; GLenum format = GL_RGBA;
GLenum data_type = GL_HALF_FLOAT; GLenum data_type = GL_HALF_FLOAT;
...@@ -1931,6 +1946,7 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( ...@@ -1931,6 +1946,7 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures(
EnableCHROMIUMColorBufferFloatRGB(); EnableCHROMIUMColorBufferFloatRGB();
} }
} }
}
// Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0
if (enable_ext_color_buffer_float && enable_es3) { if (enable_ext_color_buffer_float && enable_es3) {
......
...@@ -3592,6 +3592,42 @@ ...@@ -3592,6 +3592,42 @@
"value": "24", "value": "24",
"value2": "27" "value2": "27"
} }
},
{
"id": 355,
"cr_bugs": [1127387],
"description": "Always assume float formats are renderable on Mac Intel",
"os": {
"type": "macosx"
},
"vendor_id": "0x8086",
"features": [
"force_enable_color_buffer_float"
]
},
{
"id": 356,
"cr_bugs": [1127387],
"description": "Always assume float formats are renderable on Mac AMD",
"os": {
"type": "macosx"
},
"vendor_id": "0x1002",
"features": [
"force_enable_color_buffer_float"
]
},
{
"id": 357,
"cr_bugs": [1127387],
"description": "Always assume float formats are renderable on Mac Nvidia",
"os": {
"type": "macosx"
},
"vendor_id": "0x10de",
"features": [
"force_enable_color_buffer_float"
]
} }
] ]
} }
...@@ -68,6 +68,7 @@ exit_on_context_lost ...@@ -68,6 +68,7 @@ exit_on_context_lost
flush_on_framebuffer_change flush_on_framebuffer_change
force_cube_complete force_cube_complete
force_cube_map_positive_x_allocation force_cube_map_positive_x_allocation
force_enable_color_buffer_float
force_gl_flush_on_swap_buffers force_gl_flush_on_swap_buffers
force_high_performance_gpu force_high_performance_gpu
force_int_or_srgb_cube_texture_complete force_int_or_srgb_cube_texture_complete
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment