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

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

Issue 2170293002: Use GLVersionInfo instead of gl::GetGLImplementation() to decide GL paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/gles2_cmd_copy_texture_chromium.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
index f49592307623204612545a1cff539ad38791715b..91ce24e7c397572874a1109436e29acb9ed49f9b 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
@@ -10,7 +10,7 @@
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_version_info.h"
namespace {
@@ -94,11 +94,11 @@ const char* kShaderPrecisionPreamble = "\
#define TexCoordPrecision\n\
#endif\n";
-std::string GetVertexShaderSource() {
+std::string GetVertexShaderSource(const gl::GLVersionInfo& gl_version_info) {
std::string source;
// Preamble for core and compatibility mode.
- if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGLCoreProfile) {
+ if (gl_version_info.is_desktop_core_profile) {
source += std::string("\
#version 150\n\
#define ATTRIBUTE in\n\
@@ -130,13 +130,14 @@ std::string GetVertexShaderSource() {
return source;
}
-std::string GetFragmentShaderSource(bool premultiply_alpha,
+std::string GetFragmentShaderSource(const gl::GLVersionInfo& gl_version_info,
+ bool premultiply_alpha,
bool unpremultiply_alpha,
GLenum target) {
std::string source;
// Preamble for core and compatibility mode.
- if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGLCoreProfile) {
+ if (gl_version_info.is_desktop_core_profile) {
source += std::string("\
#version 150\n\
out vec4 frag_color;\n\
@@ -574,12 +575,13 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal(
DLOG(ERROR) << "CopyTextureCHROMIUM: Uninitialized manager.";
return;
}
+ const gl::GLVersionInfo& gl_version_info =
+ decoder->GetFeatureInfo()->gl_version_info();
if (vertex_array_object_id_) {
glBindVertexArrayOES(vertex_array_object_id_);
} else {
- if (gl::GetGLImplementation() !=
- gl::kGLImplementationDesktopGLCoreProfile) {
+ if (!gl_version_info.is_desktop_core_profile) {
decoder->ClearAllAttributes();
}
glEnableVertexAttribArray(kVertexPositionAttrib);
@@ -598,15 +600,16 @@ void CopyTextureCHROMIUMResourceManager::DoCopyTextureInternal(
info->program = glCreateProgram();
if (!vertex_shader_) {
vertex_shader_ = glCreateShader(GL_VERTEX_SHADER);
- std::string source = GetVertexShaderSource();
+ std::string source = GetVertexShaderSource(gl_version_info);
CompileShader(vertex_shader_, source.c_str());
}
glAttachShader(info->program, vertex_shader_);
GLuint* fragment_shader = &fragment_shaders_[fragment_shader_id];
if (!*fragment_shader) {
*fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
- std::string source = GetFragmentShaderSource(
- premultiply_alpha, unpremultiply_alpha, source_target);
+ std::string source =
+ GetFragmentShaderSource(gl_version_info, premultiply_alpha,
+ unpremultiply_alpha, source_target);
CompileShader(*fragment_shader, source.c_str());
}
glAttachShader(info->program, *fragment_shader);

Powered by Google App Engine
This is Rietveld 408576698