Commit ae9d975a authored by Antoine Labour's avatar Antoine Labour Committed by Commit Bot

Reset unpack buffer in FeatureInfo if PBOs are supported by the driver

We need to reset GL_PIXEL_UNPACK_BUFFER in FeatureInfo initialization if it is
non-0. We should always do that regardless of whether or not the current decoder
exposes them, because with shared contexts it is possible that another decoder
uses ES3 whereas the current one doesn't.

Bug: 905519
Change-Id: I2c2f457fcdd76ca4812ac8d71c8f77d694506a57
Reviewed-on: https://chromium-review.googlesource.com/c/1340973
Commit-Queue: Antoine Labour <piman@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609050}
parent e661b8cb
...@@ -428,16 +428,18 @@ void FeatureInfo::InitializeFeatures() { ...@@ -428,16 +428,18 @@ void FeatureInfo::InitializeFeatures() {
bool enable_es3 = IsWebGL2OrES3OrHigherContext(); bool enable_es3 = IsWebGL2OrES3OrHigherContext();
// Pixel buffer bindings can be manipulated by the client if ES3 is enabled or // Really it's part of core OpenGL 2.1 and up, but let's assume the
// the GL_NV_pixel_buffer_object extension is exposed by ANGLE when using the // extension is still advertised.
// passthrough command decoder bool has_pixel_buffers =
bool pixel_buffers_exposed = gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile ||
enable_es3 || gfx::HasExtension(extensions, "GL_NV_pixel_buffer_object"); gfx::HasExtension(extensions, "GL_ARB_pixel_buffer_object") ||
gfx::HasExtension(extensions, "GL_NV_pixel_buffer_object");
// Both decoders may bind pixel buffers if exposing an ES3 or WebGL 2 context // If ES3 or pixel buffer objects are enabled by the driver, we have to assume
// and the passthrough command decoder may also bind PBOs if // the unpack buffer binding may be changed on the underlying context. This is
// NV_pixel_buffer_object is exposed. // true whether or not this particular decoder exposes PBOs, as it could be
ScopedPixelUnpackBufferOverride scoped_pbo_override(pixel_buffers_exposed, 0); // changed on another decoder that does expose them.
ScopedPixelUnpackBufferOverride scoped_pbo_override(has_pixel_buffers, 0);
AddExtensionString("GL_ANGLE_translated_shader_source"); AddExtensionString("GL_ANGLE_translated_shader_source");
AddExtensionString("GL_CHROMIUM_async_pixel_transfers"); AddExtensionString("GL_CHROMIUM_async_pixel_transfers");
...@@ -1266,13 +1268,6 @@ void FeatureInfo::InitializeFeatures() { ...@@ -1266,13 +1268,6 @@ void FeatureInfo::InitializeFeatures() {
gfx::HasExtension(extensions, "GL_ARB_map_buffer_range") || gfx::HasExtension(extensions, "GL_ARB_map_buffer_range") ||
gfx::HasExtension(extensions, "GL_EXT_map_buffer_range"); gfx::HasExtension(extensions, "GL_EXT_map_buffer_range");
// Really it's part of core OpenGL 2.1 and up, but let's assume the
// extension is still advertised.
bool has_pixel_buffers =
gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile ||
gfx::HasExtension(extensions, "GL_ARB_pixel_buffer_object") ||
gfx::HasExtension(extensions, "GL_NV_pixel_buffer_object");
// We will use either glMapBuffer() or glMapBufferRange() for async readbacks. // We will use either glMapBuffer() or glMapBufferRange() for async readbacks.
if (has_pixel_buffers && ui_gl_fence_works && if (has_pixel_buffers && ui_gl_fence_works &&
!workarounds_.disable_async_readpixels) { !workarounds_.disable_async_readpixels) {
......
...@@ -517,7 +517,8 @@ void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( ...@@ -517,7 +517,8 @@ void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
.WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer))) .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer)))
.RetiresOnSaturation(); .RetiresOnSaturation();
if (enable_es3 || if (gl_info.is_es3 || gl_info.is_desktop_core_profile ||
gfx::HasExtension(extension_set, "GL_ARB_pixel_buffer_object") ||
gfx::HasExtension(extension_set, "GL_NV_pixel_buffer_object")) { gfx::HasExtension(extension_set, "GL_NV_pixel_buffer_object")) {
EXPECT_CALL(*gl, GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, _)) EXPECT_CALL(*gl, GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, _))
.WillOnce(SetArgPointee<1>(0)) .WillOnce(SetArgPointee<1>(0))
......
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