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

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

Issue 1309743005: command_buffer: Implement EXT_blend_func_extended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-05-path-fragment-input-gen
Patch Set: rebase 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 (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/gles2_cmd_decoder_unittest_base.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 client_sync_id_(127), 113 client_sync_id_(127),
114 service_renderbuffer_id_(0), 114 service_renderbuffer_id_(0),
115 service_renderbuffer_valid_(false), 115 service_renderbuffer_valid_(false),
116 ignore_cached_state_for_test_(GetParam()), 116 ignore_cached_state_for_test_(GetParam()),
117 cached_color_mask_red_(true), 117 cached_color_mask_red_(true),
118 cached_color_mask_green_(true), 118 cached_color_mask_green_(true),
119 cached_color_mask_blue_(true), 119 cached_color_mask_blue_(true),
120 cached_color_mask_alpha_(true), 120 cached_color_mask_alpha_(true),
121 cached_depth_mask_(true), 121 cached_depth_mask_(true),
122 cached_stencil_front_mask_(static_cast<GLuint>(-1)), 122 cached_stencil_front_mask_(static_cast<GLuint>(-1)),
123 cached_stencil_back_mask_(static_cast<GLuint>(-1)) { 123 cached_stencil_back_mask_(static_cast<GLuint>(-1)),
124 shader_language_version_(100) {
124 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); 125 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_));
125 } 126 }
126 127
127 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} 128 GLES2DecoderTestBase::~GLES2DecoderTestBase() {}
128 129
129 void GLES2DecoderTestBase::SetUp() { 130 void GLES2DecoderTestBase::SetUp() {
130 InitState init; 131 InitState init;
131 // Autogenerated tests do not overwrite version or extension string, 132 // Autogenerated tests do not overwrite version or extension string,
132 // so we have to pick something that supports everything here. 133 // so we have to pick something that supports everything here.
133 init.gl_version = "4.4"; 134 init.gl_version = "4.4";
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 const GLenum GLES2DecoderTestBase::kUniform1Type; 1492 const GLenum GLES2DecoderTestBase::kUniform1Type;
1492 const GLenum GLES2DecoderTestBase::kUniform2Type; 1493 const GLenum GLES2DecoderTestBase::kUniform2Type;
1493 const GLenum GLES2DecoderTestBase::kUniform3Type; 1494 const GLenum GLES2DecoderTestBase::kUniform3Type;
1494 const GLenum GLES2DecoderTestBase::kUniform4Type; 1495 const GLenum GLES2DecoderTestBase::kUniform4Type;
1495 const GLenum GLES2DecoderTestBase::kUniform5Type; 1496 const GLenum GLES2DecoderTestBase::kUniform5Type;
1496 const GLenum GLES2DecoderTestBase::kUniform6Type; 1497 const GLenum GLES2DecoderTestBase::kUniform6Type;
1497 const GLenum GLES2DecoderTestBase::kUniform7Type; 1498 const GLenum GLES2DecoderTestBase::kUniform7Type;
1498 const GLenum GLES2DecoderTestBase::kUniformCubemapType; 1499 const GLenum GLES2DecoderTestBase::kUniformCubemapType;
1499 const GLint GLES2DecoderTestBase::kInvalidUniformLocation; 1500 const GLint GLES2DecoderTestBase::kInvalidUniformLocation;
1500 const GLint GLES2DecoderTestBase::kBadUniformIndex; 1501 const GLint GLES2DecoderTestBase::kBadUniformIndex;
1501 1502 const GLint GLES2DecoderTestBase::kOutputVariable1Size;
1503 const GLenum GLES2DecoderTestBase::kOutputVariable1Type;
1504 const GLuint GLES2DecoderTestBase::kOutputVariable1ColorName;
1505 const GLuint GLES2DecoderTestBase::kOutputVariable1Index;
1502 #endif 1506 #endif
1503 1507
1504 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; 1508 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1";
1505 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; 1509 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2";
1506 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; 1510 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3";
1507 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; 1511 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1";
1508 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; 1512 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]";
1509 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; 1513 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]";
1510 const char* GLES2DecoderTestBase::kUniform4Name = "uniform4"; 1514 const char* GLES2DecoderTestBase::kUniform4Name = "uniform4";
1511 const char* GLES2DecoderTestBase::kUniform5Name = "uniform5"; 1515 const char* GLES2DecoderTestBase::kUniform5Name = "uniform5";
1512 const char* GLES2DecoderTestBase::kUniform6Name = "uniform6"; 1516 const char* GLES2DecoderTestBase::kUniform6Name = "uniform6";
1513 const char* GLES2DecoderTestBase::kUniform7Name = "uniform7"; 1517 const char* GLES2DecoderTestBase::kUniform7Name = "uniform7";
1514 1518
1519 const char* GLES2DecoderTestBase::kOutputVariable1Name = "gl_FragColor";
1520 const char* GLES2DecoderTestBase::kOutputVariable1NameESSL3 = "color";
1521
1515 void GLES2DecoderTestBase::SetupDefaultProgram() { 1522 void GLES2DecoderTestBase::SetupDefaultProgram() {
1516 { 1523 {
1517 static AttribInfo attribs[] = { 1524 static AttribInfo attribs[] = {
1518 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, 1525 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
1519 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, 1526 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
1520 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, 1527 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
1521 }; 1528 };
1522 static UniformInfo uniforms[] = { 1529 static UniformInfo uniforms[] = {
1523 { kUniform1Name, kUniform1Size, kUniform1Type, 1530 { kUniform1Name, kUniform1Size, kUniform1Type,
1524 kUniform1FakeLocation, kUniform1RealLocation, 1531 kUniform1FakeLocation, kUniform1RealLocation,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 void GLES2DecoderWithShaderTestBase::TearDown() { 1660 void GLES2DecoderWithShaderTestBase::TearDown() {
1654 GLES2DecoderTestBase::TearDown(); 1661 GLES2DecoderTestBase::TearDown();
1655 } 1662 }
1656 1663
1657 void GLES2DecoderTestBase::SetupShader( 1664 void GLES2DecoderTestBase::SetupShader(
1658 GLES2DecoderTestBase::AttribInfo* attribs, size_t num_attribs, 1665 GLES2DecoderTestBase::AttribInfo* attribs, size_t num_attribs,
1659 GLES2DecoderTestBase::UniformInfo* uniforms, size_t num_uniforms, 1666 GLES2DecoderTestBase::UniformInfo* uniforms, size_t num_uniforms,
1660 GLuint program_client_id, GLuint program_service_id, 1667 GLuint program_client_id, GLuint program_service_id,
1661 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id, 1668 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id,
1662 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id) { 1669 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id) {
1670 static TestHelper::ProgramOutputInfo kProgramOutputsESSL1[] = {{
1671 kOutputVariable1Name, kOutputVariable1Size, kOutputVariable1Type,
1672 kOutputVariable1ColorName, kOutputVariable1Index,
1673 }};
1674 static TestHelper::ProgramOutputInfo kProgramOutputsESSL3[] = {{
1675 kOutputVariable1NameESSL3, kOutputVariable1Size, kOutputVariable1Type,
1676 kOutputVariable1ColorName, kOutputVariable1Index,
1677 }};
1678 TestHelper::ProgramOutputInfo* program_outputs =
1679 shader_language_version_ == 100 ? kProgramOutputsESSL1
1680 : kProgramOutputsESSL3;
1681 const size_t kNumProgramOutputs = 1;
1682
1663 { 1683 {
1664 InSequence s; 1684 InSequence s;
1665 1685
1666 EXPECT_CALL(*gl_, 1686 EXPECT_CALL(*gl_,
1667 AttachShader(program_service_id, vertex_shader_service_id)) 1687 AttachShader(program_service_id, vertex_shader_service_id))
1668 .Times(1) 1688 .Times(1)
1669 .RetiresOnSaturation(); 1689 .RetiresOnSaturation();
1670 EXPECT_CALL(*gl_, 1690 EXPECT_CALL(*gl_,
1671 AttachShader(program_service_id, fragment_shader_service_id)) 1691 AttachShader(program_service_id, fragment_shader_service_id))
1672 .Times(1) 1692 .Times(1)
1673 .RetiresOnSaturation(); 1693 .RetiresOnSaturation();
1674 TestHelper::SetupShaderExpectations(gl_.get(), group_->feature_info(), 1694
1675 attribs, num_attribs, uniforms, 1695 TestHelper::SetupShaderExpectationsWithVaryings(
1676 num_uniforms, program_service_id); 1696 gl_.get(), group_->feature_info(), attribs, num_attribs, uniforms,
1697 num_uniforms, nullptr, 0, program_outputs, kNumProgramOutputs,
1698 program_service_id);
1677 } 1699 }
1678 1700
1679 DoCreateShader( 1701 DoCreateShader(
1680 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id); 1702 GL_VERTEX_SHADER, vertex_shader_client_id, vertex_shader_service_id);
1681 DoCreateShader( 1703 DoCreateShader(
1682 GL_FRAGMENT_SHADER, fragment_shader_client_id, 1704 GL_FRAGMENT_SHADER, fragment_shader_client_id,
1683 fragment_shader_service_id); 1705 fragment_shader_service_id);
1684 1706
1685 TestHelper::SetShaderStates( 1707 TestHelper::SetShaderStates(gl_.get(), GetShader(vertex_shader_client_id),
1686 gl_.get(), GetShader(vertex_shader_client_id), true); 1708 true, nullptr, nullptr, &shader_language_version_,
1687 TestHelper::SetShaderStates( 1709 nullptr, nullptr, nullptr, nullptr, nullptr,
1688 gl_.get(), GetShader(fragment_shader_client_id), true); 1710 nullptr);
1711
1712 OutputVariableList frag_output_variable_list;
1713 frag_output_variable_list.push_back(TestHelper::ConstructOutputVariable(
1714 program_outputs[0].type, program_outputs[0].size, GL_MEDIUM_FLOAT, true,
1715 program_outputs[0].name));
1716
1717 TestHelper::SetShaderStates(gl_.get(), GetShader(fragment_shader_client_id),
1718 true, nullptr, nullptr, &shader_language_version_,
1719 nullptr, nullptr, nullptr, nullptr,
1720 &frag_output_variable_list, nullptr);
1689 1721
1690 cmds::AttachShader attach_cmd; 1722 cmds::AttachShader attach_cmd;
1691 attach_cmd.Init(program_client_id, vertex_shader_client_id); 1723 attach_cmd.Init(program_client_id, vertex_shader_client_id);
1692 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); 1724 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
1693 1725
1694 attach_cmd.Init(program_client_id, fragment_shader_client_id); 1726 attach_cmd.Init(program_client_id, fragment_shader_client_id);
1695 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); 1727 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
1696 1728
1697 cmds::LinkProgram link_cmd; 1729 cmds::LinkProgram link_cmd;
1698 link_cmd.Init(program_client_id); 1730 link_cmd.Init(program_client_id);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 SetupDefaultProgram(); 1938 SetupDefaultProgram();
1907 } 1939 }
1908 1940
1909 // Include the auto-generated part of this file. We split this because it means 1941 // Include the auto-generated part of this file. We split this because it means
1910 // we can easily edit the non-auto generated parts right here in this file 1942 // we can easily edit the non-auto generated parts right here in this file
1911 // instead of having to edit some template or the code generator. 1943 // instead of having to edit some template or the code generator.
1912 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" 1944 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h"
1913 1945
1914 } // namespace gles2 1946 } // namespace gles2
1915 } // namespace gpu 1947 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698