Commit 50442ee9 authored by dcastagna's avatar dcastagna Committed by Commit bot

Set GLSL "precision" only if using OpenGL ES.

GLSL precision qualifiers have no effect in OpenGL.
On Mac the precision qualifiers cause the shader not to compile.

BUG=

Review URL: https://codereview.chromium.org/1011503002

Cr-Commit-Position: refs/heads/master@{#320976}
parent dde9aceb
......@@ -44,9 +44,12 @@ SHADER(
v_texCoord = a_texCoord;
}
);
const char kFragmentShader[] =
const char kShaderDefaultFloatPrecision[] =
SHADER(
precision mediump float;
);
const char kFragmentShader[] =
SHADER(
uniform sampler2D a_texture;
varying vec2 v_texCoord;
void main() {
......@@ -187,7 +190,12 @@ class TextureUploadPerfTest : public testing::Test {
// Prepare a simple program and a vertex buffer that will be
// used to draw a quad on the offscreen surface.
vertex_shader_ = LoadShader(GL_VERTEX_SHADER, kVertexShader);
fragment_shader_ = LoadShader(GL_FRAGMENT_SHADER, kFragmentShader);
bool is_gles = gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2;
fragment_shader_ = LoadShader(
GL_FRAGMENT_SHADER,
base::StringPrintf("%s%s", is_gles ? kShaderDefaultFloatPrecision : "",
kFragmentShader).c_str());
program_object_ = glCreateProgram();
CHECK_NE(0u, program_object_);
......
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