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

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

Issue 2077633002: Add test that attemps to translate a shader twice Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expose another issue Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6
7 #include "gpu/command_buffer/service/shader_translator.h" 7 #include "gpu/command_buffer/service/shader_translator.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gl/gl_version_info.h" 9 #include "ui/gl/gl_version_info.h"
10 10
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 EXPECT_EQ(1u, interface_block_map.size()); 410 EXPECT_EQ(1u, interface_block_map.size());
411 InterfaceBlockMap::const_iterator iter; 411 InterfaceBlockMap::const_iterator iter;
412 for (iter = interface_block_map.begin(); 412 for (iter = interface_block_map.begin();
413 iter != interface_block_map.end(); ++iter) { 413 iter != interface_block_map.end(); ++iter) {
414 if (iter->second.name == "Color") 414 if (iter->second.name == "Color")
415 break; 415 break;
416 } 416 }
417 EXPECT_TRUE(iter != interface_block_map.end()); 417 EXPECT_TRUE(iter != interface_block_map.end());
418 } 418 }
419 419
420 TEST_F(ES3ShaderTranslatorTest, CompileTwice) {
421 const char* vs1 = "void main() { gl_Position = vec5(gl_DepthRange); }";
422
423 std::string info_log, translated_source;
424 int shader_version;
425 AttributeMap attrib_map;
426 UniformMap uniform_map;
427 VaryingMap varying_map;
428 InterfaceBlockMap interface_block_map;
429 OutputVariableList output_variable_list;
430 NameMap name_map;
431 vertex_translator_->Translate(
432 vs1, &info_log, &translated_source, &shader_version, &attrib_map,
433 &uniform_map, &varying_map, &interface_block_map, &output_variable_list,
434 &name_map);
435 vertex_translator_->Translate(
436 vs1, &info_log, &translated_source, &shader_version, &attrib_map,
437 &uniform_map, &varying_map, &interface_block_map, &output_variable_list,
438 &name_map);
439 }
440
420 TEST_F(ShaderTranslatorTest, OptionsString) { 441 TEST_F(ShaderTranslatorTest, OptionsString) {
421 scoped_refptr<ShaderTranslator> translator_1 = new ShaderTranslator(); 442 scoped_refptr<ShaderTranslator> translator_1 = new ShaderTranslator();
422 scoped_refptr<ShaderTranslator> translator_2 = new ShaderTranslator(); 443 scoped_refptr<ShaderTranslator> translator_2 = new ShaderTranslator();
423 scoped_refptr<ShaderTranslator> translator_3 = new ShaderTranslator(); 444 scoped_refptr<ShaderTranslator> translator_3 = new ShaderTranslator();
424 445
425 ShBuiltInResources resources; 446 ShBuiltInResources resources;
426 ShInitBuiltInResources(&resources); 447 ShInitBuiltInResources(&resources);
427 448
428 ASSERT_TRUE(translator_1->Init(GL_VERTEX_SHADER, SH_GLES2_SPEC, &resources, 449 ASSERT_TRUE(translator_1->Init(GL_VERTEX_SHADER, SH_GLES2_SPEC, &resources,
429 SH_GLSL_150_CORE_OUTPUT, 450 SH_GLSL_150_CORE_OUTPUT,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 ShaderTranslatorOutputVersionTest, 634 ShaderTranslatorOutputVersionTest,
614 testing::Values(make_gl_glsl_tuple("opengl es 2.0", ""), 635 testing::Values(make_gl_glsl_tuple("opengl es 2.0", ""),
615 make_gl_glsl_tuple("opengl es 3.0", ""), 636 make_gl_glsl_tuple("opengl es 3.0", ""),
616 make_gl_glsl_tuple("opengl es 3.1", ""), 637 make_gl_glsl_tuple("opengl es 3.1", ""),
617 make_gl_glsl_tuple("opengl es 3.2", 638 make_gl_glsl_tuple("opengl es 3.2",
618 ""))); 639 "")));
619 640
620 } // namespace gles2 641 } // namespace gles2
621 } // namespace gpu 642 } // namespace gpu
622 643
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698