summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russell <kbr@chromium.org>2015-04-06 16:02:57 -0700
committerKenneth Russell <kbr@chromium.org>2015-04-06 23:05:48 +0000
commit97c489c81e26069782aee8673621c59cfa88c216 (patch)
tree6814751a31b19d1212156419e5efa4bceb2f9617
parent7667f1985913fbb96818a3e9c423258a25003159 (diff)
downloadchromium_src-97c489c81e26069782aee8673621c59cfa88c216.zip
chromium_src-97c489c81e26069782aee8673621c59cfa88c216.tar.gz
chromium_src-97c489c81e26069782aee8673621c59cfa88c216.tar.bz2
Revert of Use the desktop GL core profile on Linux when ES3 support is requested. (patchset #3 id:40001 of https://codereview.chromium.org/1052153002/) (Merge to M43)
Reason for revert: This causes Chrome rendering to break on some Chrome OS devices, see crbug.com/473891 for details Original issue's description: > Use the desktop GL core profile on Linux when ES3 support is requested. > > Request an OpenGL 4.2 context (the minimum version Chromium's WebGL > 2.0 prototype currently requires) on Linux when > --enable-unsafe-es3-apis is specified on the command line. > > Clean up the shader translator's selection of the GLSL output format. > > BUG=471960 > > Committed: https://crrev.com/0b17446f9591af9377d18c9ccfe50471651d6bc7 > Cr-Commit-Position: refs/heads/master@{#323658} TBR=piman@chromium.org,kbr@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=471960 Review URL: https://codereview.chromium.org/1054883004 Cr-Commit-Position: refs/heads/master@{#323866} (cherry picked from commit 1856f5d5e47d72742a12153f4e85ee0db00c11a0) Review URL: https://codereview.chromium.org/1068553003 Cr-Commit-Position: refs/branch-heads/2357@{#6} Cr-Branched-From: 59d4494849b405682265ed5d3f5164573b9a939b-refs/heads/master@{#323860}
-rw-r--r--gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc1
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc33
-rw-r--r--gpu/command_buffer/service/shader_translator.cc25
-rw-r--r--gpu/command_buffer/service/shader_translator.h1
-rw-r--r--gpu/config/gpu_info_collector.cc2
-rw-r--r--ui/gl/gl_context_glx.cc12
-rw-r--r--ui/gl/gl_context_x11.cc3
-rw-r--r--ui/gl/gl_implementation_x11.cc13
-rw-r--r--ui/gl/gl_surface_x11.cc7
9 files changed, 32 insertions, 65 deletions
diff --git a/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc b/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
index 4afe77c1..b0cc463 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
@@ -27,7 +27,6 @@ AsyncPixelTransferManager* AsyncPixelTransferManager::Create(
switch (gfx::GetGLImplementation()) {
case gfx::kGLImplementationOSMesaGL:
case gfx::kGLImplementationDesktopGL:
- case gfx::kGLImplementationDesktopGLCoreProfile:
case gfx::kGLImplementationEGLGLES2:
return new AsyncPixelTransferManagerIdle(true);
case gfx::kGLImplementationMockGL:
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index cef295a..8885e01 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1691,10 +1691,6 @@ class GLES2DecoderImpl : public GLES2Decoder,
return feature_info_->workarounds();
}
- const gfx::GLVersionInfo& gl_version() const {
- return feature_info_->gl_version_info();
- }
-
bool ShouldDeferDraws() {
return !offscreen_target_frame_buffer_.get() &&
framebuffer_state_.bound_draw_framebuffer.get() == NULL &&
@@ -2744,7 +2740,7 @@ bool GLES2DecoderImpl::Initialize(
bool default_fb = (GetBackbufferServiceId() == 0);
- if (gl_version().is_desktop_core_profile) {
+ if (feature_info_->gl_version_info().is_desktop_core_profile) {
glGetFramebufferAttachmentParameterivEXT(
GL_FRAMEBUFFER,
default_fb ? GL_BACK_LEFT : GL_COLOR_ATTACHMENT0,
@@ -2783,7 +2779,7 @@ bool GLES2DecoderImpl::Initialize(
// mailing list archives. It also implicitly enables the desktop GL
// capability GL_POINT_SPRITE to provide access to the gl_PointCoord
// variable in fragment shaders.
- if (!gl_version().BehavesLikeGLES()) {
+ if (!feature_info_->gl_version_info().BehavesLikeGLES()) {
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
glEnable(GL_POINT_SPRITE);
}
@@ -3021,11 +3017,8 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() {
else
resources.HashFunction = NULL;
ShaderTranslatorInterface::GlslImplementationType implementation_type =
- ShaderTranslatorInterface::kGlsl;
- if (gl_version().is_es)
- implementation_type = ShaderTranslatorInterface::kGlslES;
- else if (gl_version().is_desktop_core_profile)
- implementation_type = ShaderTranslatorInterface::kGlslCoreProfile;
+ gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ?
+ ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl;
int driver_bug_workarounds = 0;
if (workarounds().needs_glsl_built_in_function_emulation)
driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS;
@@ -4597,7 +4590,7 @@ void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target,
}
ScopedRenderTo do_render(framebuffer);
- if (gl_version().is_es3) {
+ if (feature_info_->gl_version_info().is_es3) {
glInvalidateFramebuffer(
target, numAttachments, translated_attachments.get());
} else {
@@ -4779,7 +4772,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (gl_version().is_desktop_core_profile) {
+ if (feature_info_->gl_version_info().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4800,7 +4793,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (gl_version().is_desktop_core_profile) {
+ if (feature_info_->gl_version_info().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4822,7 +4815,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (gl_version().is_desktop_core_profile) {
+ if (feature_info_->gl_version_info().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4853,7 +4846,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (gl_version().is_desktop_core_profile) {
+ if (feature_info_->gl_version_info().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -5697,7 +5690,7 @@ void GLES2DecoderImpl::BlitFramebufferHelper(GLint srcX0,
GLenum filter) {
// TODO(sievers): This could be resolved at the GL binding level, but the
// binding process is currently a bit too 'brute force'.
- if (gl_version().is_angle) {
+ if (feature_info_->gl_version_info().is_angle) {
glBlitFramebufferANGLE(
srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
} else if (feature_info_->feature_flags().use_core_framebuffer_multisample) {
@@ -6712,7 +6705,7 @@ bool GLES2DecoderImpl::SimulateAttrib0(
DCHECK(simulated);
*simulated = false;
- if (gl_version().BehavesLikeGLES())
+ if (feature_info_->gl_version_info().BehavesLikeGLES())
return true;
const VertexAttrib* attrib =
@@ -8069,7 +8062,7 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
glGenBuffersARB(1, &buffer);
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer);
// For ANGLE client version 2, GL_STREAM_READ is not available.
- const GLenum usage_hint = gl_version().is_angle ?
+ const GLenum usage_hint = feature_info_->gl_version_info().is_angle ?
GL_STATIC_DRAW : GL_STREAM_READ;
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint);
GLenum error = glGetError();
@@ -10301,7 +10294,7 @@ void GLES2DecoderImpl::DoSwapBuffers() {
// Ensure the side effects of the copy are visible to the parent
// context. There is no need to do this for ANGLE because it uses a
// single D3D device for all contexts.
- if (!gl_version().is_angle)
+ if (!feature_info_->gl_version_info().is_angle)
glFlush();
}
} else {
diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc
index bc8b1fa..b4a94fc 100644
--- a/gpu/command_buffer/service/shader_translator.cc
+++ b/gpu/command_buffer/service/shader_translator.cc
@@ -117,20 +117,19 @@ bool ShaderTranslator::Init(
g_translator_initializer.Get();
- ShShaderOutput shader_output = SH_ESSL_OUTPUT;
- switch (glsl_implementation_type) {
- case kGlsl:
- shader_output = SH_GLSL_COMPATIBILITY_OUTPUT;
- break;
- case kGlslCoreProfile:
+ ShShaderOutput shader_output;
+ if (glsl_implementation_type == kGlslES) {
+ shader_output = SH_ESSL_OUTPUT;
+ } else {
+ // TODO(kbr): clean up the tests of shader_spec and
+ // gfx::GetGLImplementation(). crbug.com/471960
+ if (shader_spec == SH_WEBGL2_SPEC ||
+ gfx::GetGLImplementation() ==
+ gfx::kGLImplementationDesktopGLCoreProfile) {
shader_output = SH_GLSL_CORE_OUTPUT;
- break;
- case kGlslES:
- // Handled in initialization above.
- break;
- default:
- NOTREACHED();
- break;
+ } else {
+ shader_output = SH_GLSL_COMPATIBILITY_OUTPUT;
+ }
}
{
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h
index 68aa1d9..818be5d 100644
--- a/gpu/command_buffer/service/shader_translator.h
+++ b/gpu/command_buffer/service/shader_translator.h
@@ -33,7 +33,6 @@ class ShaderTranslatorInterface
ShaderTranslatorInterface() {}
enum GlslImplementationType {
kGlsl,
- kGlslCoreProfile,
kGlslES
};
diff --git a/gpu/config/gpu_info_collector.cc b/gpu/config/gpu_info_collector.cc
index e9d60b1..521f2cd 100644
--- a/gpu/config/gpu_info_collector.cc
+++ b/gpu/config/gpu_info_collector.cc
@@ -98,7 +98,7 @@ CollectInfoResult CollectGraphicsInfoGL(GPUInfo* gpu_info) {
gpu_info->gl_renderer = GetGLString(GL_RENDERER);
gpu_info->gl_vendor = GetGLString(GL_VENDOR);
- gpu_info->gl_extensions = context->GetExtensions();
+ gpu_info->gl_extensions = GetGLString(GL_EXTENSIONS);
gpu_info->gl_version = GetGLString(GL_VERSION);
std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION);
diff --git a/ui/gl/gl_context_glx.cc b/ui/gl/gl_context_glx.cc
index b7d7e21..e5b1cc1 100644
--- a/ui/gl/gl_context_glx.cc
+++ b/ui/gl/gl_context_glx.cc
@@ -38,18 +38,6 @@ bool GLContextGLX::Initialize(
if (GLSurfaceGLX::IsCreateContextSupported()) {
DVLOG(1) << "GLX_ARB_create_context supported.";
std::vector<int> attribs;
- if (gfx::GetGLImplementation() ==
- gfx::kGLImplementationDesktopGLCoreProfile) {
- // TODO(kbr): NVIDIA's driver doesn't return a later context
- // version if any version later than 3.1 is requested. We
- // explicitly want to request a 3.2+ context with no support for
- // the compatibility profile. WebGL 2.0 support currently
- // requires a 4.2 context. crbug.com/473427
- attribs.push_back(GLX_CONTEXT_MAJOR_VERSION_ARB);
- attribs.push_back(4);
- attribs.push_back(GLX_CONTEXT_MINOR_VERSION_ARB);
- attribs.push_back(2);
- }
if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) {
DVLOG(1) << "GLX_ARB_create_context_robustness supported.";
attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB);
diff --git a/ui/gl/gl_context_x11.cc b/ui/gl/gl_context_x11.cc
index dd5e3b8..b17364d 100644
--- a/ui/gl/gl_context_x11.cc
+++ b/ui/gl/gl_context_x11.cc
@@ -35,8 +35,7 @@ scoped_refptr<GLContext> GLContext::CreateGLContext(
return context;
}
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile: {
+ case kGLImplementationDesktopGL: {
scoped_refptr<GLContext> context(new GLContextGLX(share_group));
if (!context->Initialize(compatible_surface, gpu_preference))
return NULL;
diff --git a/ui/gl/gl_implementation_x11.cc b/ui/gl/gl_implementation_x11.cc
index 32fd369..b8a7246 100644
--- a/ui/gl/gl_implementation_x11.cc
+++ b/ui/gl/gl_implementation_x11.cc
@@ -43,10 +43,6 @@ const char kEGLLibraryName[] = "libEGL.so.1";
} // namespace
void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableUnsafeES3APIs)) {
- impls->push_back(kGLImplementationDesktopGLCoreProfile);
- }
impls->push_back(kGLImplementationDesktopGL);
impls->push_back(kGLImplementationEGLGLES2);
impls->push_back(kGLImplementationOSMesaGL);
@@ -67,8 +63,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
switch (implementation) {
case kGLImplementationOSMesaGL:
return InitializeStaticGLBindingsOSMesaGL();
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile: {
+ case kGLImplementationDesktopGL: {
base::NativeLibrary library = NULL;
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
@@ -96,7 +91,7 @@ bool InitializeStaticGLBindings(GLImplementation implementation) {
SetGLGetProcAddressProc(get_proc_address);
AddGLNativeLibrary(library);
- SetGLImplementation(implementation);
+ SetGLImplementation(kGLImplementationDesktopGL);
InitializeStaticGLBindingsGL();
InitializeStaticGLBindingsGLX();
@@ -156,8 +151,7 @@ bool InitializeDynamicGLBindings(GLImplementation implementation,
GLContext* context) {
switch (implementation) {
case kGLImplementationOSMesaGL:
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile:
+ case kGLImplementationDesktopGL:
case kGLImplementationEGLGLES2:
InitializeDynamicGLBindingsGL(context);
break;
@@ -197,7 +191,6 @@ void ClearGLBindings() {
bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile:
return GetGLWindowSystemBindingInfoGLX(info);
case kGLImplementationEGLGLES2:
return GetGLWindowSystemBindingInfoEGL(info);
diff --git a/ui/gl/gl_surface_x11.cc b/ui/gl/gl_surface_x11.cc
index 63b0e96..a384147 100644
--- a/ui/gl/gl_surface_x11.cc
+++ b/ui/gl/gl_surface_x11.cc
@@ -52,7 +52,6 @@ class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa {
bool GLSurface::InitializeOneOffInternal() {
switch (GetGLImplementation()) {
case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile:
if (!GLSurfaceGLX::InitializeOneOff()) {
LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed.";
return false;
@@ -284,8 +283,7 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
return surface;
}
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile: {
+ case kGLImplementationDesktopGL: {
scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(window));
if (!surface->Initialize())
return NULL;
@@ -320,8 +318,7 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
return surface;
}
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile: {
+ case kGLImplementationDesktopGL: {
scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size));
if (!surface->Initialize())
return NULL;