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

Side by Side Diff: gpu/command_buffer/service/shader_translator_unittest.cc

Issue 23441050: Add driver bug workaround for SH_INIT_GL_POSITION. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 7 years, 3 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 "gpu/command_buffer/service/shader_translator.h" 5 #include "gpu/command_buffer/service/shader_translator.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace gpu { 8 namespace gpu {
9 namespace gles2 { 9 namespace gles2 {
10 10
(...skipping 10 matching lines...) Expand all
21 ShBuiltInResources resources; 21 ShBuiltInResources resources;
22 resources.MaxExpressionComplexity = 32; 22 resources.MaxExpressionComplexity = 32;
23 resources.MaxCallStackDepth = 32; 23 resources.MaxCallStackDepth = 32;
24 ShInitBuiltInResources(&resources); 24 ShInitBuiltInResources(&resources);
25 vertex_translator_ = new ShaderTranslator(); 25 vertex_translator_ = new ShaderTranslator();
26 fragment_translator_ = new ShaderTranslator(); 26 fragment_translator_ = new ShaderTranslator();
27 27
28 ASSERT_TRUE(vertex_translator_->Init( 28 ASSERT_TRUE(vertex_translator_->Init(
29 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources, 29 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources,
30 ShaderTranslatorInterface::kGlsl, 30 ShaderTranslatorInterface::kGlsl,
31 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated)); 31 SH_EMULATE_BUILT_IN_FUNCTIONS));
32 ASSERT_TRUE(fragment_translator_->Init( 32 ASSERT_TRUE(fragment_translator_->Init(
33 SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources, 33 SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources,
34 ShaderTranslatorInterface::kGlsl, 34 ShaderTranslatorInterface::kGlsl,
35 ShaderTranslatorInterface::kGlslBuiltInFunctionOriginal)); 35 static_cast<ShCompileOptions>(0)));
36 // Post-init the results must be empty. 36 // Post-init the results must be empty.
37 // Vertex translator results. 37 // Vertex translator results.
38 EXPECT_TRUE(vertex_translator_->translated_shader() == NULL); 38 EXPECT_TRUE(vertex_translator_->translated_shader() == NULL);
39 EXPECT_TRUE(vertex_translator_->info_log() == NULL); 39 EXPECT_TRUE(vertex_translator_->info_log() == NULL);
40 EXPECT_TRUE(vertex_translator_->attrib_map().empty()); 40 EXPECT_TRUE(vertex_translator_->attrib_map().empty());
41 EXPECT_TRUE(vertex_translator_->uniform_map().empty()); 41 EXPECT_TRUE(vertex_translator_->uniform_map().empty());
42 // Fragment translator results. 42 // Fragment translator results.
43 EXPECT_TRUE(fragment_translator_->translated_shader() == NULL); 43 EXPECT_TRUE(fragment_translator_->translated_shader() == NULL);
44 EXPECT_TRUE(fragment_translator_->info_log() == NULL); 44 EXPECT_TRUE(fragment_translator_->info_log() == NULL);
45 EXPECT_TRUE(fragment_translator_->attrib_map().empty()); 45 EXPECT_TRUE(fragment_translator_->attrib_map().empty());
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 scoped_refptr<ShaderTranslator> translator_1 = new ShaderTranslator(); 225 scoped_refptr<ShaderTranslator> translator_1 = new ShaderTranslator();
226 scoped_refptr<ShaderTranslator> translator_2 = new ShaderTranslator(); 226 scoped_refptr<ShaderTranslator> translator_2 = new ShaderTranslator();
227 scoped_refptr<ShaderTranslator> translator_3 = new ShaderTranslator(); 227 scoped_refptr<ShaderTranslator> translator_3 = new ShaderTranslator();
228 228
229 ShBuiltInResources resources; 229 ShBuiltInResources resources;
230 ShInitBuiltInResources(&resources); 230 ShInitBuiltInResources(&resources);
231 231
232 ASSERT_TRUE(translator_1->Init( 232 ASSERT_TRUE(translator_1->Init(
233 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources, 233 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources,
234 ShaderTranslatorInterface::kGlsl, 234 ShaderTranslatorInterface::kGlsl,
235 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated)); 235 SH_EMULATE_BUILT_IN_FUNCTIONS));
236 ASSERT_TRUE(translator_2->Init( 236 ASSERT_TRUE(translator_2->Init(
237 SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources, 237 SH_FRAGMENT_SHADER, SH_GLES2_SPEC, &resources,
238 ShaderTranslatorInterface::kGlsl, 238 ShaderTranslatorInterface::kGlsl,
239 ShaderTranslatorInterface::kGlslBuiltInFunctionOriginal)); 239 static_cast<ShCompileOptions>(0)));
240 resources.EXT_draw_buffers = 1; 240 resources.EXT_draw_buffers = 1;
241 ASSERT_TRUE(translator_3->Init( 241 ASSERT_TRUE(translator_3->Init(
242 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources, 242 SH_VERTEX_SHADER, SH_GLES2_SPEC, &resources,
243 ShaderTranslatorInterface::kGlsl, 243 ShaderTranslatorInterface::kGlsl,
244 ShaderTranslatorInterface::kGlslBuiltInFunctionEmulated)); 244 SH_EMULATE_BUILT_IN_FUNCTIONS));
245 245
246 std::string options_1( 246 std::string options_1(
247 translator_1->GetStringForOptionsThatWouldEffectCompilation()); 247 translator_1->GetStringForOptionsThatWouldEffectCompilation());
248 std::string options_2( 248 std::string options_2(
249 translator_1->GetStringForOptionsThatWouldEffectCompilation()); 249 translator_1->GetStringForOptionsThatWouldEffectCompilation());
250 std::string options_3( 250 std::string options_3(
251 translator_2->GetStringForOptionsThatWouldEffectCompilation()); 251 translator_2->GetStringForOptionsThatWouldEffectCompilation());
252 std::string options_4( 252 std::string options_4(
253 translator_3->GetStringForOptionsThatWouldEffectCompilation()); 253 translator_3->GetStringForOptionsThatWouldEffectCompilation());
254 254
255 EXPECT_EQ(options_1, options_2); 255 EXPECT_EQ(options_1, options_2);
256 EXPECT_NE(options_1, options_3); 256 EXPECT_NE(options_1, options_3);
257 EXPECT_NE(options_1, options_4); 257 EXPECT_NE(options_1, options_4);
258 EXPECT_NE(options_3, options_4); 258 EXPECT_NE(options_3, options_4);
259 } 259 }
260 260
261 } // namespace gles2 261 } // namespace gles2
262 } // namespace gpu 262 } // namespace gpu
263 263
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/shader_translator_cache.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698