OLD | NEW |
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 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 }; | 75 }; |
76 | 76 |
77 struct VaryingInfo { | 77 struct VaryingInfo { |
78 const char* name; | 78 const char* name; |
79 GLint size; | 79 GLint size; |
80 GLenum type; | 80 GLenum type; |
81 GLint fake_location; | 81 GLint fake_location; |
82 GLint real_location; | 82 GLint real_location; |
83 GLint desired_location; | 83 GLint desired_location; |
84 }; | 84 }; |
| 85 struct ProgramOutputInfo { |
| 86 const char* name; |
| 87 GLint size; |
| 88 GLenum type; |
| 89 GLint color_name; |
| 90 GLuint index; |
| 91 }; |
85 | 92 |
86 static void SetupContextGroupInitExpectations( | 93 static void SetupContextGroupInitExpectations( |
87 ::gfx::MockGLInterface* gl, | 94 ::gfx::MockGLInterface* gl, |
88 const DisallowedFeatures& disallowed_features, | 95 const DisallowedFeatures& disallowed_features, |
89 const char* extensions, | 96 const char* extensions, |
90 const char* gl_version, | 97 const char* gl_version, |
91 bool bind_generates_resource); | 98 bool bind_generates_resource); |
92 static void SetupFeatureInfoInitExpectations( | 99 static void SetupFeatureInfoInitExpectations( |
93 ::gfx::MockGLInterface* gl, const char* extensions); | 100 ::gfx::MockGLInterface* gl, const char* extensions); |
94 static void SetupFeatureInfoInitExpectationsWithGLVersion( | 101 static void SetupFeatureInfoInitExpectationsWithGLVersion( |
(...skipping 24 matching lines...) Expand all Loading... |
119 | 126 |
120 static void SetupShaderExpectationsWithVaryings( | 127 static void SetupShaderExpectationsWithVaryings( |
121 ::gfx::MockGLInterface* gl, | 128 ::gfx::MockGLInterface* gl, |
122 const FeatureInfo* feature_info, | 129 const FeatureInfo* feature_info, |
123 AttribInfo* attribs, | 130 AttribInfo* attribs, |
124 size_t num_attribs, | 131 size_t num_attribs, |
125 UniformInfo* uniforms, | 132 UniformInfo* uniforms, |
126 size_t num_uniforms, | 133 size_t num_uniforms, |
127 VaryingInfo* varyings, | 134 VaryingInfo* varyings, |
128 size_t num_varyings, | 135 size_t num_varyings, |
| 136 ProgramOutputInfo* program_outputs, |
| 137 size_t num_program_outputs, |
129 GLuint service_id); | 138 GLuint service_id); |
130 | 139 |
131 static void SetupProgramSuccessExpectations(::gfx::MockGLInterface* gl, | 140 static void SetupProgramSuccessExpectations( |
132 const FeatureInfo* feature_info, | 141 ::gfx::MockGLInterface* gl, |
133 AttribInfo* attribs, | 142 const FeatureInfo* feature_info, |
134 size_t num_attribs, | 143 AttribInfo* attribs, |
135 UniformInfo* uniforms, | 144 size_t num_attribs, |
136 size_t num_uniforms, | 145 UniformInfo* uniforms, |
137 VaryingInfo* varyings, | 146 size_t num_uniforms, |
138 size_t num_varyings, | 147 VaryingInfo* varyings, |
139 GLuint service_id); | 148 size_t num_varyings, |
| 149 ProgramOutputInfo* program_outputs, |
| 150 size_t num_program_outputs, |
| 151 GLuint service_id); |
140 | 152 |
141 static void DoBufferData( | 153 static void DoBufferData( |
142 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 154 ::gfx::MockGLInterface* gl, MockErrorState* error_state, |
143 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, | 155 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, |
144 GLenum usage, const GLvoid* data, GLenum error); | 156 GLenum usage, const GLvoid* data, GLenum error); |
145 | 157 |
146 static void SetTexParameteriWithExpectations( | 158 static void SetTexParameteriWithExpectations( |
147 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 159 ::gfx::MockGLInterface* gl, MockErrorState* error_state, |
148 TextureManager* manager, TextureRef* texture_ref, | 160 TextureManager* manager, TextureRef* texture_ref, |
149 GLenum pname, GLint value, GLenum error); | 161 GLenum pname, GLint value, GLenum error); |
150 | 162 |
151 static void SetShaderStates( | 163 static void SetShaderStates( |
152 ::gfx::MockGLInterface* gl, Shader* shader, | 164 ::gfx::MockGLInterface* gl, |
| 165 Shader* shader, |
153 bool expected_valid, | 166 bool expected_valid, |
154 const std::string* const expected_log_info, | 167 const std::string* const expected_log_info, |
155 const std::string* const expected_translated_source, | 168 const std::string* const expected_translated_source, |
156 const int* const expected_shader_version, | 169 const int* const expected_shader_version, |
157 const AttributeMap* const expected_attrib_map, | 170 const AttributeMap* const expected_attrib_map, |
158 const UniformMap* const expected_uniform_map, | 171 const UniformMap* const expected_uniform_map, |
159 const VaryingMap* const expected_varying_map, | 172 const VaryingMap* const expected_varying_map, |
160 const InterfaceBlockMap* const expected_interface_block_map, | 173 const InterfaceBlockMap* const expected_interface_block_map, |
| 174 const OutputVariableList* const expected_output_variable_list, |
161 const NameMap* const expected_name_map); | 175 const NameMap* const expected_name_map); |
162 | 176 |
163 static void SetShaderStates( | 177 static void SetShaderStates( |
164 ::gfx::MockGLInterface* gl, Shader* shader, bool valid); | 178 ::gfx::MockGLInterface* gl, Shader* shader, bool valid); |
165 | 179 |
166 static sh::Attribute ConstructAttribute( | 180 static sh::Attribute ConstructAttribute( |
167 GLenum type, GLint array_size, GLenum precision, | 181 GLenum type, GLint array_size, GLenum precision, |
168 bool static_use, const std::string& name); | 182 bool static_use, const std::string& name); |
169 static sh::Uniform ConstructUniform( | 183 static sh::Uniform ConstructUniform( |
170 GLenum type, GLint array_size, GLenum precision, | 184 GLenum type, GLint array_size, GLenum precision, |
171 bool static_use, const std::string& name); | 185 bool static_use, const std::string& name); |
172 static sh::Varying ConstructVarying( | 186 static sh::Varying ConstructVarying( |
173 GLenum type, GLint array_size, GLenum precision, | 187 GLenum type, GLint array_size, GLenum precision, |
174 bool static_use, const std::string& name); | 188 bool static_use, const std::string& name); |
| 189 static sh::OutputVariable ConstructOutputVariable(GLenum type, |
| 190 GLint array_size, |
| 191 GLenum precision, |
| 192 bool static_use, |
| 193 const std::string& name); |
175 | 194 |
176 private: | 195 private: |
177 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, | 196 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, |
178 GLenum target, | 197 GLenum target, |
179 bool use_default_textures); | 198 bool use_default_textures); |
180 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl, | 199 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl, |
181 GLenum target, | 200 GLenum target, |
182 bool use_default_textures); | 201 bool use_default_textures); |
183 | 202 |
184 static std::vector<std::string> split_extensions_; | 203 static std::vector<std::string> split_extensions_; |
185 }; | 204 }; |
186 | 205 |
187 // This object temporaritly Sets what gfx::GetGLImplementation returns. During | 206 // This object temporaritly Sets what gfx::GetGLImplementation returns. During |
188 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of | 207 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of |
189 // code branches based on what gfx::GetGLImplementation returns. | 208 // code branches based on what gfx::GetGLImplementation returns. |
190 class ScopedGLImplementationSetter { | 209 class ScopedGLImplementationSetter { |
191 public: | 210 public: |
192 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation); | 211 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation); |
193 ~ScopedGLImplementationSetter(); | 212 ~ScopedGLImplementationSetter(); |
194 | 213 |
195 private: | 214 private: |
196 gfx::GLImplementation old_implementation_; | 215 gfx::GLImplementation old_implementation_; |
197 }; | 216 }; |
198 | 217 |
199 } // namespace gles2 | 218 } // namespace gles2 |
200 } // namespace gpu | 219 } // namespace gpu |
201 | 220 |
202 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 221 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
203 | 222 |
OLD | NEW |