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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/common/gl_mock.h" | 10 #include "gpu/command_buffer/common/gl_mock.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 GLES2DecoderRGBBackbufferTest() { } | 89 GLES2DecoderRGBBackbufferTest() { } |
90 | 90 |
91 virtual void SetUp() { | 91 virtual void SetUp() { |
92 InitDecoder( | 92 InitDecoder( |
93 "", // extensions | 93 "", // extensions |
94 false, // has alpha | 94 false, // has alpha |
95 false, // has depth | 95 false, // has depth |
96 false, // has stencil | 96 false, // has stencil |
97 false, // request alpha | 97 false, // request alpha |
98 false, // request depth | 98 false, // request depth |
99 false); // request stencil | 99 false, // request stencil |
| 100 true); // bind generates resource |
100 SetupDefaultProgram(); | 101 SetupDefaultProgram(); |
101 } | 102 } |
102 }; | 103 }; |
103 | 104 |
104 class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest { | 105 class GLES2DecoderManualInitTest : public GLES2DecoderWithShaderTest { |
105 public: | 106 public: |
106 GLES2DecoderManualInitTest() { } | 107 GLES2DecoderManualInitTest() { } |
107 | 108 |
108 // Override default setup so nothing gets setup. | 109 // Override default setup so nothing gets setup. |
109 virtual void SetUp() { | 110 virtual void SetUp() { |
(...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 } | 3184 } |
3184 | 3185 |
3185 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { | 3186 TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) { |
3186 InitDecoder( | 3187 InitDecoder( |
3187 "", // extensions | 3188 "", // extensions |
3188 true, // has alpha | 3189 true, // has alpha |
3189 false, // has depth | 3190 false, // has depth |
3190 false, // has stencil | 3191 false, // has stencil |
3191 true, // request alpha | 3192 true, // request alpha |
3192 false, // request depth | 3193 false, // request depth |
3193 false); // request stencil | 3194 false, // request stencil |
| 3195 true); // bind generates resource |
3194 | 3196 |
3195 EXPECT_CALL(*gl_, GetError()) | 3197 EXPECT_CALL(*gl_, GetError()) |
3196 .WillOnce(Return(GL_NO_ERROR)) | 3198 .WillOnce(Return(GL_NO_ERROR)) |
3197 .WillOnce(Return(GL_NO_ERROR)) | 3199 .WillOnce(Return(GL_NO_ERROR)) |
3198 .RetiresOnSaturation(); | 3200 .RetiresOnSaturation(); |
3199 typedef GetIntegerv::Result Result; | 3201 typedef GetIntegerv::Result Result; |
3200 Result* result = static_cast<Result*>(shared_memory_address_); | 3202 Result* result = static_cast<Result*>(shared_memory_address_); |
3201 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 3203 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
3202 .WillOnce(SetArgumentPointee<1>(8)) | 3204 .WillOnce(SetArgumentPointee<1>(8)) |
3203 .RetiresOnSaturation(); | 3205 .RetiresOnSaturation(); |
3204 result->size = 0; | 3206 result->size = 0; |
3205 GetIntegerv cmd2; | 3207 GetIntegerv cmd2; |
3206 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 3208 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
3207 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3209 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3208 EXPECT_EQ( | 3210 EXPECT_EQ( |
3209 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 3211 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
3210 result->GetNumResults()); | 3212 result->GetNumResults()); |
3211 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3213 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3212 EXPECT_EQ(8, result->GetData()[0]); | 3214 EXPECT_EQ(8, result->GetData()[0]); |
3213 } | 3215 } |
3214 | 3216 |
3215 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { | 3217 TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) { |
3216 InitDecoder( | 3218 InitDecoder( |
3217 "", // extensions | 3219 "", // extensions |
3218 true, // has alpha | 3220 true, // has alpha |
3219 false, // has depth | 3221 false, // has depth |
3220 false, // has stencil | 3222 false, // has stencil |
3221 false, // request alpha | 3223 false, // request alpha |
3222 false, // request depth | 3224 false, // request depth |
3223 false); // request stencil | 3225 false, // request stencil |
| 3226 true); // bind generates resource |
3224 | 3227 |
3225 EXPECT_CALL(*gl_, GetError()) | 3228 EXPECT_CALL(*gl_, GetError()) |
3226 .WillOnce(Return(GL_NO_ERROR)) | 3229 .WillOnce(Return(GL_NO_ERROR)) |
3227 .WillOnce(Return(GL_NO_ERROR)) | 3230 .WillOnce(Return(GL_NO_ERROR)) |
3228 .RetiresOnSaturation(); | 3231 .RetiresOnSaturation(); |
3229 typedef GetIntegerv::Result Result; | 3232 typedef GetIntegerv::Result Result; |
3230 Result* result = static_cast<Result*>(shared_memory_address_); | 3233 Result* result = static_cast<Result*>(shared_memory_address_); |
3231 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) | 3234 EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _)) |
3232 .WillOnce(SetArgumentPointee<1>(8)) | 3235 .WillOnce(SetArgumentPointee<1>(8)) |
3233 .RetiresOnSaturation(); | 3236 .RetiresOnSaturation(); |
3234 result->size = 0; | 3237 result->size = 0; |
3235 GetIntegerv cmd2; | 3238 GetIntegerv cmd2; |
3236 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); | 3239 cmd2.Init(GL_ALPHA_BITS, shared_memory_id_, shared_memory_offset_); |
3237 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3240 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3238 EXPECT_EQ( | 3241 EXPECT_EQ( |
3239 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), | 3242 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ALPHA_BITS), |
3240 result->GetNumResults()); | 3243 result->GetNumResults()); |
3241 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3244 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3242 EXPECT_EQ(0, result->GetData()[0]); | 3245 EXPECT_EQ(0, result->GetData()[0]); |
3243 } | 3246 } |
3244 | 3247 |
3245 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { | 3248 TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) { |
3246 InitDecoder( | 3249 InitDecoder( |
3247 "", // extensions | 3250 "", // extensions |
3248 false, // has alpha | 3251 false, // has alpha |
3249 true, // has depth | 3252 true, // has depth |
3250 false, // has stencil | 3253 false, // has stencil |
3251 false, // request alpha | 3254 false, // request alpha |
3252 true, // request depth | 3255 true, // request depth |
3253 false); // request stencil | 3256 false, // request stencil |
| 3257 true); // bind generates resource |
3254 | 3258 |
3255 EXPECT_CALL(*gl_, GetError()) | 3259 EXPECT_CALL(*gl_, GetError()) |
3256 .WillOnce(Return(GL_NO_ERROR)) | 3260 .WillOnce(Return(GL_NO_ERROR)) |
3257 .WillOnce(Return(GL_NO_ERROR)) | 3261 .WillOnce(Return(GL_NO_ERROR)) |
3258 .RetiresOnSaturation(); | 3262 .RetiresOnSaturation(); |
3259 typedef GetIntegerv::Result Result; | 3263 typedef GetIntegerv::Result Result; |
3260 Result* result = static_cast<Result*>(shared_memory_address_); | 3264 Result* result = static_cast<Result*>(shared_memory_address_); |
3261 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 3265 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
3262 .WillOnce(SetArgumentPointee<1>(24)) | 3266 .WillOnce(SetArgumentPointee<1>(24)) |
3263 .RetiresOnSaturation(); | 3267 .RetiresOnSaturation(); |
3264 result->size = 0; | 3268 result->size = 0; |
3265 GetIntegerv cmd2; | 3269 GetIntegerv cmd2; |
3266 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 3270 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
3267 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3271 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3268 EXPECT_EQ( | 3272 EXPECT_EQ( |
3269 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 3273 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
3270 result->GetNumResults()); | 3274 result->GetNumResults()); |
3271 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3275 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3272 EXPECT_EQ(24, result->GetData()[0]); | 3276 EXPECT_EQ(24, result->GetData()[0]); |
3273 } | 3277 } |
3274 | 3278 |
3275 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { | 3279 TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) { |
3276 InitDecoder( | 3280 InitDecoder( |
3277 "", // extensions | 3281 "", // extensions |
3278 false, // has alpha | 3282 false, // has alpha |
3279 true, // has depth | 3283 true, // has depth |
3280 false, // has stencil | 3284 false, // has stencil |
3281 false, // request alpha | 3285 false, // request alpha |
3282 false, // request depth | 3286 false, // request depth |
3283 false); // request stencil | 3287 false, // request stencil |
| 3288 true); // bind generates resource |
3284 | 3289 |
3285 EXPECT_CALL(*gl_, GetError()) | 3290 EXPECT_CALL(*gl_, GetError()) |
3286 .WillOnce(Return(GL_NO_ERROR)) | 3291 .WillOnce(Return(GL_NO_ERROR)) |
3287 .WillOnce(Return(GL_NO_ERROR)) | 3292 .WillOnce(Return(GL_NO_ERROR)) |
3288 .RetiresOnSaturation(); | 3293 .RetiresOnSaturation(); |
3289 typedef GetIntegerv::Result Result; | 3294 typedef GetIntegerv::Result Result; |
3290 Result* result = static_cast<Result*>(shared_memory_address_); | 3295 Result* result = static_cast<Result*>(shared_memory_address_); |
3291 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) | 3296 EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _)) |
3292 .WillOnce(SetArgumentPointee<1>(24)) | 3297 .WillOnce(SetArgumentPointee<1>(24)) |
3293 .RetiresOnSaturation(); | 3298 .RetiresOnSaturation(); |
3294 result->size = 0; | 3299 result->size = 0; |
3295 GetIntegerv cmd2; | 3300 GetIntegerv cmd2; |
3296 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); | 3301 cmd2.Init(GL_DEPTH_BITS, shared_memory_id_, shared_memory_offset_); |
3297 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3302 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3298 EXPECT_EQ( | 3303 EXPECT_EQ( |
3299 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), | 3304 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DEPTH_BITS), |
3300 result->GetNumResults()); | 3305 result->GetNumResults()); |
3301 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3306 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3302 EXPECT_EQ(0, result->GetData()[0]); | 3307 EXPECT_EQ(0, result->GetData()[0]); |
3303 } | 3308 } |
3304 | 3309 |
3305 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { | 3310 TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) { |
3306 InitDecoder( | 3311 InitDecoder( |
3307 "", // extensions | 3312 "", // extensions |
3308 false, // has alpha | 3313 false, // has alpha |
3309 false, // has depth | 3314 false, // has depth |
3310 true, // has stencil | 3315 true, // has stencil |
3311 false, // request alpha | 3316 false, // request alpha |
3312 false, // request depth | 3317 false, // request depth |
3313 true); // request stencil | 3318 true, // request stencil |
| 3319 true); // bind generates resource |
3314 | 3320 |
3315 EXPECT_CALL(*gl_, GetError()) | 3321 EXPECT_CALL(*gl_, GetError()) |
3316 .WillOnce(Return(GL_NO_ERROR)) | 3322 .WillOnce(Return(GL_NO_ERROR)) |
3317 .WillOnce(Return(GL_NO_ERROR)) | 3323 .WillOnce(Return(GL_NO_ERROR)) |
3318 .RetiresOnSaturation(); | 3324 .RetiresOnSaturation(); |
3319 typedef GetIntegerv::Result Result; | 3325 typedef GetIntegerv::Result Result; |
3320 Result* result = static_cast<Result*>(shared_memory_address_); | 3326 Result* result = static_cast<Result*>(shared_memory_address_); |
3321 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 3327 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
3322 .WillOnce(SetArgumentPointee<1>(8)) | 3328 .WillOnce(SetArgumentPointee<1>(8)) |
3323 .RetiresOnSaturation(); | 3329 .RetiresOnSaturation(); |
3324 result->size = 0; | 3330 result->size = 0; |
3325 GetIntegerv cmd2; | 3331 GetIntegerv cmd2; |
3326 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 3332 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
3327 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3333 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3328 EXPECT_EQ( | 3334 EXPECT_EQ( |
3329 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 3335 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
3330 result->GetNumResults()); | 3336 result->GetNumResults()); |
3331 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3337 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3332 EXPECT_EQ(8, result->GetData()[0]); | 3338 EXPECT_EQ(8, result->GetData()[0]); |
3333 } | 3339 } |
3334 | 3340 |
3335 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { | 3341 TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) { |
3336 InitDecoder( | 3342 InitDecoder( |
3337 "", // extensions | 3343 "", // extensions |
3338 false, // has alpha | 3344 false, // has alpha |
3339 false, // has depth | 3345 false, // has depth |
3340 true, // has stencil | 3346 true, // has stencil |
3341 false, // request alpha | 3347 false, // request alpha |
3342 false, // request depth | 3348 false, // request depth |
3343 false); // request stencil | 3349 false, // request stencil |
| 3350 true); // bind generates resource |
3344 | 3351 |
3345 EXPECT_CALL(*gl_, GetError()) | 3352 EXPECT_CALL(*gl_, GetError()) |
3346 .WillOnce(Return(GL_NO_ERROR)) | 3353 .WillOnce(Return(GL_NO_ERROR)) |
3347 .WillOnce(Return(GL_NO_ERROR)) | 3354 .WillOnce(Return(GL_NO_ERROR)) |
3348 .RetiresOnSaturation(); | 3355 .RetiresOnSaturation(); |
3349 typedef GetIntegerv::Result Result; | 3356 typedef GetIntegerv::Result Result; |
3350 Result* result = static_cast<Result*>(shared_memory_address_); | 3357 Result* result = static_cast<Result*>(shared_memory_address_); |
3351 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) | 3358 EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _)) |
3352 .WillOnce(SetArgumentPointee<1>(8)) | 3359 .WillOnce(SetArgumentPointee<1>(8)) |
3353 .RetiresOnSaturation(); | 3360 .RetiresOnSaturation(); |
3354 result->size = 0; | 3361 result->size = 0; |
3355 GetIntegerv cmd2; | 3362 GetIntegerv cmd2; |
3356 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); | 3363 cmd2.Init(GL_STENCIL_BITS, shared_memory_id_, shared_memory_offset_); |
3357 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); | 3364 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
3358 EXPECT_EQ( | 3365 EXPECT_EQ( |
3359 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), | 3366 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_STENCIL_BITS), |
3360 result->GetNumResults()); | 3367 result->GetNumResults()); |
3361 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3368 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3362 EXPECT_EQ(0, result->GetData()[0]); | 3369 EXPECT_EQ(0, result->GetData()[0]); |
3363 } | 3370 } |
3364 | 3371 |
3365 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { | 3372 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) { |
3366 InitDecoder( | 3373 InitDecoder( |
3367 "", // extensions | 3374 "", // extensions |
3368 false, // has alpha | 3375 false, // has alpha |
3369 true, // has depth | 3376 true, // has depth |
3370 false, // has stencil | 3377 false, // has stencil |
3371 false, // request alpha | 3378 false, // request alpha |
3372 true, // request depth | 3379 true, // request depth |
3373 false); // request stencil | 3380 false, // request stencil |
| 3381 true); // bind generates resource |
3374 | 3382 |
3375 Enable cmd; | 3383 Enable cmd; |
3376 cmd.Init(GL_DEPTH_TEST); | 3384 cmd.Init(GL_DEPTH_TEST); |
3377 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3385 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3378 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3386 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3379 | 3387 |
3380 SetupDefaultProgram(); | 3388 SetupDefaultProgram(); |
3381 SetupTexture(); | 3389 SetupTexture(); |
3382 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3390 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
3383 SetupExpectationsForApplyingDirtyState( | 3391 SetupExpectationsForApplyingDirtyState( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 } | 3427 } |
3420 | 3428 |
3421 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { | 3429 TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) { |
3422 InitDecoder( | 3430 InitDecoder( |
3423 "", // extensions | 3431 "", // extensions |
3424 false, // has alpha | 3432 false, // has alpha |
3425 true, // has depth | 3433 true, // has depth |
3426 false, // has stencil | 3434 false, // has stencil |
3427 false, // request alpha | 3435 false, // request alpha |
3428 false, // request depth | 3436 false, // request depth |
3429 false); // request stencil | 3437 false, // request stencil |
| 3438 true); // bind generates resource |
3430 | 3439 |
3431 Enable cmd; | 3440 Enable cmd; |
3432 cmd.Init(GL_DEPTH_TEST); | 3441 cmd.Init(GL_DEPTH_TEST); |
3433 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3442 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3434 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3443 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3435 | 3444 |
3436 SetupDefaultProgram(); | 3445 SetupDefaultProgram(); |
3437 SetupTexture(); | 3446 SetupTexture(); |
3438 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3447 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
3439 SetupExpectationsForApplyingDirtyState( | 3448 SetupExpectationsForApplyingDirtyState( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3475 } | 3484 } |
3476 | 3485 |
3477 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { | 3486 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) { |
3478 InitDecoder( | 3487 InitDecoder( |
3479 "", // extensions | 3488 "", // extensions |
3480 false, // has alpha | 3489 false, // has alpha |
3481 false, // has depth | 3490 false, // has depth |
3482 true, // has stencil | 3491 true, // has stencil |
3483 false, // request alpha | 3492 false, // request alpha |
3484 false, // request depth | 3493 false, // request depth |
3485 true); // request stencil | 3494 true, // request stencil |
| 3495 true); // bind generates resource |
3486 | 3496 |
3487 Enable cmd; | 3497 Enable cmd; |
3488 cmd.Init(GL_STENCIL_TEST); | 3498 cmd.Init(GL_STENCIL_TEST); |
3489 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3499 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3490 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3500 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3491 | 3501 |
3492 SetupDefaultProgram(); | 3502 SetupDefaultProgram(); |
3493 SetupTexture(); | 3503 SetupTexture(); |
3494 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3504 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
3495 SetupExpectationsForApplyingDirtyState( | 3505 SetupExpectationsForApplyingDirtyState( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 } | 3541 } |
3532 | 3542 |
3533 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { | 3543 TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) { |
3534 InitDecoder( | 3544 InitDecoder( |
3535 "", // extensions | 3545 "", // extensions |
3536 false, // has alpha | 3546 false, // has alpha |
3537 false, // has depth | 3547 false, // has depth |
3538 true, // has stencil | 3548 true, // has stencil |
3539 false, // request alpha | 3549 false, // request alpha |
3540 false, // request depth | 3550 false, // request depth |
3541 false); // request stencil | 3551 false, // request stencil |
| 3552 true); // bind generates resource |
3542 | 3553 |
3543 Enable cmd; | 3554 Enable cmd; |
3544 cmd.Init(GL_STENCIL_TEST); | 3555 cmd.Init(GL_STENCIL_TEST); |
3545 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3556 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3546 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3557 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3547 | 3558 |
3548 SetupDefaultProgram(); | 3559 SetupDefaultProgram(); |
3549 SetupTexture(); | 3560 SetupTexture(); |
3550 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 3561 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
3551 SetupExpectationsForApplyingDirtyState( | 3562 SetupExpectationsForApplyingDirtyState( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3587 } | 3598 } |
3588 | 3599 |
3589 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { | 3600 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) { |
3590 InitDecoder( | 3601 InitDecoder( |
3591 "GL_OES_packed_depth_stencil", // extensions | 3602 "GL_OES_packed_depth_stencil", // extensions |
3592 false, // has alpha | 3603 false, // has alpha |
3593 true, // has depth | 3604 true, // has depth |
3594 true, // has stencil | 3605 true, // has stencil |
3595 false, // request alpha | 3606 false, // request alpha |
3596 true, // request depth | 3607 true, // request depth |
3597 true); // request stencil | 3608 true, // request stencil |
| 3609 true); // bind generates resource |
3598 | 3610 |
3599 EXPECT_CALL(*gl_, GetError()) | 3611 EXPECT_CALL(*gl_, GetError()) |
3600 .WillOnce(Return(GL_NO_ERROR)) | 3612 .WillOnce(Return(GL_NO_ERROR)) |
3601 .WillOnce(Return(GL_NO_ERROR)) | 3613 .WillOnce(Return(GL_NO_ERROR)) |
3602 .WillOnce(Return(GL_NO_ERROR)) | 3614 .WillOnce(Return(GL_NO_ERROR)) |
3603 .WillOnce(Return(GL_NO_ERROR)) | 3615 .WillOnce(Return(GL_NO_ERROR)) |
3604 .RetiresOnSaturation(); | 3616 .RetiresOnSaturation(); |
3605 typedef GetIntegerv::Result Result; | 3617 typedef GetIntegerv::Result Result; |
3606 Result* result = static_cast<Result*>(shared_memory_address_); | 3618 Result* result = static_cast<Result*>(shared_memory_address_); |
3607 result->size = 0; | 3619 result->size = 0; |
(...skipping 22 matching lines...) Expand all Loading... |
3630 } | 3642 } |
3631 | 3643 |
3632 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { | 3644 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) { |
3633 InitDecoder( | 3645 InitDecoder( |
3634 "GL_OES_packed_depth_stencil", // extensions | 3646 "GL_OES_packed_depth_stencil", // extensions |
3635 false, // has alpha | 3647 false, // has alpha |
3636 true, // has depth | 3648 true, // has depth |
3637 true, // has stencil | 3649 true, // has stencil |
3638 false, // request alpha | 3650 false, // request alpha |
3639 true, // request depth | 3651 true, // request depth |
3640 false); // request stencil | 3652 false, // request stencil |
| 3653 true); // bind generates resource |
3641 | 3654 |
3642 EXPECT_CALL(*gl_, GetError()) | 3655 EXPECT_CALL(*gl_, GetError()) |
3643 .WillOnce(Return(GL_NO_ERROR)) | 3656 .WillOnce(Return(GL_NO_ERROR)) |
3644 .WillOnce(Return(GL_NO_ERROR)) | 3657 .WillOnce(Return(GL_NO_ERROR)) |
3645 .WillOnce(Return(GL_NO_ERROR)) | 3658 .WillOnce(Return(GL_NO_ERROR)) |
3646 .WillOnce(Return(GL_NO_ERROR)) | 3659 .WillOnce(Return(GL_NO_ERROR)) |
3647 .RetiresOnSaturation(); | 3660 .RetiresOnSaturation(); |
3648 typedef GetIntegerv::Result Result; | 3661 typedef GetIntegerv::Result Result; |
3649 Result* result = static_cast<Result*>(shared_memory_address_); | 3662 Result* result = static_cast<Result*>(shared_memory_address_); |
3650 result->size = 0; | 3663 result->size = 0; |
(...skipping 22 matching lines...) Expand all Loading... |
3673 } | 3686 } |
3674 | 3687 |
3675 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { | 3688 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) { |
3676 InitDecoder( | 3689 InitDecoder( |
3677 "GL_OES_packed_depth_stencil", // extensions | 3690 "GL_OES_packed_depth_stencil", // extensions |
3678 false, // has alpha | 3691 false, // has alpha |
3679 false, // has depth | 3692 false, // has depth |
3680 false, // has stencil | 3693 false, // has stencil |
3681 false, // request alpha | 3694 false, // request alpha |
3682 false, // request depth | 3695 false, // request depth |
3683 false); // request stencil | 3696 false, // request stencil |
| 3697 true); // bind generates resource |
3684 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 3698 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
3685 kServiceRenderbufferId); | 3699 kServiceRenderbufferId); |
3686 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 3700 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
3687 kServiceFramebufferId); | 3701 kServiceFramebufferId); |
3688 | 3702 |
3689 EXPECT_CALL(*gl_, GetError()) | 3703 EXPECT_CALL(*gl_, GetError()) |
3690 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage | 3704 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage |
3691 .WillOnce(Return(GL_NO_ERROR)) | 3705 .WillOnce(Return(GL_NO_ERROR)) |
3692 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer | 3706 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer |
3693 .WillOnce(Return(GL_NO_ERROR)) | 3707 .WillOnce(Return(GL_NO_ERROR)) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3749 } | 3763 } |
3750 | 3764 |
3751 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { | 3765 TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) { |
3752 InitDecoder( | 3766 InitDecoder( |
3753 "GL_OES_packed_depth_stencil", // extensions | 3767 "GL_OES_packed_depth_stencil", // extensions |
3754 false, // has alpha | 3768 false, // has alpha |
3755 false, // has depth | 3769 false, // has depth |
3756 false, // has stencil | 3770 false, // has stencil |
3757 false, // request alpha | 3771 false, // request alpha |
3758 false, // request depth | 3772 false, // request depth |
3759 false); // request stencil | 3773 false, // request stencil |
| 3774 true); // bind generates resource |
3760 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 3775 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
3761 kServiceRenderbufferId); | 3776 kServiceRenderbufferId); |
3762 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 3777 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
3763 kServiceFramebufferId); | 3778 kServiceFramebufferId); |
3764 | 3779 |
3765 EXPECT_CALL(*gl_, GetError()) | 3780 EXPECT_CALL(*gl_, GetError()) |
3766 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage | 3781 .WillOnce(Return(GL_NO_ERROR)) // for RenderbufferStoage |
3767 .WillOnce(Return(GL_NO_ERROR)) | 3782 .WillOnce(Return(GL_NO_ERROR)) |
3768 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer | 3783 .WillOnce(Return(GL_NO_ERROR)) // for FramebufferRenderbuffer |
3769 .WillOnce(Return(GL_NO_ERROR)) | 3784 .WillOnce(Return(GL_NO_ERROR)) |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 } | 4115 } |
4101 | 4116 |
4102 TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleGLError) { | 4117 TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleGLError) { |
4103 InitDecoder( | 4118 InitDecoder( |
4104 "GL_EXT_framebuffer_multisample", // extensions | 4119 "GL_EXT_framebuffer_multisample", // extensions |
4105 false, // has alpha | 4120 false, // has alpha |
4106 false, // has depth | 4121 false, // has depth |
4107 false, // has stencil | 4122 false, // has stencil |
4108 false, // request alpha | 4123 false, // request alpha |
4109 false, // request depth | 4124 false, // request depth |
4110 false); // request stencil | 4125 false, // request stencil |
| 4126 true); // bind generates resource |
4111 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 4127 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
4112 kServiceRenderbufferId); | 4128 kServiceRenderbufferId); |
4113 EXPECT_CALL(*gl_, GetError()) | 4129 EXPECT_CALL(*gl_, GetError()) |
4114 .WillOnce(Return(GL_NO_ERROR)) | 4130 .WillOnce(Return(GL_NO_ERROR)) |
4115 .WillOnce(Return(GL_OUT_OF_MEMORY)) | 4131 .WillOnce(Return(GL_OUT_OF_MEMORY)) |
4116 .RetiresOnSaturation(); | 4132 .RetiresOnSaturation(); |
4117 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT( | 4133 EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT( |
4118 GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) | 4134 GL_RENDERBUFFER, 1, GL_RGBA, 100, 50)) |
4119 .Times(1) | 4135 .Times(1) |
4120 .RetiresOnSaturation(); | 4136 .RetiresOnSaturation(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4162 } | 4178 } |
4163 | 4179 |
4164 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) { | 4180 TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) { |
4165 InitDecoder( | 4181 InitDecoder( |
4166 "GL_EXT_texture_compression_s3tc", // extensions | 4182 "GL_EXT_texture_compression_s3tc", // extensions |
4167 false, // has alpha | 4183 false, // has alpha |
4168 false, // has depth | 4184 false, // has depth |
4169 false, // has stencil | 4185 false, // has stencil |
4170 false, // request alpha | 4186 false, // request alpha |
4171 false, // request depth | 4187 false, // request depth |
4172 false); // request stencil | 4188 false, // request stencil |
| 4189 true); // bind generates resource |
4173 | 4190 |
4174 EXPECT_CALL(*gl_, GetError()) | 4191 EXPECT_CALL(*gl_, GetError()) |
4175 .WillOnce(Return(GL_NO_ERROR)) | 4192 .WillOnce(Return(GL_NO_ERROR)) |
4176 .WillOnce(Return(GL_NO_ERROR)) | 4193 .WillOnce(Return(GL_NO_ERROR)) |
4177 .WillOnce(Return(GL_NO_ERROR)) | 4194 .WillOnce(Return(GL_NO_ERROR)) |
4178 .WillOnce(Return(GL_NO_ERROR)) | 4195 .WillOnce(Return(GL_NO_ERROR)) |
4179 .RetiresOnSaturation(); | 4196 .RetiresOnSaturation(); |
4180 | 4197 |
4181 typedef GetIntegerv::Result Result; | 4198 typedef GetIntegerv::Result Result; |
4182 Result* result = static_cast<Result*>(shared_memory_address_); | 4199 Result* result = static_cast<Result*>(shared_memory_address_); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4218 } | 4235 } |
4219 | 4236 |
4220 TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) { | 4237 TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) { |
4221 InitDecoder( | 4238 InitDecoder( |
4222 "", // extensions | 4239 "", // extensions |
4223 false, // has alpha | 4240 false, // has alpha |
4224 false, // has depth | 4241 false, // has depth |
4225 false, // has stencil | 4242 false, // has stencil |
4226 false, // request alpha | 4243 false, // request alpha |
4227 false, // request depth | 4244 false, // request depth |
4228 false); // request stencil | 4245 false, // request stencil |
| 4246 true); // bind generates resource |
4229 | 4247 |
4230 EXPECT_CALL(*gl_, GetError()) | 4248 EXPECT_CALL(*gl_, GetError()) |
4231 .WillOnce(Return(GL_NO_ERROR)) | 4249 .WillOnce(Return(GL_NO_ERROR)) |
4232 .WillOnce(Return(GL_NO_ERROR)) | 4250 .WillOnce(Return(GL_NO_ERROR)) |
4233 .WillOnce(Return(GL_NO_ERROR)) | 4251 .WillOnce(Return(GL_NO_ERROR)) |
4234 .WillOnce(Return(GL_NO_ERROR)) | 4252 .WillOnce(Return(GL_NO_ERROR)) |
4235 .RetiresOnSaturation(); | 4253 .RetiresOnSaturation(); |
4236 | 4254 |
4237 typedef GetIntegerv::Result Result; | 4255 typedef GetIntegerv::Result Result; |
4238 Result* result = static_cast<Result*>(shared_memory_address_); | 4256 Result* result = static_cast<Result*>(shared_memory_address_); |
(...skipping 30 matching lines...) Expand all Loading... |
4269 EXPECT_GT(bucket->size(), 0u); | 4287 EXPECT_GT(bucket->size(), 0u); |
4270 } | 4288 } |
4271 | 4289 |
4272 TEST_F(GLES2DecoderWithShaderTest, GetProgramInfoCHROMIUMInvalidArgs) { | 4290 TEST_F(GLES2DecoderWithShaderTest, GetProgramInfoCHROMIUMInvalidArgs) { |
4273 const uint32 kBucketId = 123; | 4291 const uint32 kBucketId = 123; |
4274 CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); | 4292 CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); |
4275 EXPECT_TRUE(bucket == NULL); | 4293 EXPECT_TRUE(bucket == NULL); |
4276 GetProgramInfoCHROMIUM cmd; | 4294 GetProgramInfoCHROMIUM cmd; |
4277 cmd.Init(kInvalidClientId, kBucketId); | 4295 cmd.Init(kInvalidClientId, kBucketId); |
4278 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4296 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4279 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4297 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
4280 bucket = decoder_->GetBucket(kBucketId); | 4298 bucket = decoder_->GetBucket(kBucketId); |
4281 ASSERT_TRUE(bucket != NULL); | 4299 ASSERT_TRUE(bucket != NULL); |
4282 EXPECT_EQ(sizeof(ProgramInfoHeader), bucket->size()); | 4300 EXPECT_EQ(sizeof(ProgramInfoHeader), bucket->size()); |
4283 ProgramInfoHeader* info = bucket->GetDataAs<ProgramInfoHeader*>( | 4301 ProgramInfoHeader* info = bucket->GetDataAs<ProgramInfoHeader*>( |
4284 0, sizeof(ProgramInfoHeader)); | 4302 0, sizeof(ProgramInfoHeader)); |
4285 ASSERT_TRUE(info != 0); | 4303 ASSERT_TRUE(info != 0); |
4286 EXPECT_EQ(0u, info->link_status); | 4304 EXPECT_EQ(0u, info->link_status); |
4287 EXPECT_EQ(0u, info->num_attribs); | 4305 EXPECT_EQ(0u, info->num_attribs); |
4288 EXPECT_EQ(0u, info->num_uniforms); | 4306 EXPECT_EQ(0u, info->num_uniforms); |
4289 } | 4307 } |
4290 | 4308 |
| 4309 TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) { |
| 4310 InitDecoder( |
| 4311 "", // extensions |
| 4312 false, // has alpha |
| 4313 false, // has depth |
| 4314 false, // has stencil |
| 4315 false, // request alpha |
| 4316 false, // request depth |
| 4317 false, // request stencil |
| 4318 false); // bind generates resource |
| 4319 |
| 4320 BindTexture cmd1; |
| 4321 cmd1.Init(GL_TEXTURE_2D, kInvalidClientId); |
| 4322 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); |
| 4323 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4324 |
| 4325 BindBuffer cmd2; |
| 4326 cmd2.Init(GL_ARRAY_BUFFER, kInvalidClientId); |
| 4327 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4328 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4329 |
| 4330 BindFramebuffer cmd3; |
| 4331 cmd3.Init(GL_FRAMEBUFFER, kInvalidClientId); |
| 4332 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd3)); |
| 4333 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4334 |
| 4335 BindRenderbuffer cmd4; |
| 4336 cmd4.Init(GL_RENDERBUFFER, kInvalidClientId); |
| 4337 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd4)); |
| 4338 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 4339 } |
| 4340 |
4291 // TODO(gman): Complete this test. | 4341 // TODO(gman): Complete this test. |
4292 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 4342 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
4293 // } | 4343 // } |
4294 | 4344 |
4295 // TODO(gman): BufferData | 4345 // TODO(gman): BufferData |
4296 | 4346 |
4297 // TODO(gman): BufferDataImmediate | 4347 // TODO(gman): BufferDataImmediate |
4298 | 4348 |
4299 // TODO(gman): BufferSubData | 4349 // TODO(gman): BufferSubData |
4300 | 4350 |
(...skipping 16 matching lines...) Expand all Loading... |
4317 // TODO(gman): TexImage2DImmediate | 4367 // TODO(gman): TexImage2DImmediate |
4318 | 4368 |
4319 // TODO(gman): TexSubImage2DImmediate | 4369 // TODO(gman): TexSubImage2DImmediate |
4320 | 4370 |
4321 // TODO(gman): UseProgram | 4371 // TODO(gman): UseProgram |
4322 | 4372 |
4323 // TODO(gman): SwapBuffers | 4373 // TODO(gman): SwapBuffers |
4324 | 4374 |
4325 } // namespace gles2 | 4375 } // namespace gles2 |
4326 } // namespace gpu | 4376 } // namespace gpu |
OLD | NEW |