Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc

Issue 2232743002: Command buffer: CopyTexSubImage3D should clear the 3D texture if it is uncleared (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update webgl 2 expectation Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1361
1362 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) 1362 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
1363 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 1363 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
1364 .RetiresOnSaturation(); 1364 .RetiresOnSaturation();
1365 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, 1365 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1366 kX, kY, kWidth, kHeight); 1366 kX, kY, kWidth, kHeight);
1367 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1367 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1368 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 1368 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1369 } 1369 }
1370 1370
1371 TEST_P(GLES3DecoderTest, CopyTexSubImage3DClearTheUncleared3DTexture) {
1372 const GLenum kTarget = GL_TEXTURE_3D;
1373 const GLint kLevel = 0;
1374 const GLint kXoffset = 0;
1375 const GLint kYoffset = 0;
1376 const GLint kZoffset = 0;
1377 const GLint kX = 0;
1378 const GLint kY = 0;
1379 const GLint kInternalFormat = GL_RGB8;
1380 const GLsizei kWidth = 2;
1381 const GLsizei kHeight = 2;
1382 const GLsizei kDepth = 2;
1383 const GLenum kFormat = GL_RGB;
1384 const GLenum kType = GL_UNSIGNED_BYTE;
1385 const uint32_t kBufferSize = kWidth * kHeight * kDepth * 4;
1386
1387 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1388 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1389 kFormat, kType, 0, 0);
1390 TextureRef* texture_ref =
1391 group().texture_manager()->GetTexture(client_texture_id_);
1392 ASSERT_TRUE(texture_ref != NULL);
1393 Texture* texture = texture_ref->texture();
1394
1395 EXPECT_FALSE(texture->SafeToRenderFrom());
1396 EXPECT_FALSE(texture->IsLevelCleared(kTarget, kLevel));
1397
1398 // CopyTexSubImage3D will clear the uncleared texture
1399 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
1400 .Times(1)
1401 .RetiresOnSaturation();
1402 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
1403 .Times(1)
1404 .RetiresOnSaturation();
1405 EXPECT_CALL(*gl_, BufferData(GL_PIXEL_UNPACK_BUFFER,
1406 kBufferSize, _, GL_STATIC_DRAW))
1407 .Times(1)
1408 .RetiresOnSaturation();
1409 EXPECT_CALL(*gl_, BindTexture(kTarget, kServiceTextureId))
1410 .Times(1)
1411 .RetiresOnSaturation();
1412 EXPECT_CALL(*gl_, TexSubImage3DNoData(kTarget, kLevel,
1413 kXoffset, kYoffset, kZoffset,
1414 kWidth, kHeight, kDepth,
1415 kFormat, kType))
1416 .Times(1)
1417 .RetiresOnSaturation();
1418 EXPECT_CALL(*gl_, BindBuffer(GL_PIXEL_UNPACK_BUFFER, _))
1419 .Times(1)
1420 .RetiresOnSaturation();
1421 EXPECT_CALL(*gl_, DeleteBuffersARB(1, _))
1422 .Times(1)
1423 .RetiresOnSaturation();
1424 EXPECT_CALL(*gl_, BindTexture(kTarget, _))
1425 .Times(1)
1426 .RetiresOnSaturation();
1427
1428 EXPECT_CALL(*gl_,
1429 CopyTexSubImage3D(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1430 kX, kY, kWidth, kHeight))
1431 .Times(1)
1432 .RetiresOnSaturation();
1433
1434 CopyTexSubImage3D cmd;
1435 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1436 kX, kY, kWidth, kHeight);
1437 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1438 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1439 EXPECT_TRUE(texture->SafeToRenderFrom());
1440 EXPECT_TRUE(texture->IsLevelCleared(kTarget, kLevel));
1441 }
1442
1371 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { 1443 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
1372 const uint32_t kBucketId = 123; 1444 const uint32_t kBucketId = 123;
1373 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1445 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1374 const GLint kLevel = 0; 1446 const GLint kLevel = 0;
1375 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; 1447 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
1376 const GLsizei kWidth = 4; 1448 const GLsizei kWidth = 4;
1377 const GLsizei kHeight = 8; 1449 const GLsizei kHeight = 8;
1378 const GLsizei kDepth = 4; 1450 const GLsizei kDepth = 4;
1379 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1451 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1380 ASSERT_TRUE(bucket != NULL); 1452 ASSERT_TRUE(bucket != NULL);
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4374 // TODO(gman): CompressedTexSubImage2DImmediate 4446 // TODO(gman): CompressedTexSubImage2DImmediate
4375 4447
4376 // TODO(gman): TexImage2D 4448 // TODO(gman): TexImage2D
4377 4449
4378 // TODO(gman): TexImage2DImmediate 4450 // TODO(gman): TexImage2DImmediate
4379 4451
4380 // TODO(gman): TexSubImage2DImmediate 4452 // TODO(gman): TexSubImage2DImmediate
4381 4453
4382 } // namespace gles2 4454 } // namespace gles2
4383 } // namespace gpu 4455 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698