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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 }; | 95 }; |
96 struct ProgramOutputInfo { | 96 struct ProgramOutputInfo { |
97 const char* name; | 97 const char* name; |
98 GLint size; | 98 GLint size; |
99 GLenum type; | 99 GLenum type; |
100 GLint color_name; | 100 GLint color_name; |
101 GLuint index; | 101 GLuint index; |
102 }; | 102 }; |
103 | 103 |
104 static void SetupContextGroupInitExpectations( | 104 static void SetupContextGroupInitExpectations( |
105 ::gfx::MockGLInterface* gl, | 105 ::gl::MockGLInterface* gl, |
106 const DisallowedFeatures& disallowed_features, | 106 const DisallowedFeatures& disallowed_features, |
107 const char* extensions, | 107 const char* extensions, |
108 const char* gl_version, | 108 const char* gl_version, |
109 bool bind_generates_resource); | 109 bool bind_generates_resource); |
110 static void SetupFeatureInfoInitExpectations( | 110 static void SetupFeatureInfoInitExpectations(::gl::MockGLInterface* gl, |
111 ::gfx::MockGLInterface* gl, const char* extensions); | 111 const char* extensions); |
112 static void SetupFeatureInfoInitExpectationsWithGLVersion( | 112 static void SetupFeatureInfoInitExpectationsWithGLVersion( |
113 ::gfx::MockGLInterface* gl, | 113 ::gl::MockGLInterface* gl, |
114 const char* extensions, | 114 const char* extensions, |
115 const char* gl_renderer, | 115 const char* gl_renderer, |
116 const char* gl_version, | 116 const char* gl_version, |
117 bool enable_es3 = false); | 117 bool enable_es3 = false); |
118 static void SetupTextureManagerInitExpectations( | 118 static void SetupTextureManagerInitExpectations(::gl::MockGLInterface* gl, |
119 ::gfx::MockGLInterface* gl, | 119 bool is_es3_enabled, |
120 bool is_es3_enabled, | 120 bool is_desktop_core_profile, |
121 bool is_desktop_core_profile, | 121 const char* extensions, |
122 const char* extensions, | 122 bool use_default_textures); |
123 bool use_default_textures); | |
124 static void SetupTextureManagerDestructionExpectations( | 123 static void SetupTextureManagerDestructionExpectations( |
125 ::gfx::MockGLInterface* gl, | 124 ::gl::MockGLInterface* gl, |
126 bool is_es3_enabled, | 125 bool is_es3_enabled, |
127 bool is_desktop_core_profile, | 126 bool is_desktop_core_profile, |
128 const char* extensions, | 127 const char* extensions, |
129 bool use_default_textures); | 128 bool use_default_textures); |
130 | 129 |
131 static void SetupExpectationsForClearingUniforms( | 130 static void SetupExpectationsForClearingUniforms(::gl::MockGLInterface* gl, |
132 ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms); | 131 UniformInfo* uniforms, |
| 132 size_t num_uniforms); |
133 | 133 |
134 static void SetupShaderExpectations(::gfx::MockGLInterface* gl, | 134 static void SetupShaderExpectations(::gl::MockGLInterface* gl, |
135 const FeatureInfo* feature_info, | 135 const FeatureInfo* feature_info, |
136 AttribInfo* attribs, | 136 AttribInfo* attribs, |
137 size_t num_attribs, | 137 size_t num_attribs, |
138 UniformInfo* uniforms, | 138 UniformInfo* uniforms, |
139 size_t num_uniforms, | 139 size_t num_uniforms, |
140 GLuint service_id); | 140 GLuint service_id); |
141 | 141 |
142 static void SetupShaderExpectationsWithVaryings( | 142 static void SetupShaderExpectationsWithVaryings( |
143 ::gfx::MockGLInterface* gl, | 143 ::gl::MockGLInterface* gl, |
144 const FeatureInfo* feature_info, | 144 const FeatureInfo* feature_info, |
145 AttribInfo* attribs, | 145 AttribInfo* attribs, |
146 size_t num_attribs, | 146 size_t num_attribs, |
147 UniformInfo* uniforms, | 147 UniformInfo* uniforms, |
148 size_t num_uniforms, | 148 size_t num_uniforms, |
149 VaryingInfo* varyings, | 149 VaryingInfo* varyings, |
150 size_t num_varyings, | 150 size_t num_varyings, |
151 ProgramOutputInfo* program_outputs, | 151 ProgramOutputInfo* program_outputs, |
152 size_t num_program_outputs, | 152 size_t num_program_outputs, |
153 GLuint service_id); | 153 GLuint service_id); |
154 | 154 |
155 static void SetupProgramSuccessExpectations( | 155 static void SetupProgramSuccessExpectations( |
156 ::gfx::MockGLInterface* gl, | 156 ::gl::MockGLInterface* gl, |
157 const FeatureInfo* feature_info, | 157 const FeatureInfo* feature_info, |
158 AttribInfo* attribs, | 158 AttribInfo* attribs, |
159 size_t num_attribs, | 159 size_t num_attribs, |
160 UniformInfo* uniforms, | 160 UniformInfo* uniforms, |
161 size_t num_uniforms, | 161 size_t num_uniforms, |
162 VaryingInfo* varyings, | 162 VaryingInfo* varyings, |
163 size_t num_varyings, | 163 size_t num_varyings, |
164 ProgramOutputInfo* program_outputs, | 164 ProgramOutputInfo* program_outputs, |
165 size_t num_program_outputs, | 165 size_t num_program_outputs, |
166 GLuint service_id); | 166 GLuint service_id); |
167 | 167 |
168 static void DoBufferData( | 168 static void DoBufferData(::gl::MockGLInterface* gl, |
169 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 169 MockErrorState* error_state, |
170 BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size, | 170 BufferManager* manager, |
171 GLenum usage, const GLvoid* data, GLenum error); | 171 Buffer* buffer, |
| 172 GLenum target, |
| 173 GLsizeiptr size, |
| 174 GLenum usage, |
| 175 const GLvoid* data, |
| 176 GLenum error); |
172 | 177 |
173 static void SetTexParameteriWithExpectations( | 178 static void SetTexParameteriWithExpectations(::gl::MockGLInterface* gl, |
174 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 179 MockErrorState* error_state, |
175 TextureManager* manager, TextureRef* texture_ref, | 180 TextureManager* manager, |
176 GLenum pname, GLint value, GLenum error); | 181 TextureRef* texture_ref, |
| 182 GLenum pname, |
| 183 GLint value, |
| 184 GLenum error); |
177 | 185 |
178 static void SetShaderStates( | 186 static void SetShaderStates( |
179 ::gfx::MockGLInterface* gl, | 187 ::gl::MockGLInterface* gl, |
180 Shader* shader, | 188 Shader* shader, |
181 bool expected_valid, | 189 bool expected_valid, |
182 const std::string* const expected_log_info, | 190 const std::string* const expected_log_info, |
183 const std::string* const expected_translated_source, | 191 const std::string* const expected_translated_source, |
184 const int* const expected_shader_version, | 192 const int* const expected_shader_version, |
185 const AttributeMap* const expected_attrib_map, | 193 const AttributeMap* const expected_attrib_map, |
186 const UniformMap* const expected_uniform_map, | 194 const UniformMap* const expected_uniform_map, |
187 const VaryingMap* const expected_varying_map, | 195 const VaryingMap* const expected_varying_map, |
188 const InterfaceBlockMap* const expected_interface_block_map, | 196 const InterfaceBlockMap* const expected_interface_block_map, |
189 const OutputVariableList* const expected_output_variable_list, | 197 const OutputVariableList* const expected_output_variable_list, |
190 const NameMap* const expected_name_map); | 198 const NameMap* const expected_name_map); |
191 | 199 |
192 static void SetShaderStates( | 200 static void SetShaderStates(::gl::MockGLInterface* gl, |
193 ::gfx::MockGLInterface* gl, Shader* shader, bool valid); | 201 Shader* shader, |
| 202 bool valid); |
194 | 203 |
195 static sh::Attribute ConstructAttribute( | 204 static sh::Attribute ConstructAttribute( |
196 GLenum type, GLint array_size, GLenum precision, | 205 GLenum type, GLint array_size, GLenum precision, |
197 bool static_use, const std::string& name); | 206 bool static_use, const std::string& name); |
198 static sh::Uniform ConstructUniform( | 207 static sh::Uniform ConstructUniform( |
199 GLenum type, GLint array_size, GLenum precision, | 208 GLenum type, GLint array_size, GLenum precision, |
200 bool static_use, const std::string& name); | 209 bool static_use, const std::string& name); |
201 static sh::Varying ConstructVarying( | 210 static sh::Varying ConstructVarying( |
202 GLenum type, GLint array_size, GLenum precision, | 211 GLenum type, GLint array_size, GLenum precision, |
203 bool static_use, const std::string& name); | 212 bool static_use, const std::string& name); |
204 static sh::OutputVariable ConstructOutputVariable(GLenum type, | 213 static sh::OutputVariable ConstructOutputVariable(GLenum type, |
205 GLint array_size, | 214 GLint array_size, |
206 GLenum precision, | 215 GLenum precision, |
207 bool static_use, | 216 bool static_use, |
208 const std::string& name); | 217 const std::string& name); |
209 | 218 |
210 private: | 219 private: |
211 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, | 220 static void SetupTextureInitializationExpectations(::gl::MockGLInterface* gl, |
212 GLenum target, | 221 GLenum target, |
213 bool use_default_textures); | 222 bool use_default_textures); |
214 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl, | 223 static void SetupTextureDestructionExpectations(::gl::MockGLInterface* gl, |
215 GLenum target, | 224 GLenum target, |
216 bool use_default_textures); | 225 bool use_default_textures); |
217 | 226 |
218 static std::vector<std::string> split_extensions_; | 227 static std::vector<std::string> split_extensions_; |
219 }; | 228 }; |
220 | 229 |
221 // This object temporaritly Sets what gfx::GetGLImplementation returns. During | 230 // This object temporaritly Sets what gl::GetGLImplementation returns. During |
222 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of | 231 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of |
223 // code branches based on what gfx::GetGLImplementation returns. | 232 // code branches based on what gl::GetGLImplementation returns. |
224 class ScopedGLImplementationSetter { | 233 class ScopedGLImplementationSetter { |
225 public: | 234 public: |
226 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation); | 235 explicit ScopedGLImplementationSetter(gl::GLImplementation implementation); |
227 ~ScopedGLImplementationSetter(); | 236 ~ScopedGLImplementationSetter(); |
228 | 237 |
229 private: | 238 private: |
230 gfx::GLImplementation old_implementation_; | 239 gl::GLImplementation old_implementation_; |
231 }; | 240 }; |
232 | 241 |
233 } // namespace gles2 | 242 } // namespace gles2 |
234 } // namespace gpu | 243 } // namespace gpu |
235 | 244 |
236 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 245 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
237 | 246 |
OLD | NEW |