| 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 #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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 .RetiresOnSaturation(); | 177 .RetiresOnSaturation(); |
| 178 | 178 |
| 179 EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE)) | 179 EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE)) |
| 180 .Times(1) | 180 .Times(1) |
| 181 .RetiresOnSaturation(); | 181 .RetiresOnSaturation(); |
| 182 | 182 |
| 183 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) | 183 EXPECT_CALL(*gl_, Enable(GL_POINT_SPRITE)) |
| 184 .Times(1) | 184 .Times(1) |
| 185 .RetiresOnSaturation(); | 185 .RetiresOnSaturation(); |
| 186 | 186 |
| 187 EXPECT_CALL(*gl_, Viewport( | |
| 188 kViewportX, kViewportY, kViewportWidth, kViewportHeight)) | |
| 189 .Times(1) | |
| 190 .RetiresOnSaturation(); | |
| 191 | |
| 192 static GLint max_viewport_dims[] = { | 187 static GLint max_viewport_dims[] = { |
| 193 kMaxViewportWidth, | 188 kMaxViewportWidth, |
| 194 kMaxViewportHeight | 189 kMaxViewportHeight |
| 195 }; | 190 }; |
| 196 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VIEWPORT_DIMS, _)) | 191 EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_VIEWPORT_DIMS, _)) |
| 197 .WillOnce(SetArrayArgument<1>( | 192 .WillOnce(SetArrayArgument<1>( |
| 198 max_viewport_dims, max_viewport_dims + arraysize(max_viewport_dims))) | 193 max_viewport_dims, max_viewport_dims + arraysize(max_viewport_dims))) |
| 199 .RetiresOnSaturation(); | 194 .RetiresOnSaturation(); |
| 200 | 195 |
| 196 SetupInitCapabilitiesExpectations(); |
| 197 SetupInitStateExpectations(); |
| 198 |
| 201 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 199 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
| 202 .Times(1) | 200 .Times(1) |
| 203 .RetiresOnSaturation(); | 201 .RetiresOnSaturation(); |
| 204 EXPECT_CALL(*gl_, Disable(GL_BLEND)) | |
| 205 .Times(1) | |
| 206 .RetiresOnSaturation(); | |
| 207 EXPECT_CALL(*gl_, BlendColor(0.0f, 0.0, 0.0f, 0.0f)) | |
| 208 .Times(1) | |
| 209 .RetiresOnSaturation(); | |
| 210 EXPECT_CALL(*gl_, BlendFunc(GL_ONE, GL_ZERO)) | |
| 211 .Times(1) | |
| 212 .RetiresOnSaturation(); | |
| 213 EXPECT_CALL(*gl_, BlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ZERO)) | |
| 214 .Times(1) | |
| 215 .RetiresOnSaturation(); | |
| 216 EXPECT_CALL(*gl_, BlendEquation(GL_FUNC_ADD)) | |
| 217 .Times(1) | |
| 218 .RetiresOnSaturation(); | |
| 219 EXPECT_CALL(*gl_, BlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD)) | |
| 220 .Times(1) | |
| 221 .RetiresOnSaturation(); | |
| 222 EXPECT_CALL(*gl_, ClearColor(0.0f, 0.0, 0.0f, 0.0f)) | |
| 223 .Times(1) | |
| 224 .RetiresOnSaturation(); | |
| 225 EXPECT_CALL(*gl_, ColorMask(true, true, true, true)) | |
| 226 .Times(1) | |
| 227 .RetiresOnSaturation(); | |
| 228 EXPECT_CALL(*gl_, Disable(GL_CULL_FACE)) | |
| 229 .Times(1) | |
| 230 .RetiresOnSaturation(); | |
| 231 EXPECT_CALL(*gl_, CullFace(GL_BACK)) | |
| 232 .Times(1) | |
| 233 .RetiresOnSaturation(); | |
| 234 EXPECT_CALL(*gl_, ClearDepth(1.0f)) | |
| 235 .Times(1) | |
| 236 .RetiresOnSaturation(); | |
| 237 EXPECT_CALL(*gl_, DepthFunc(GL_LESS)) | |
| 238 .Times(1) | |
| 239 .RetiresOnSaturation(); | |
| 240 EXPECT_CALL(*gl_, DepthRange(0.0f, 1.0f)) | |
| 241 .Times(1) | |
| 242 .RetiresOnSaturation(); | |
| 243 EXPECT_CALL(*gl_, Disable(GL_DEPTH_TEST)) | |
| 244 .Times(1) | |
| 245 .RetiresOnSaturation(); | |
| 246 EXPECT_CALL(*gl_, Enable(GL_DITHER)) | |
| 247 .Times(1) | |
| 248 .RetiresOnSaturation(); | |
| 249 EXPECT_CALL(*gl_, FrontFace(GL_CCW)) | |
| 250 .Times(1) | |
| 251 .RetiresOnSaturation(); | |
| 252 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE)) | 202 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE)) |
| 253 .Times(1) | 203 .Times(1) |
| 254 .RetiresOnSaturation(); | 204 .RetiresOnSaturation(); |
| 255 EXPECT_CALL(*gl_, LineWidth(1.0f)) | |
| 256 .Times(1) | |
| 257 .RetiresOnSaturation(); | |
| 258 EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4)) | 205 EXPECT_CALL(*gl_, PixelStorei(GL_PACK_ALIGNMENT, 4)) |
| 259 .Times(1) | 206 .Times(1) |
| 260 .RetiresOnSaturation(); | 207 .RetiresOnSaturation(); |
| 261 EXPECT_CALL(*gl_, PolygonOffset(0.0f, 0.0f)) | |
| 262 .Times(1) | |
| 263 .RetiresOnSaturation(); | |
| 264 EXPECT_CALL(*gl_, Disable(GL_POLYGON_OFFSET_FILL)) | |
| 265 .Times(1) | |
| 266 .RetiresOnSaturation(); | |
| 267 EXPECT_CALL(*gl_, Disable(GL_SAMPLE_ALPHA_TO_COVERAGE)) | |
| 268 .Times(1) | |
| 269 .RetiresOnSaturation(); | |
| 270 EXPECT_CALL(*gl_, Disable(GL_SAMPLE_COVERAGE)) | |
| 271 .Times(1) | |
| 272 .RetiresOnSaturation(); | |
| 273 EXPECT_CALL(*gl_, SampleCoverage(1.0, false)) | |
| 274 .Times(1) | |
| 275 .RetiresOnSaturation(); | |
| 276 EXPECT_CALL(*gl_, Scissor( | |
| 277 kViewportX, kViewportY, kViewportWidth, kViewportHeight)) | |
| 278 .Times(1) | |
| 279 .RetiresOnSaturation(); | |
| 280 EXPECT_CALL(*gl_, Disable(GL_SCISSOR_TEST)) | |
| 281 .Times(1) | |
| 282 .RetiresOnSaturation(); | |
| 283 EXPECT_CALL(*gl_, Disable(GL_STENCIL_TEST)) | |
| 284 .Times(1) | |
| 285 .RetiresOnSaturation(); | |
| 286 EXPECT_CALL(*gl_, ClearStencil(0)) | |
| 287 .Times(1) | |
| 288 .RetiresOnSaturation(); | |
| 289 EXPECT_CALL(*gl_, StencilFuncSeparate(GL_FRONT, GL_ALWAYS, 0, 0xFFFFFFFFU)) | |
| 290 .Times(1) | |
| 291 .RetiresOnSaturation(); | |
| 292 EXPECT_CALL(*gl_, StencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFFU)) | |
| 293 .Times(1) | |
| 294 .RetiresOnSaturation(); | |
| 295 EXPECT_CALL(*gl_, StencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP)) | |
| 296 .Times(1) | |
| 297 .RetiresOnSaturation(); | |
| 298 EXPECT_CALL(*gl_, StencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP)) | |
| 299 .Times(1) | |
| 300 .RetiresOnSaturation(); | |
| 301 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_FRONT, 0xFFFFFFFFU)) | |
| 302 .Times(1) | |
| 303 .RetiresOnSaturation(); | |
| 304 EXPECT_CALL(*gl_, StencilMaskSeparate(GL_BACK, 0xFFFFFFFFU)) | |
| 305 .Times(1) | |
| 306 .RetiresOnSaturation(); | |
| 307 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4)) | 208 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_ALIGNMENT, 4)) |
| 308 .Times(1) | 209 .Times(1) |
| 309 .RetiresOnSaturation(); | 210 .RetiresOnSaturation(); |
| 310 | 211 |
| 311 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) | 212 EXPECT_CALL(*gl_, BindBuffer(GL_ARRAY_BUFFER, 0)) |
| 312 .Times(1) | 213 .Times(1) |
| 313 .RetiresOnSaturation(); | 214 .RetiresOnSaturation(); |
| 314 EXPECT_CALL(*gl_, BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)) | 215 EXPECT_CALL(*gl_, BindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)) |
| 315 .Times(1) | 216 .Times(1) |
| 316 .RetiresOnSaturation(); | 217 .RetiresOnSaturation(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 .RetiresOnSaturation(); | 293 .RetiresOnSaturation(); |
| 393 | 294 |
| 394 decoder_->Destroy(true); | 295 decoder_->Destroy(true); |
| 395 decoder_.reset(); | 296 decoder_.reset(); |
| 396 group_->Destroy(false); | 297 group_->Destroy(false); |
| 397 engine_.reset(); | 298 engine_.reset(); |
| 398 ::gfx::GLInterface::SetGLInterface(NULL); | 299 ::gfx::GLInterface::SetGLInterface(NULL); |
| 399 gl_.reset(); | 300 gl_.reset(); |
| 400 } | 301 } |
| 401 | 302 |
| 303 void GLES2DecoderTestBase::ExpectEnableDisable(GLenum cap, bool enable) { |
| 304 if (enable) { |
| 305 EXPECT_CALL(*gl_, Enable(cap)) |
| 306 .Times(1) |
| 307 .RetiresOnSaturation(); |
| 308 } else { |
| 309 EXPECT_CALL(*gl_, Disable(cap)) |
| 310 .Times(1) |
| 311 .RetiresOnSaturation(); |
| 312 } |
| 313 } |
| 314 |
| 315 |
| 402 GLint GLES2DecoderTestBase::GetGLError() { | 316 GLint GLES2DecoderTestBase::GetGLError() { |
| 403 EXPECT_CALL(*gl_, GetError()) | 317 EXPECT_CALL(*gl_, GetError()) |
| 404 .WillOnce(Return(GL_NO_ERROR)) | 318 .WillOnce(Return(GL_NO_ERROR)) |
| 405 .RetiresOnSaturation(); | 319 .RetiresOnSaturation(); |
| 406 GetError cmd; | 320 GetError cmd; |
| 407 cmd.Init(shared_memory_id_, shared_memory_offset_); | 321 cmd.Init(shared_memory_id_, shared_memory_offset_); |
| 408 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 322 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 409 return static_cast<GLint>(*GetSharedMemoryAs<GLenum*>()); | 323 return static_cast<GLint>(*GetSharedMemoryAs<GLenum*>()); |
| 410 } | 324 } |
| 411 | 325 |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 int32 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetGetOffset() { | 1366 int32 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetGetOffset() { |
| 1453 DCHECK(false); | 1367 DCHECK(false); |
| 1454 return 0; | 1368 return 0; |
| 1455 } | 1369 } |
| 1456 | 1370 |
| 1457 void GLES2DecoderWithShaderTestBase::SetUp() { | 1371 void GLES2DecoderWithShaderTestBase::SetUp() { |
| 1458 GLES2DecoderTestBase::SetUp(); | 1372 GLES2DecoderTestBase::SetUp(); |
| 1459 SetupDefaultProgram(); | 1373 SetupDefaultProgram(); |
| 1460 } | 1374 } |
| 1461 | 1375 |
| 1376 // Include the auto-generated part of this file. We split this because it means |
| 1377 // we can easily edit the non-auto generated parts right here in this file |
| 1378 // instead of having to edit some template or the code generator. |
| 1379 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1380 |
| 1462 } // namespace gles2 | 1381 } // namespace gles2 |
| 1463 } // namespace gpu | 1382 } // namespace gpu |
| OLD | NEW |