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

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

Issue 168983005: Do not rely on a texture's internalformat matching format (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add unit tests for TexSubImage2D on GLES3 Created 6 years, 10 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
OLDNEW
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.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); 1866 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
1867 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height)); 1867 EXPECT_FALSE(texture->GetLevelSize(GL_TEXTURE_2D, 2, &width, &height));
1868 } 1868 }
1869 1869
1870 TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) { 1870 TEST_F(GLES2DecoderTest, GenerateMipmapClearsUnclearedTexture) {
1871 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)) 1871 EXPECT_CALL(*gl_, GenerateMipmapEXT(_))
1872 .Times(0); 1872 .Times(0);
1873 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 1873 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
1874 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 1874 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
1875 0, 0); 1875 0, 0);
1876 SetupClearTextureExpections( 1876 SetupClearTextureExpectations(
1877 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 1877 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
1878 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 1878 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
1879 EXPECT_CALL(*gl_, TexParameteri( 1879 EXPECT_CALL(*gl_, TexParameteri(
1880 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST)) 1880 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST))
1881 .Times(1) 1881 .Times(1)
1882 .RetiresOnSaturation(); 1882 .RetiresOnSaturation();
1883 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D)); 1883 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D));
1884 EXPECT_CALL(*gl_, TexParameteri( 1884 EXPECT_CALL(*gl_, TexParameteri(
1885 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) 1885 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR))
1886 .Times(1) 1886 .Times(1)
1887 .RetiresOnSaturation(); 1887 .RetiresOnSaturation();
1888 EXPECT_CALL(*gl_, GetError()) 1888 EXPECT_CALL(*gl_, GetError())
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after
4589 if (ii == 0) { 4589 if (ii == 0) {
4590 EXPECT_CALL(*gl_, TexImage2D( 4590 EXPECT_CALL(*gl_, TexImage2D(
4591 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, 4591 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA,
4592 GL_UNSIGNED_BYTE, _)) 4592 GL_UNSIGNED_BYTE, _))
4593 .Times(1) 4593 .Times(1)
4594 .RetiresOnSaturation(); 4594 .RetiresOnSaturation();
4595 cmd.Init( 4595 cmd.Init(
4596 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, 4596 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA,
4597 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset); 4597 GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset);
4598 } else { 4598 } else {
4599 SetupClearTextureExpections( 4599 SetupClearTextureExpectations(
4600 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 4600 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
4601 0, GL_RGBA, GL_UNSIGNED_BYTE, kWidth, kHeight); 4601 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, kWidth, kHeight);
4602 cmd.Init( 4602 cmd.Init(
4603 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, 4603 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA,
4604 GL_UNSIGNED_BYTE, 0, 0); 4604 GL_UNSIGNED_BYTE, 0, 0);
4605 } 4605 }
4606 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4606 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4607 EXPECT_CALL(*gl_, TexSubImage2D( 4607 EXPECT_CALL(*gl_, TexSubImage2D(
4608 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE, 4608 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE,
4609 shared_memory_address_)) 4609 shared_memory_address_))
4610 .Times(1) 4610 .Times(1)
4611 .RetiresOnSaturation(); 4611 .RetiresOnSaturation();
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
5907 const uint32 kBadBucketId = 123; 5907 const uint32 kBadBucketId = 123;
5908 RequestExtensionCHROMIUM cmd; 5908 RequestExtensionCHROMIUM cmd;
5909 cmd.Init(kBadBucketId); 5909 cmd.Init(kBadBucketId);
5910 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 5910 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
5911 } 5911 }
5912 5912
5913 TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DNULL) { 5913 TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DNULL) {
5914 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 5914 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
5915 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 5915 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
5916 0, 0); 5916 0, 0);
5917 SetupClearTextureExpections( 5917 SetupClearTextureExpectations(
5918 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 5918 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
5919 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 5919 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
5920 EXPECT_CALL(*gl_, TexSubImage2D( 5920 EXPECT_CALL(*gl_, TexSubImage2D(
5921 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 5921 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
5922 shared_memory_address_)) 5922 shared_memory_address_))
5923 .Times(1) 5923 .Times(1)
5924 .RetiresOnSaturation(); 5924 .RetiresOnSaturation();
5925 TexSubImage2D cmd; 5925 TexSubImage2D cmd;
5926 cmd.Init( 5926 cmd.Init(
5927 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 5927 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
5928 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); 5928 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE);
5929 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 5929 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
6030 // Put in data (so it should be marked as cleared) 6030 // Put in data (so it should be marked as cleared)
6031 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 6031 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
6032 kSharedMemoryId, kSharedMemoryOffset); 6032 kSharedMemoryId, kSharedMemoryOffset);
6033 // Put in no data. 6033 // Put in no data.
6034 TexImage2D tex_cmd; 6034 TexImage2D tex_cmd;
6035 tex_cmd.Init( 6035 tex_cmd.Init(
6036 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 6036 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
6037 // It won't actually call TexImage2D, just mark it as uncleared. 6037 // It won't actually call TexImage2D, just mark it as uncleared.
6038 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_cmd)); 6038 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_cmd));
6039 // Next call to TexSubImage2d should clear. 6039 // Next call to TexSubImage2d should clear.
6040 SetupClearTextureExpections( 6040 SetupClearTextureExpectations(
6041 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6041 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6042 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 6042 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
6043 EXPECT_CALL(*gl_, TexSubImage2D( 6043 EXPECT_CALL(*gl_, TexSubImage2D(
6044 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 6044 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
6045 shared_memory_address_)) 6045 shared_memory_address_))
6046 .Times(1) 6046 .Times(1)
6047 .RetiresOnSaturation(); 6047 .RetiresOnSaturation();
6048 TexSubImage2D cmd; 6048 TexSubImage2D cmd;
6049 cmd.Init( 6049 cmd.Init(
6050 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 6050 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
6051 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); 6051 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE);
6052 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6052 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6053 } 6053 }
6054 6054
6055 TEST_F(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { 6055 TEST_F(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) {
6056 SetupAllNeededVertexBuffers(); 6056 SetupAllNeededVertexBuffers();
6057 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 6057 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
6058 // Create an uncleared texture with 2 levels. 6058 // Create an uncleared texture with 2 levels.
6059 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 6059 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
6060 0, 0); 6060 0, 0);
6061 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 6061 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
6062 0, 0); 6062 0, 0);
6063 // Expect 2 levels will be cleared. 6063 // Expect 2 levels will be cleared.
6064 SetupClearTextureExpections( 6064 SetupClearTextureExpectations(
6065 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6065 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6066 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 6066 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
6067 SetupClearTextureExpections( 6067 SetupClearTextureExpectations(
6068 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6068 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6069 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); 6069 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1);
6070 SetupExpectationsForApplyingDefaultDirtyState(); 6070 SetupExpectationsForApplyingDefaultDirtyState();
6071 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) 6071 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
6072 .Times(1) 6072 .Times(1)
6073 .RetiresOnSaturation(); 6073 .RetiresOnSaturation();
6074 DrawArrays cmd; 6074 DrawArrays cmd;
6075 cmd.Init(GL_TRIANGLES, 0, kNumVertices); 6075 cmd.Init(GL_TRIANGLES, 0, kNumVertices);
6076 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6076 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6077 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 6077 EXPECT_EQ(GL_NO_ERROR, GetGLError());
6078 6078
6079 // But not again 6079 // But not again
6080 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) 6080 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
6081 .Times(1) 6081 .Times(1)
6082 .RetiresOnSaturation(); 6082 .RetiresOnSaturation();
6083 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6083 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6084 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 6084 EXPECT_EQ(GL_NO_ERROR, GetGLError());
6085 } 6085 }
6086 6086
6087 TEST_F(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { 6087 TEST_F(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) {
6088 SetupAllNeededVertexBuffers(); 6088 SetupAllNeededVertexBuffers();
6089 SetupIndexBuffer(); 6089 SetupIndexBuffer();
6090 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 6090 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
6091 // Create an uncleared texture with 2 levels. 6091 // Create an uncleared texture with 2 levels.
6092 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 6092 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
6093 0, 0); 6093 0, 0);
6094 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 6094 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
6095 0, 0); 6095 0, 0);
6096 // Expect 2 levels will be cleared. 6096 // Expect 2 levels will be cleared.
6097 SetupClearTextureExpections( 6097 SetupClearTextureExpectations(
6098 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6098 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6099 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 6099 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
6100 SetupClearTextureExpections( 6100 SetupClearTextureExpectations(
6101 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6101 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6102 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); 6102 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1);
6103 SetupExpectationsForApplyingDefaultDirtyState(); 6103 SetupExpectationsForApplyingDefaultDirtyState();
6104 6104
6105 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount, 6105 EXPECT_CALL(*gl_, DrawElements(GL_TRIANGLES, kValidIndexRangeCount,
6106 GL_UNSIGNED_SHORT, 6106 GL_UNSIGNED_SHORT,
6107 BufferOffset(kValidIndexRangeStart * 2))) 6107 BufferOffset(kValidIndexRangeStart * 2)))
6108 .Times(1) 6108 .Times(1)
6109 .RetiresOnSaturation(); 6109 .RetiresOnSaturation();
6110 DrawElements cmd; 6110 DrawElements cmd;
6111 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT, 6111 cmd.Init(GL_TRIANGLES, kValidIndexRangeCount, GL_UNSIGNED_SHORT,
6112 kValidIndexRangeStart * 2); 6112 kValidIndexRangeStart * 2);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
6242 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6242 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6243 6243
6244 EXPECT_TRUE(texture->SafeToRenderFrom()); 6244 EXPECT_TRUE(texture->SafeToRenderFrom());
6245 } 6245 }
6246 6246
6247 TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) { 6247 TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) {
6248 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 6248 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
6249 DoTexImage2D( 6249 DoTexImage2D(
6250 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 6250 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
6251 6251
6252 SetupClearTextureExpections( 6252 SetupClearTextureExpectations(
6253 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D, 6253 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
6254 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 6254 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
6255 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1)) 6255 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1))
6256 .Times(1) 6256 .Times(1)
6257 .RetiresOnSaturation(); 6257 .RetiresOnSaturation();
6258 CopyTexSubImage2D cmd; 6258 CopyTexSubImage2D cmd;
6259 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1); 6259 cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1);
6260 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6260 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6261 } 6261 }
6262 6262
6263 TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) { 6263 TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) {
6264 InitDecoder( 6264 InitDecoder(
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
6522 int32 shm_id = 6522 int32 shm_id =
6523 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryId; 6523 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryId;
6524 uint32 shm_offset = 6524 uint32 shm_offset =
6525 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryOffset; 6525 (face == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ? 0 : kSharedMemoryOffset;
6526 DoTexImage2D(face, 0, GL_RGBA, 2, 2, 0, GL_RGBA, 6526 DoTexImage2D(face, 0, GL_RGBA, 2, 2, 0, GL_RGBA,
6527 GL_UNSIGNED_BYTE, shm_id, shm_offset); 6527 GL_UNSIGNED_BYTE, shm_id, shm_offset);
6528 DoTexImage2D(face, 1, GL_RGBA, 1, 1, 0, GL_RGBA, 6528 DoTexImage2D(face, 1, GL_RGBA, 1, 1, 0, GL_RGBA,
6529 GL_UNSIGNED_BYTE, shm_id, shm_offset); 6529 GL_UNSIGNED_BYTE, shm_id, shm_offset);
6530 } 6530 }
6531 // Expect 2 levels will be cleared. 6531 // Expect 2 levels will be cleared.
6532 SetupClearTextureExpections( 6532 SetupClearTextureExpectations(
6533 kServiceTextureId, kServiceTextureId, GL_TEXTURE_CUBE_MAP, 6533 kServiceTextureId, kServiceTextureId, GL_TEXTURE_CUBE_MAP,
6534 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2); 6534 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE,
6535 SetupClearTextureExpections( 6535 2, 2);
6536 SetupClearTextureExpectations(
6536 kServiceTextureId, kServiceTextureId, GL_TEXTURE_CUBE_MAP, 6537 kServiceTextureId, kServiceTextureId, GL_TEXTURE_CUBE_MAP,
6537 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 1, GL_RGBA, GL_UNSIGNED_BYTE, 1, 1); 6538 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE,
6539 1, 1);
6538 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); 6540 AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
6539 SetupExpectationsForApplyingDefaultDirtyState(); 6541 SetupExpectationsForApplyingDefaultDirtyState();
6540 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) 6542 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
6541 .Times(1) 6543 .Times(1)
6542 .RetiresOnSaturation(); 6544 .RetiresOnSaturation();
6543 DrawArrays cmd; 6545 DrawArrays cmd;
6544 cmd.Init(GL_TRIANGLES, 0, kNumVertices); 6546 cmd.Init(GL_TRIANGLES, 0, kNumVertices);
6545 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 6547 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
6546 } 6548 }
6547 6549
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
8939 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 8941 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0,
8940 0); 8942 0);
8941 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE, 8943 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 16, 17, 0, GL_LUMINANCE,
8942 GL_FLOAT, 0, 0); 8944 GL_FLOAT, 0, 0);
8943 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT, 8945 DoTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 16, 17, 0, GL_ALPHA, GL_FLOAT,
8944 0, 0); 8946 0, 0);
8945 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0, 8947 DoTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, 16, 17, 0,
8946 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0); 8948 GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0);
8947 } 8949 }
8948 8950
8951 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) {
8952 InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions
8953 "opengl es 3.0", // gl version
8954 false, // has alpha
8955 false, // has depth
8956 false, // has stencil
8957 false, // request alpha
8958 false, // request depth
8959 false, // request stencil
8960 false); // bind generates resource
8961 const int kWidth = 8;
8962 const int kHeight = 4;
8963 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
8964 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA,
8965 GL_FLOAT, 0, 0);
8966 EXPECT_CALL(*gl_, TexImage2D(
8967 GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA, GL_FLOAT,
8968 shared_memory_address_))
8969 .Times(1)
8970 .RetiresOnSaturation();
8971 TexSubImage2D cmd;
8972 cmd.Init(
8973 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight, GL_RGBA, GL_FLOAT,
8974 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE);
8975 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
8976 EXPECT_EQ(GL_NO_ERROR, GetGLError());
8977 }
8978
8979 TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) {
8980 InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions
8981 "opengl es 3.0", // gl version
8982 false, // has alpha
8983 false, // has depth
8984 false, // has stencil
8985 false, // request alpha
8986 false, // request depth
8987 false, // request stencil
8988 false); // bind generates resource
8989 const int kWidth = 8;
8990 const int kHeight = 4;
8991 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
8992 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, kWidth, kHeight, 0, GL_RGBA,
8993 GL_FLOAT, 0, 0);
8994 SetupClearTextureExpectations(
8995 kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
8996 0, GL_RGBA32F, GL_RGBA, GL_FLOAT, kWidth, kHeight);
8997 EXPECT_CALL(*gl_, TexSubImage2D(
8998 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT,
8999 shared_memory_address_))
9000 .Times(1)
9001 .RetiresOnSaturation();
9002 TexSubImage2D cmd;
9003 cmd.Init(
9004 GL_TEXTURE_2D, 0, 1, 0, kWidth - 1, kHeight, GL_RGBA, GL_FLOAT,
9005 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE);
9006 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
9007 EXPECT_EQ(GL_NO_ERROR, GetGLError());
9008 }
9009
8949 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) { 9010 TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) {
8950 InitDecoder("GL_ARB_texture_float", // extensions 9011 InitDecoder("GL_ARB_texture_float", // extensions
8951 "2.1", // gl version 9012 "2.1", // gl version
8952 false, // has alpha 9013 false, // has alpha
8953 false, // has depth 9014 false, // has depth
8954 false, // has stencil 9015 false, // has stencil
8955 false, // request alpha 9016 false, // request alpha
8956 false, // request depth 9017 false, // request depth
8957 false, // request stencil 9018 false, // request stencil
8958 false); // bind generates resource 9019 false); // bind generates resource
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
9003 // TODO(gman): TexImage2DImmediate 9064 // TODO(gman): TexImage2DImmediate
9004 9065
9005 // TODO(gman): TexSubImage2DImmediate 9066 // TODO(gman): TexSubImage2DImmediate
9006 9067
9007 // TODO(gman): UseProgram 9068 // TODO(gman): UseProgram
9008 9069
9009 // TODO(gman): SwapBuffers 9070 // TODO(gman): SwapBuffers
9010 9071
9011 } // namespace gles2 9072 } // namespace gles2
9012 } // namespace gpu 9073 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_mock.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698