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

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

Issue 10635011: Add glBindUniformLocationCHROMIUM (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 "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 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 .RetiresOnSaturation(); 594 .RetiresOnSaturation();
595 } 595 }
596 } 596 }
597 597
598 void GLES2DecoderTestBase::SetupShaderForUniform() { 598 void GLES2DecoderTestBase::SetupShaderForUniform() {
599 static AttribInfo attribs[] = { 599 static AttribInfo attribs[] = {
600 { "foo", 1, GL_FLOAT, 1, }, 600 { "foo", 1, GL_FLOAT, 1, },
601 { "goo", 1, GL_FLOAT, 2, }, 601 { "goo", 1, GL_FLOAT, 2, },
602 }; 602 };
603 static UniformInfo uniforms[] = { 603 static UniformInfo uniforms[] = {
604 { "bar", 1, GL_INT, 0, 2, }, 604 { "bar", 1, GL_INT, 0, 2, -1, },
605 { "car", 4, GL_INT, 1, 1, }, 605 { "car", 4, GL_INT, 1, 1, -1, },
606 }; 606 };
607 const GLuint kClientVertexShaderId = 5001; 607 const GLuint kClientVertexShaderId = 5001;
608 const GLuint kServiceVertexShaderId = 6001; 608 const GLuint kServiceVertexShaderId = 6001;
609 const GLuint kClientFragmentShaderId = 5002; 609 const GLuint kClientFragmentShaderId = 5002;
610 const GLuint kServiceFragmentShaderId = 6002; 610 const GLuint kServiceFragmentShaderId = 6002;
611 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms), 611 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms),
612 client_program_id_, kServiceProgramId, 612 client_program_id_, kServiceProgramId,
613 kClientVertexShaderId, kServiceVertexShaderId, 613 kClientVertexShaderId, kServiceVertexShaderId,
614 kClientFragmentShaderId, kServiceFragmentShaderId); 614 kClientFragmentShaderId, kServiceFragmentShaderId);
615 615
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 const GLint GLES2DecoderTestBase::kUniform2Size; 1066 const GLint GLES2DecoderTestBase::kUniform2Size;
1067 const GLint GLES2DecoderTestBase::kUniform3Size; 1067 const GLint GLES2DecoderTestBase::kUniform3Size;
1068 const GLint GLES2DecoderTestBase::kUniform1RealLocation; 1068 const GLint GLES2DecoderTestBase::kUniform1RealLocation;
1069 const GLint GLES2DecoderTestBase::kUniform2RealLocation; 1069 const GLint GLES2DecoderTestBase::kUniform2RealLocation;
1070 const GLint GLES2DecoderTestBase::kUniform2ElementRealLocation; 1070 const GLint GLES2DecoderTestBase::kUniform2ElementRealLocation;
1071 const GLint GLES2DecoderTestBase::kUniform3RealLocation; 1071 const GLint GLES2DecoderTestBase::kUniform3RealLocation;
1072 const GLint GLES2DecoderTestBase::kUniform1FakeLocation; 1072 const GLint GLES2DecoderTestBase::kUniform1FakeLocation;
1073 const GLint GLES2DecoderTestBase::kUniform2FakeLocation; 1073 const GLint GLES2DecoderTestBase::kUniform2FakeLocation;
1074 const GLint GLES2DecoderTestBase::kUniform2ElementFakeLocation; 1074 const GLint GLES2DecoderTestBase::kUniform2ElementFakeLocation;
1075 const GLint GLES2DecoderTestBase::kUniform3FakeLocation; 1075 const GLint GLES2DecoderTestBase::kUniform3FakeLocation;
1076 const GLint GLES2DecoderTestBase::kUniform1DesiredLocation;
1077 const GLint GLES2DecoderTestBase::kUniform2DesiredLocation;
1078 const GLint GLES2DecoderTestBase::kUniform3DesiredLocation;
1076 const GLenum GLES2DecoderTestBase::kUniform1Type; 1079 const GLenum GLES2DecoderTestBase::kUniform1Type;
1077 const GLenum GLES2DecoderTestBase::kUniform2Type; 1080 const GLenum GLES2DecoderTestBase::kUniform2Type;
1078 const GLenum GLES2DecoderTestBase::kUniform3Type; 1081 const GLenum GLES2DecoderTestBase::kUniform3Type;
1079 const GLenum GLES2DecoderTestBase::kUniformCubemapType; 1082 const GLenum GLES2DecoderTestBase::kUniformCubemapType;
1080 const GLint GLES2DecoderTestBase::kInvalidUniformLocation; 1083 const GLint GLES2DecoderTestBase::kInvalidUniformLocation;
1081 const GLint GLES2DecoderTestBase::kBadUniformIndex; 1084 const GLint GLES2DecoderTestBase::kBadUniformIndex;
1082 1085
1083 #endif 1086 #endif
1084 1087
1085 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1"; 1088 const char* GLES2DecoderTestBase::kAttrib1Name = "attrib1";
1086 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2"; 1089 const char* GLES2DecoderTestBase::kAttrib2Name = "attrib2";
1087 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3"; 1090 const char* GLES2DecoderTestBase::kAttrib3Name = "attrib3";
1088 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1"; 1091 const char* GLES2DecoderTestBase::kUniform1Name = "uniform1";
1089 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]"; 1092 const char* GLES2DecoderTestBase::kUniform2Name = "uniform2[0]";
1090 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]"; 1093 const char* GLES2DecoderTestBase::kUniform3Name = "uniform3[0]";
1091 1094
1092 void GLES2DecoderTestBase::SetupDefaultProgram() { 1095 void GLES2DecoderTestBase::SetupDefaultProgram() {
1093 { 1096 {
1094 static AttribInfo attribs[] = { 1097 static AttribInfo attribs[] = {
1095 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, 1098 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
1096 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, 1099 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
1097 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, 1100 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
1098 }; 1101 };
1099 static UniformInfo uniforms[] = { 1102 static UniformInfo uniforms[] = {
1100 { kUniform1Name, kUniform1Size, kUniform1Type, 1103 { kUniform1Name, kUniform1Size, kUniform1Type,
1101 kUniform1FakeLocation, kUniform1RealLocation }, 1104 kUniform1FakeLocation, kUniform1RealLocation,
1105 kUniform1DesiredLocation },
1102 { kUniform2Name, kUniform2Size, kUniform2Type, 1106 { kUniform2Name, kUniform2Size, kUniform2Type,
1103 kUniform2FakeLocation, kUniform2RealLocation }, 1107 kUniform2FakeLocation, kUniform2RealLocation,
1108 kUniform2DesiredLocation },
1104 { kUniform3Name, kUniform3Size, kUniform3Type, 1109 { kUniform3Name, kUniform3Size, kUniform3Type,
1105 kUniform3FakeLocation, kUniform3RealLocation }, 1110 kUniform3FakeLocation, kUniform3RealLocation,
1111 kUniform3DesiredLocation },
1106 }; 1112 };
1107 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms), 1113 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms),
1108 client_program_id_, kServiceProgramId, 1114 client_program_id_, kServiceProgramId,
1109 client_vertex_shader_id_, kServiceVertexShaderId, 1115 client_vertex_shader_id_, kServiceVertexShaderId,
1110 client_fragment_shader_id_, kServiceFragmentShaderId); 1116 client_fragment_shader_id_, kServiceFragmentShaderId);
1111 } 1117 }
1112 1118
1113 { 1119 {
1114 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) 1120 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId))
1115 .Times(1) 1121 .Times(1)
1116 .RetiresOnSaturation(); 1122 .RetiresOnSaturation();
1117 UseProgram cmd; 1123 UseProgram cmd;
1118 cmd.Init(client_program_id_); 1124 cmd.Init(client_program_id_);
1119 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1125 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1120 } 1126 }
1121 } 1127 }
1122 1128
1123 void GLES2DecoderTestBase::SetupCubemapProgram() { 1129 void GLES2DecoderTestBase::SetupCubemapProgram() {
1124 { 1130 {
1125 static AttribInfo attribs[] = { 1131 static AttribInfo attribs[] = {
1126 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, 1132 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
1127 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, 1133 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, },
1128 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, 1134 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, },
1129 }; 1135 };
1130 static UniformInfo uniforms[] = { 1136 static UniformInfo uniforms[] = {
1131 { kUniform1Name, kUniform1Size, kUniformCubemapType, 1137 { kUniform1Name, kUniform1Size, kUniformCubemapType,
1132 kUniform1FakeLocation, kUniform1RealLocation, }, 1138 kUniform1FakeLocation, kUniform1RealLocation,
1139 kUniform1DesiredLocation, },
1133 { kUniform2Name, kUniform2Size, kUniform2Type, 1140 { kUniform2Name, kUniform2Size, kUniform2Type,
1134 kUniform2FakeLocation, kUniform2RealLocation, }, 1141 kUniform2FakeLocation, kUniform2RealLocation,
1142 kUniform2DesiredLocation, },
1135 { kUniform3Name, kUniform3Size, kUniform3Type, 1143 { kUniform3Name, kUniform3Size, kUniform3Type,
1136 kUniform3FakeLocation, kUniform3RealLocation, }, 1144 kUniform3FakeLocation, kUniform3RealLocation,
1145 kUniform3DesiredLocation, },
1137 }; 1146 };
1138 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms), 1147 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms),
1139 client_program_id_, kServiceProgramId, 1148 client_program_id_, kServiceProgramId,
1140 client_vertex_shader_id_, kServiceVertexShaderId, 1149 client_vertex_shader_id_, kServiceVertexShaderId,
1141 client_fragment_shader_id_, kServiceFragmentShaderId); 1150 client_fragment_shader_id_, kServiceFragmentShaderId);
1142 } 1151 }
1143 1152
1144 { 1153 {
1145 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) 1154 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId))
1146 .Times(1) 1155 .Times(1)
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 num_vertices, buffer_id, GL_NO_ERROR); 1338 num_vertices, buffer_id, GL_NO_ERROR);
1330 } 1339 }
1331 1340
1332 void GLES2DecoderWithShaderTestBase::SetUp() { 1341 void GLES2DecoderWithShaderTestBase::SetUp() {
1333 GLES2DecoderTestBase::SetUp(); 1342 GLES2DecoderTestBase::SetUp();
1334 SetupDefaultProgram(); 1343 SetupDefaultProgram();
1335 } 1344 }
1336 1345
1337 } // namespace gles2 1346 } // namespace gles2
1338 } // namespace gpu 1347 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h ('k') | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698