| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| 7 | 7 |
| 8 #include "gpu/command_buffer/common/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 ProgramManager::ProgramInfo* GetProgramInfo(GLuint service_id) { | 156 ProgramManager::ProgramInfo* GetProgramInfo(GLuint service_id) { |
| 157 return group_->program_manager()->GetProgramInfo(service_id); | 157 return group_->program_manager()->GetProgramInfo(service_id); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void DoCreateProgram(GLuint client_id, GLuint service_id); | 160 void DoCreateProgram(GLuint client_id, GLuint service_id); |
| 161 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); | 161 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); |
| 162 | 162 |
| 163 void SetBucketAsCString(uint32 bucket_id, const char* str); | 163 void SetBucketAsCString(uint32 bucket_id, const char* str); |
| 164 | 164 |
| 165 void InitDecoder( | 165 void InitDecoder(const char* extensions, bool has_alpha_backbuffer); |
| 166 const char* extensions, | |
| 167 bool has_alpha, | |
| 168 bool has_depth, | |
| 169 bool has_stencil, | |
| 170 bool request_alpha, | |
| 171 bool request_depth, | |
| 172 bool request_stencil); | |
| 173 | 166 |
| 174 const ContextGroup& group() const { | 167 const ContextGroup& group() const { |
| 175 return *group_.get(); | 168 return *group_.get(); |
| 176 } | 169 } |
| 177 | 170 |
| 178 struct AttribInfo { | 171 struct AttribInfo { |
| 179 const char* name; | 172 const char* name; |
| 180 GLint size; | 173 GLint size; |
| 181 GLenum type; | 174 GLenum type; |
| 182 GLint location; | 175 GLint location; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 uint32 shared_memory_id, uint32 shared_memory_offset); | 225 uint32 shared_memory_id, uint32 shared_memory_offset); |
| 233 void DoVertexAttribPointer( | 226 void DoVertexAttribPointer( |
| 234 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); | 227 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); |
| 235 | 228 |
| 236 void SetupExpectationsForFramebufferAttachment( | 229 void SetupExpectationsForFramebufferAttachment( |
| 237 GLuint clear_bits, | 230 GLuint clear_bits, |
| 238 GLclampf restore_red, | 231 GLclampf restore_red, |
| 239 GLclampf restore_green, | 232 GLclampf restore_green, |
| 240 GLclampf restore_blue, | 233 GLclampf restore_blue, |
| 241 GLclampf restore_alpha, | 234 GLclampf restore_alpha, |
| 235 GLuint restore_color_mask, |
| 242 GLuint restore_stencil, | 236 GLuint restore_stencil, |
| 237 GLuint restore_stencil_front_mask, |
| 238 GLuint restore_stencil_back_mask, |
| 243 GLclampf restore_depth, | 239 GLclampf restore_depth, |
| 240 GLboolean restore_depth_mask, |
| 244 bool restore_scissor_test); | 241 bool restore_scissor_test); |
| 245 | 242 |
| 246 void SetupExpectationsForApplyingDirtyState( | |
| 247 bool framebuffer_is_rgb, | |
| 248 bool framebuffer_has_depth, | |
| 249 bool framebuffer_has_stencil, | |
| 250 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001 | |
| 251 bool depth_mask, | |
| 252 GLuint front_stencil_mask, | |
| 253 GLuint back_stencil_mask); | |
| 254 | |
| 255 void SetupExpectationsForApplyingDefaultDirtyState(); | |
| 256 | |
| 257 GLvoid* BufferOffset(unsigned i) { | 243 GLvoid* BufferOffset(unsigned i) { |
| 258 return static_cast<int8 *>(NULL)+(i); | 244 return static_cast<int8 *>(NULL)+(i); |
| 259 } | 245 } |
| 260 | 246 |
| 261 template <typename Command, typename Result> | 247 template <typename Command, typename Result> |
| 262 bool IsObjectHelper(GLuint client_id) { | 248 bool IsObjectHelper(GLuint client_id) { |
| 263 Result* result = static_cast<Result*>(shared_memory_address_); | 249 Result* result = static_cast<Result*>(shared_memory_address_); |
| 264 Command cmd; | 250 Command cmd; |
| 265 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); | 251 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); |
| 266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 252 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 static const GLenum kUniform1Type = GL_SAMPLER_2D; | 375 static const GLenum kUniform1Type = GL_SAMPLER_2D; |
| 390 static const GLenum kUniform2Type = GL_INT_VEC2; | 376 static const GLenum kUniform2Type = GL_INT_VEC2; |
| 391 static const GLenum kUniform3Type = GL_FLOAT_VEC3; | 377 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
| 392 static const GLint kInvalidUniformLocation = 30; | 378 static const GLint kInvalidUniformLocation = 30; |
| 393 static const GLint kBadUniformIndex = 1000; | 379 static const GLint kBadUniformIndex = 1000; |
| 394 | 380 |
| 395 protected: | 381 protected: |
| 396 virtual void SetUp(); | 382 virtual void SetUp(); |
| 397 virtual void TearDown(); | 383 virtual void TearDown(); |
| 398 | 384 |
| 399 void SetupDefaultProgram(); | |
| 400 void SetupTexture(); | 385 void SetupTexture(); |
| 401 | 386 |
| 402 void DoEnableVertexAttribArray(GLint index); | 387 void DoEnableVertexAttribArray(GLint index); |
| 403 | 388 |
| 404 void DoBufferData(GLenum target, GLsizei size); | 389 void DoBufferData(GLenum target, GLsizei size); |
| 405 | 390 |
| 406 void DoBufferSubData( | 391 void DoBufferSubData( |
| 407 GLenum target, GLint offset, GLsizei size, const void* data); | 392 GLenum target, GLint offset, GLsizei size, const void* data); |
| 408 | 393 |
| 409 void SetupVertexBuffer(); | 394 void SetupVertexBuffer(); |
| 410 | 395 |
| 411 void SetupIndexBuffer(); | 396 void SetupIndexBuffer(); |
| 412 | 397 |
| 413 void DeleteVertexBuffer(); | 398 void DeleteVertexBuffer(); |
| 414 | 399 |
| 415 void DeleteIndexBuffer(); | 400 void DeleteIndexBuffer(); |
| 416 | 401 |
| 417 GLuint client_vertex_shader_id_; | 402 GLuint client_vertex_shader_id_; |
| 418 GLuint client_fragment_shader_id_; | 403 GLuint client_fragment_shader_id_; |
| 419 }; | 404 }; |
| 420 | 405 |
| 421 } // namespace gles2 | 406 } // namespace gles2 |
| 422 } // namespace gpu | 407 } // namespace gpu |
| 423 | 408 |
| 424 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 409 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| OLD | NEW |