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