summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'gpu')
-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
5 files changed, 36 insertions, 26 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 b0cc463..4afe77c1 100644
--- a/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
+++ b/gpu/command_buffer/service/async_pixel_transfer_manager_linux.cc
@@ -27,6 +27,7 @@ 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 d402c93..d1d1d9c 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1690,6 +1690,10 @@ 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 &&
@@ -2739,7 +2743,7 @@ bool GLES2DecoderImpl::Initialize(
bool default_fb = (GetBackbufferServiceId() == 0);
- if (feature_info_->gl_version_info().is_desktop_core_profile) {
+ if (gl_version().is_desktop_core_profile) {
glGetFramebufferAttachmentParameterivEXT(
GL_FRAMEBUFFER,
default_fb ? GL_BACK_LEFT : GL_COLOR_ATTACHMENT0,
@@ -2778,7 +2782,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 (!feature_info_->gl_version_info().BehavesLikeGLES()) {
+ if (!gl_version().BehavesLikeGLES()) {
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
glEnable(GL_POINT_SPRITE);
}
@@ -3016,8 +3020,11 @@ bool GLES2DecoderImpl::InitializeShaderTranslator() {
else
resources.HashFunction = NULL;
ShaderTranslatorInterface::GlslImplementationType implementation_type =
- gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ?
- ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl;
+ ShaderTranslatorInterface::kGlsl;
+ if (gl_version().is_es)
+ implementation_type = ShaderTranslatorInterface::kGlslES;
+ else if (gl_version().is_desktop_core_profile)
+ implementation_type = ShaderTranslatorInterface::kGlslCoreProfile;
int driver_bug_workarounds = 0;
if (workarounds().needs_glsl_built_in_function_emulation)
driver_bug_workarounds |= SH_EMULATE_BUILT_IN_FUNCTIONS;
@@ -4589,7 +4596,7 @@ void GLES2DecoderImpl::DoDiscardFramebufferEXT(GLenum target,
}
ScopedRenderTo do_render(framebuffer);
- if (feature_info_->gl_version_info().is_es3) {
+ if (gl_version().is_es3) {
glInvalidateFramebuffer(
target, numAttachments, translated_attachments.get());
} else {
@@ -4771,7 +4778,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (feature_info_->gl_version_info().is_desktop_core_profile) {
+ if (gl_version().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4792,7 +4799,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (feature_info_->gl_version_info().is_desktop_core_profile) {
+ if (gl_version().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4814,7 +4821,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (feature_info_->gl_version_info().is_desktop_core_profile) {
+ if (gl_version().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -4845,7 +4852,7 @@ bool GLES2DecoderImpl::GetHelper(
*num_written = 1;
if (params) {
GLint v = 0;
- if (feature_info_->gl_version_info().is_desktop_core_profile) {
+ if (gl_version().is_desktop_core_profile) {
Framebuffer* framebuffer =
GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
if (framebuffer) {
@@ -5689,7 +5696,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 (feature_info_->gl_version_info().is_angle) {
+ if (gl_version().is_angle) {
glBlitFramebufferANGLE(
srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
} else if (feature_info_->feature_flags().use_core_framebuffer_multisample) {
@@ -6704,7 +6711,7 @@ bool GLES2DecoderImpl::SimulateAttrib0(
DCHECK(simulated);
*simulated = false;
- if (feature_info_->gl_version_info().BehavesLikeGLES())
+ if (gl_version().BehavesLikeGLES())
return true;
const VertexAttrib* attrib =
@@ -8061,7 +8068,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 = feature_info_->gl_version_info().is_angle ?
+ const GLenum usage_hint = gl_version().is_angle ?
GL_STATIC_DRAW : GL_STREAM_READ;
glBufferData(GL_PIXEL_PACK_BUFFER_ARB, pixels_size, NULL, usage_hint);
GLenum error = glGetError();
@@ -10293,7 +10300,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 (!feature_info_->gl_version_info().is_angle)
+ if (!gl_version().is_angle)
glFlush();
}
} else {
diff --git a/gpu/command_buffer/service/shader_translator.cc b/gpu/command_buffer/service/shader_translator.cc
index b4a94fc..bc8b1fa 100644
--- a/gpu/command_buffer/service/shader_translator.cc
+++ b/gpu/command_buffer/service/shader_translator.cc
@@ -117,19 +117,20 @@ bool ShaderTranslator::Init(
g_translator_initializer.Get();
- 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;
- } else {
+ ShShaderOutput shader_output = SH_ESSL_OUTPUT;
+ switch (glsl_implementation_type) {
+ case kGlsl:
shader_output = SH_GLSL_COMPATIBILITY_OUTPUT;
- }
+ break;
+ case kGlslCoreProfile:
+ shader_output = SH_GLSL_CORE_OUTPUT;
+ break;
+ case kGlslES:
+ // Handled in initialization above.
+ break;
+ default:
+ NOTREACHED();
+ break;
}
{
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h
index 818be5d..68aa1d9 100644
--- a/gpu/command_buffer/service/shader_translator.h
+++ b/gpu/command_buffer/service/shader_translator.h
@@ -33,6 +33,7 @@ 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 521f2cd..e9d60b1 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 = GetGLString(GL_EXTENSIONS);
+ gpu_info->gl_extensions = context->GetExtensions();
gpu_info->gl_version = GetGLString(GL_VERSION);
std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION);