Mac: Fix locale error with GL shader (issue #1270).

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1750@1704 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2014-05-07 20:43:26 +00:00
parent e654ebb8c1
commit 401b1f6eb7
1 changed files with 10 additions and 7 deletions

View File

@ -25,18 +25,19 @@ index e948863..0031eaa 100644
}
diff --git compositing_iosurface_shader_programs_mac.cc compositing_iosurface_shader_programs_mac.cc
index 87f0f34..342bdfc 100644
index 87f0f34..0fdc564 100644
--- compositing_iosurface_shader_programs_mac.cc
+++ compositing_iosurface_shader_programs_mac.cc
@@ -11,6 +11,7 @@
@@ -11,6 +11,8 @@
#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/strings/stringprintf.h"
+#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "gpu/config/gpu_driver_bug_workaround_type.h"
@@ -51,6 +52,7 @@ const char kfsBlit[] = GLSL_PROGRAM_AS_STRING(
@@ -51,6 +53,7 @@ const char kfsBlit[] = GLSL_PROGRAM_AS_STRING(
}
);
@ -44,7 +45,7 @@ index 87f0f34..342bdfc 100644
// Only calculates position.
const char kvsSolidWhite[] = GLSL_PROGRAM_AS_STRING(
@@ -238,6 +240,16 @@ GLuint CompileShaderGLSL(ShaderProgram shader_program, GLenum shader_type,
@@ -238,6 +241,18 @@ GLuint CompileShaderGLSL(ShaderProgram shader_program, GLenum shader_type,
const GLuint shader = glCreateShader(shader_type);
DCHECK_NE(shader, 0u);
@ -53,15 +54,17 @@ index 87f0f34..342bdfc 100644
+ if (shader_program == SHADER_PROGRAM_SOLID_WHITE &&
+ shader_type == GL_FRAGMENT_SHADER) {
+ bg_shader = base::StringPrintf(
+ "void main() { gl_FragColor = vec4(%f, %f, %f, 1.0); }",
+ bgcolor[0], bgcolor[1], bgcolor[2]);
+ "void main() { gl_FragColor = vec4(%s, %s, %s, 1.0); }",
+ base::DoubleToString(bgcolor[0]).c_str(),
+ base::DoubleToString(bgcolor[1]).c_str(),
+ base::DoubleToString(bgcolor[2]).c_str());
+ kFragmentShaderSourceCodeMap[shader_program] = bg_shader.c_str();
+ }
+
// Select and compile the shader program source code.
if (shader_type == GL_VERTEX_SHADER) {
const GLchar* source_snippets[] = {
@@ -414,6 +426,14 @@ void CompositingIOSurfaceShaderPrograms::SetOutputFormatForTesting(
@@ -414,6 +429,14 @@ void CompositingIOSurfaceShaderPrograms::SetOutputFormatForTesting(
Reset();
}