| 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(const char* extensions, bool has_alpha_backbuffer); | 165 void InitDecoder( |
| 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); |
| 166 | 173 |
| 167 const ContextGroup& group() const { | 174 const ContextGroup& group() const { |
| 168 return *group_.get(); | 175 return *group_.get(); |
| 169 } | 176 } |
| 170 | 177 |
| 171 struct AttribInfo { | 178 struct AttribInfo { |
| 172 const char* name; | 179 const char* name; |
| 173 GLint size; | 180 GLint size; |
| 174 GLenum type; | 181 GLenum type; |
| 175 GLint location; | 182 GLint location; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 uint32 shared_memory_id, uint32 shared_memory_offset); | 232 uint32 shared_memory_id, uint32 shared_memory_offset); |
| 226 void DoVertexAttribPointer( | 233 void DoVertexAttribPointer( |
| 227 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); | 234 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset); |
| 228 | 235 |
| 229 void SetupExpectationsForFramebufferAttachment( | 236 void SetupExpectationsForFramebufferAttachment( |
| 230 GLuint clear_bits, | 237 GLuint clear_bits, |
| 231 GLclampf restore_red, | 238 GLclampf restore_red, |
| 232 GLclampf restore_green, | 239 GLclampf restore_green, |
| 233 GLclampf restore_blue, | 240 GLclampf restore_blue, |
| 234 GLclampf restore_alpha, | 241 GLclampf restore_alpha, |
| 235 GLuint restore_color_mask, | |
| 236 GLuint restore_stencil, | 242 GLuint restore_stencil, |
| 237 GLuint restore_stencil_front_mask, | |
| 238 GLuint restore_stencil_back_mask, | |
| 239 GLclampf restore_depth, | 243 GLclampf restore_depth, |
| 240 GLboolean restore_depth_mask, | |
| 241 bool restore_scissor_test); | 244 bool restore_scissor_test); |
| 242 | 245 |
| 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 |
| 243 GLvoid* BufferOffset(unsigned i) { | 257 GLvoid* BufferOffset(unsigned i) { |
| 244 return static_cast<int8 *>(NULL)+(i); | 258 return static_cast<int8 *>(NULL)+(i); |
| 245 } | 259 } |
| 246 | 260 |
| 247 template <typename Command, typename Result> | 261 template <typename Command, typename Result> |
| 248 bool IsObjectHelper(GLuint client_id) { | 262 bool IsObjectHelper(GLuint client_id) { |
| 249 Result* result = static_cast<Result*>(shared_memory_address_); | 263 Result* result = static_cast<Result*>(shared_memory_address_); |
| 250 Command cmd; | 264 Command cmd; |
| 251 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); | 265 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset); |
| 252 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 266 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 static const GLenum kUniform1Type = GL_SAMPLER_2D; | 389 static const GLenum kUniform1Type = GL_SAMPLER_2D; |
| 376 static const GLenum kUniform2Type = GL_INT_VEC2; | 390 static const GLenum kUniform2Type = GL_INT_VEC2; |
| 377 static const GLenum kUniform3Type = GL_FLOAT_VEC3; | 391 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
| 378 static const GLint kInvalidUniformLocation = 30; | 392 static const GLint kInvalidUniformLocation = 30; |
| 379 static const GLint kBadUniformIndex = 1000; | 393 static const GLint kBadUniformIndex = 1000; |
| 380 | 394 |
| 381 protected: | 395 protected: |
| 382 virtual void SetUp(); | 396 virtual void SetUp(); |
| 383 virtual void TearDown(); | 397 virtual void TearDown(); |
| 384 | 398 |
| 399 void SetupDefaultProgram(); |
| 385 void SetupTexture(); | 400 void SetupTexture(); |
| 386 | 401 |
| 387 void DoEnableVertexAttribArray(GLint index); | 402 void DoEnableVertexAttribArray(GLint index); |
| 388 | 403 |
| 389 void DoBufferData(GLenum target, GLsizei size); | 404 void DoBufferData(GLenum target, GLsizei size); |
| 390 | 405 |
| 391 void DoBufferSubData( | 406 void DoBufferSubData( |
| 392 GLenum target, GLint offset, GLsizei size, const void* data); | 407 GLenum target, GLint offset, GLsizei size, const void* data); |
| 393 | 408 |
| 394 void SetupVertexBuffer(); | 409 void SetupVertexBuffer(); |
| 395 | 410 |
| 396 void SetupIndexBuffer(); | 411 void SetupIndexBuffer(); |
| 397 | 412 |
| 398 void DeleteVertexBuffer(); | 413 void DeleteVertexBuffer(); |
| 399 | 414 |
| 400 void DeleteIndexBuffer(); | 415 void DeleteIndexBuffer(); |
| 401 | 416 |
| 402 GLuint client_vertex_shader_id_; | 417 GLuint client_vertex_shader_id_; |
| 403 GLuint client_fragment_shader_id_; | 418 GLuint client_fragment_shader_id_; |
| 404 }; | 419 }; |
| 405 | 420 |
| 406 } // namespace gles2 | 421 } // namespace gles2 |
| 407 } // namespace gpu | 422 } // namespace gpu |
| 408 | 423 |
| 409 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 424 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
| OLD | NEW |