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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <GLES2/gl2extchromium.h> 7 #include <GLES2/gl2extchromium.h>
8 #include <stdint.h>
8 9
9 #include "gpu/command_buffer/service/context_group.h" 10 #include "gpu/command_buffer/service/context_group.h"
10 #include "gpu/command_buffer/tests/gl_manager.h" 11 #include "gpu/command_buffer/tests/gl_manager.h"
11 #include "gpu/command_buffer/tests/gl_test_utils.h" 12 #include "gpu/command_buffer/tests/gl_test_utils.h"
12 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 #define SHADER(Src) #Src 16 #define SHADER(Src) #Src
16 17
17 namespace gpu { 18 namespace gpu {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 GLuint fs = GLTestHelper::LoadShader(GL_FRAGMENT_SHADER, f_red_shader_str); 121 GLuint fs = GLTestHelper::LoadShader(GL_FRAGMENT_SHADER, f_red_shader_str);
121 GLuint program = GLTestHelper::SetupProgram(vs, fs); 122 GLuint program = GLTestHelper::SetupProgram(vs, fs);
122 glUseProgram(program); 123 glUseProgram(program);
123 glShaderSource(fs, 1, &f_blue_shader_str, NULL); 124 glShaderSource(fs, 1, &f_blue_shader_str, NULL);
124 glCompileShader(fs); 125 glCompileShader(fs);
125 glLinkProgram(program); 126 glLinkProgram(program);
126 // We specifically don't call UseProgram again. 127 // We specifically don't call UseProgram again.
127 GLuint position_loc = glGetAttribLocation(program, "a_position"); 128 GLuint position_loc = glGetAttribLocation(program, "a_position");
128 GLTestHelper::SetupUnitQuad(position_loc); 129 GLTestHelper::SetupUnitQuad(position_loc);
129 glDrawArrays(GL_TRIANGLES, 0, 6); 130 glDrawArrays(GL_TRIANGLES, 0, 6);
130 uint8 expected_color[] = { 0, 0, 255, 255, }; 131 uint8_t expected_color[] = {
132 0, 0, 255, 255,
133 };
131 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color)); 134 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color));
132 GLTestHelper::CheckGLError("no errors", __LINE__); 135 GLTestHelper::CheckGLError("no errors", __LINE__);
133 } 136 }
134 137
135 TEST_F(GLProgramTest, ShaderLengthSpecified) { 138 TEST_F(GLProgramTest, ShaderLengthSpecified) {
136 const std::string valid_shader_str = SHADER( 139 const std::string valid_shader_str = SHADER(
137 attribute vec4 a_position; 140 attribute vec4 a_position;
138 void main() 141 void main()
139 { 142 {
140 gl_Position = a_position; 143 gl_Position = a_position;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 glLinkProgram(program); 189 glLinkProgram(program);
187 190
188 // This test will fail on NVidia Linux if not worked around. 191 // This test will fail on NVidia Linux if not worked around.
189 GLint color_location = glGetUniformLocation(program, "u_color"); 192 GLint color_location = glGetUniformLocation(program, "u_color");
190 glUniform4f(color_location, 0.0f, 0.0f, 1.0f, 1.0f); 193 glUniform4f(color_location, 0.0f, 0.0f, 1.0f, 1.0f);
191 194
192 // We specifically don't call UseProgram again. 195 // We specifically don't call UseProgram again.
193 GLuint position_loc = glGetAttribLocation(program, "a_position"); 196 GLuint position_loc = glGetAttribLocation(program, "a_position");
194 GLTestHelper::SetupUnitQuad(position_loc); 197 GLTestHelper::SetupUnitQuad(position_loc);
195 glDrawArrays(GL_TRIANGLES, 0, 6); 198 glDrawArrays(GL_TRIANGLES, 0, 6);
196 uint8 expected_color[] = { 0, 0, 255, 255, }; 199 uint8_t expected_color[] = {
200 0, 0, 255, 255,
201 };
197 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color)); 202 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color));
198 GLTestHelper::CheckGLError("no errors", __LINE__); 203 GLTestHelper::CheckGLError("no errors", __LINE__);
199 } 204 }
200 205
201 TEST_F(WebGLProgramTest, DeferCompileWithExt) { 206 TEST_F(WebGLProgramTest, DeferCompileWithExt) {
202 // This test must have extensions enabled. 207 // This test must have extensions enabled.
203 gles2::ContextGroup* context_group = gl_.decoder()->GetContextGroup(); 208 gles2::ContextGroup* context_group = gl_.decoder()->GetContextGroup();
204 gles2::FeatureInfo* feature_info = context_group->feature_info(); 209 gles2::FeatureInfo* feature_info = context_group->feature_info();
205 const gles2::FeatureInfo::FeatureFlags& flags = feature_info->feature_flags(); 210 const gles2::FeatureInfo::FeatureFlags& flags = feature_info->feature_flags();
206 if (!flags.ext_frag_depth) 211 if (!flags.ext_frag_depth)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 276
272 glLinkProgram(program); 277 glLinkProgram(program);
273 278
274 GLint linked = 0; 279 GLint linked = 0;
275 glGetProgramiv(program, GL_LINK_STATUS, &linked); 280 glGetProgramiv(program, GL_LINK_STATUS, &linked);
276 EXPECT_NE(0, linked); 281 EXPECT_NE(0, linked);
277 } 282 }
278 283
279 } // namespace gpu 284 } // namespace gpu
280 285
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_pointcoord_unittest.cc ('k') | gpu/command_buffer/tests/gl_query_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698