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

Side by Side Diff: gpu/command_buffer/tests/gl_consistent_uniform_locations_unittest.cc

Issue 10581029: Make GL_CHROMIUM_consistent_uniform_locations slighty more robust (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 7
8 #include "gpu/command_buffer/tests/gl_manager.h" 8 #include "gpu/command_buffer/tests/gl_manager.h"
9 #include "gpu/command_buffer/tests/gl_test_utils.h" 9 #include "gpu/command_buffer/tests/gl_test_utils.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 gl_FragColor = u_colorA + u_colorB[0] + u_colorB[1] + u_colorC; 58 gl_FragColor = u_colorA + u_colorB[0] + u_colorB[1] + u_colorC;
59 } 59 }
60 ); 60 );
61 61
62 static const GLUniformDefinitionCHROMIUM defs[] = { 62 static const GLUniformDefinitionCHROMIUM defs[] = {
63 { GL_FLOAT_VEC4, 1, "u_colorC", }, 63 { GL_FLOAT_VEC4, 1, "u_colorC", },
64 { GL_FLOAT_VEC4, 2, "u_colorB", }, 64 { GL_FLOAT_VEC4, 2, "u_colorB", },
65 { GL_FLOAT_VEC4, 1, "u_colorA", }, 65 { GL_FLOAT_VEC4, 1, "u_colorA", },
66 }; 66 };
67 67
68 GLuint program = GLTestHelper::LoadProgram(v_shader_str, f_shader_str);
69
68 GLint locations[4]; 70 GLint locations[4];
69 71
70 glGetUniformLocationsCHROMIUM( 72 glGetUniformLocationsCHROMIUM(
71 defs, arraysize(defs), arraysize(locations), locations); 73 program, defs, arraysize(defs), arraysize(locations), locations);
72 74
73 GLint u_colorCLocation = locations[0]; 75 GLint u_colorCLocation = locations[0];
74 GLint u_colorB0Location = locations[1]; 76 GLint u_colorB0Location = locations[1];
75 GLint u_colorB1Location = locations[2]; 77 GLint u_colorB1Location = locations[2];
76 GLint u_colorALocation = locations[3]; 78 GLint u_colorALocation = locations[3];
77 79
78 GLuint program = GLTestHelper::LoadProgram(v_shader_str, f_shader_str);
79
80 GLint position_loc = glGetAttribLocation(program, "a_position"); 80 GLint position_loc = glGetAttribLocation(program, "a_position");
81 81
82 GLTestHelper::SetupUnitQuad(position_loc); 82 GLTestHelper::SetupUnitQuad(position_loc);
83 83
84 glUseProgram(program); 84 glUseProgram(program);
85 85
86 glUniform4f(u_colorALocation, 0.25f, 0.0f, 0.0f, 0.0f); 86 glUniform4f(u_colorALocation, 0.25f, 0.0f, 0.0f, 0.0f);
87 glUniform4f(u_colorB0Location, 0.0f, 0.50f, 0.0f, 0.0f); 87 glUniform4f(u_colorB0Location, 0.0f, 0.50f, 0.0f, 0.0f);
88 glUniform4f(u_colorB1Location, 0.0f, 0.0f, 0.75f, 0.0f); 88 glUniform4f(u_colorB1Location, 0.0f, 0.0f, 0.75f, 0.0f);
89 glUniform4f(u_colorCLocation, 0.0f, 0.0f, 0.0f, 1.0f); 89 glUniform4f(u_colorCLocation, 0.0f, 0.0f, 0.0f, 1.0f);
90 90
91 glDrawArrays(GL_TRIANGLES, 0, 6); 91 glDrawArrays(GL_TRIANGLES, 0, 6);
92 92
93 static const uint8 expected[] = { 64, 128, 192, 255 }; 93 static const uint8 expected[] = { 64, 128, 192, 255 };
94 EXPECT_TRUE( 94 EXPECT_TRUE(
95 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected)); 95 GLTestHelper::CheckPixels(0, 0, kResolution, kResolution, 1, expected));
96 96
97 GLTestHelper::CheckGLError("no errors", __LINE__); 97 GLTestHelper::CheckGLError("no errors", __LINE__);
98 } 98 }
99 99
100 } // namespace gpu 100 } // namespace gpu
101 101
102 102
103 103
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h ('k') | third_party/khronos/GLES2/gl2ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698