Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1206 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | 1206 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, |
| 1207 kX, kY, kWidth + 1, kHeight); | 1207 kX, kY, kWidth + 1, kHeight); |
| 1208 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1208 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1209 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1209 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1210 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | 1210 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, |
| 1211 kX, kY, kWidth, kHeight + 1); | 1211 kX, kY, kWidth, kHeight + 1); |
| 1212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1213 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 1213 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 TEST_P(GLES3DecoderTest, CopyTexSubImage3DFeedbackLoops) { | |
| 1217 const GLenum kTarget = GL_TEXTURE_3D; | |
| 1218 const GLint kInternalFormat = GL_RGB8; | |
| 1219 const GLint kXoffset = 0; | |
| 1220 const GLint kYoffset = 0; | |
| 1221 const GLint kZoffset = 0; | |
| 1222 const GLint kX = 0; | |
| 1223 const GLint kY = 0; | |
| 1224 const GLsizei kWidth = 2; | |
| 1225 const GLsizei kHeight = 2; | |
| 1226 const GLsizei kDepth = 2; | |
| 1227 const GLsizei kBorder = 0; | |
| 1228 const GLenum kFormat = GL_RGB; | |
| 1229 const GLenum kType = GL_UNSIGNED_BYTE; | |
| 1230 GLint kLevel; | |
| 1231 GLint kLayer; | |
| 1232 | |
| 1233 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); | |
| 1234 DoBindFramebuffer( | |
| 1235 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | |
| 1236 | |
| 1237 cmds::FramebufferTextureLayer tex_layer; | |
| 1238 CopyTexSubImage3D cmd; | |
|
Zhenyao Mo
2016/07/28 14:51:37
This is weird. Why one has namespace cmds and the
yunchao
2016/07/28 15:53:06
cmds namespace is not necessary. removed
| |
| 1239 | |
| 1240 // The source and the target for CopyTexSubImage3D are the same 3d texture. | |
| 1241 // But level of 3D texture != level of read attachment in fbo. | |
| 1242 kLevel = 0; | |
| 1243 kLayer = 0; // kZoffset is 0 | |
| 1244 EXPECT_CALL(*gl_, FramebufferTextureLayer(GL_FRAMEBUFFER, | |
| 1245 GL_COLOR_ATTACHMENT0, | |
| 1246 kServiceTextureId, kLayer, kLevel)) | |
| 1247 .Times(1) | |
| 1248 .RetiresOnSaturation(); | |
| 1249 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, | |
| 1250 kBorder, kFormat, kType, kSharedMemoryId, kSharedMemoryOffset); | |
| 1251 tex_layer.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, | |
| 1252 kLevel, kLayer); | |
| 1253 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_layer)); | |
| 1254 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 1255 | |
| 1256 kLevel = 1; | |
| 1257 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, | |
| 1258 kBorder, kFormat, kType, kSharedMemoryId, kSharedMemoryOffset); | |
| 1259 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) | |
| 1260 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
| 1261 .RetiresOnSaturation(); | |
| 1262 EXPECT_CALL(*gl_, | |
| 1263 CopyTexSubImage3D(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | |
| 1264 kX, kY, kWidth, kHeight)) | |
| 1265 .Times(1) | |
| 1266 .RetiresOnSaturation(); | |
| 1267 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | |
| 1268 kX, kY, kWidth, kHeight); | |
| 1269 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 1270 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 1271 | |
| 1272 // The source and the target for CopyTexSubImage3D are the same 3d texture. | |
| 1273 // But zoffset of 3D texture != layer of read attachment in fbo. | |
| 1274 kLevel = 0; | |
| 1275 kLayer = 1; // kZoffset is 0 | |
| 1276 EXPECT_CALL(*gl_, FramebufferTextureLayer(GL_FRAMEBUFFER, | |
| 1277 GL_COLOR_ATTACHMENT0, | |
| 1278 kServiceTextureId, kLevel, kLayer)) | |
| 1279 .Times(1) | |
| 1280 .RetiresOnSaturation(); | |
| 1281 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, | |
|
Zhenyao Mo
2016/07/28 14:51:37
You don't need to re-setup the texture again.
yunchao
2016/07/28 15:53:06
Done.
| |
| 1282 kBorder, kFormat, kType, kSharedMemoryId, kSharedMemoryOffset); | |
| 1283 tex_layer.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, | |
| 1284 kLevel, kLayer); | |
| 1285 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_layer)); | |
| 1286 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 1287 | |
| 1288 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) | |
| 1289 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
| 1290 .RetiresOnSaturation(); | |
| 1291 EXPECT_CALL(*gl_, | |
| 1292 CopyTexSubImage3D(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | |
| 1293 kX, kY, kWidth, kHeight)) | |
| 1294 .Times(1) | |
| 1295 .RetiresOnSaturation(); | |
| 1296 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | |
| 1297 kX, kY, kWidth, kHeight); | |
| 1298 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 1299 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 1300 | |
| 1301 // The source and the target for CopyTexSubImage3D are the same 3d texture. | |
| 1302 // And level / zoffset of 3D texture equal to level / layer of read attachment | |
| 1303 // in fbo. | |
| 1304 kLevel = 1; | |
| 1305 kLayer = 0; // kZoffset is 0 | |
| 1306 EXPECT_CALL(*gl_, FramebufferTextureLayer(GL_FRAMEBUFFER, | |
| 1307 GL_COLOR_ATTACHMENT0, | |
| 1308 kServiceTextureId, kLevel, kLayer)) | |
| 1309 .Times(1) | |
| 1310 .RetiresOnSaturation(); | |
| 1311 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, | |
|
Zhenyao Mo
2016/07/28 14:51:37
Same here.
yunchao
2016/07/28 15:53:06
Done.
| |
| 1312 kBorder, kFormat, kType, kSharedMemoryId, kSharedMemoryOffset); | |
| 1313 tex_layer.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, | |
| 1314 kLevel, kLayer); | |
| 1315 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_layer)); | |
| 1316 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 1317 | |
| 1318 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) | |
| 1319 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | |
| 1320 .RetiresOnSaturation(); | |
| 1321 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset, | |
| 1322 kX, kY, kWidth, kHeight); | |
| 1323 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
| 1324 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | |
| 1325 } | |
| 1326 | |
|
qiankun
2016/07/28 13:59:31
Extra new-line.
| |
| 1327 | |
| 1216 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { | 1328 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { |
| 1217 const uint32_t kBucketId = 123; | 1329 const uint32_t kBucketId = 123; |
| 1218 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; | 1330 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; |
| 1219 const GLint kLevel = 0; | 1331 const GLint kLevel = 0; |
| 1220 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; | 1332 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; |
| 1221 const GLsizei kWidth = 4; | 1333 const GLsizei kWidth = 4; |
| 1222 const GLsizei kHeight = 8; | 1334 const GLsizei kHeight = 8; |
| 1223 const GLsizei kDepth = 4; | 1335 const GLsizei kDepth = 4; |
| 1224 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); | 1336 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); |
| 1225 ASSERT_TRUE(bucket != NULL); | 1337 ASSERT_TRUE(bucket != NULL); |
| (...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4219 // TODO(gman): CompressedTexSubImage2DImmediate | 4331 // TODO(gman): CompressedTexSubImage2DImmediate |
| 4220 | 4332 |
| 4221 // TODO(gman): TexImage2D | 4333 // TODO(gman): TexImage2D |
| 4222 | 4334 |
| 4223 // TODO(gman): TexImage2DImmediate | 4335 // TODO(gman): TexImage2DImmediate |
| 4224 | 4336 |
| 4225 // TODO(gman): TexSubImage2DImmediate | 4337 // TODO(gman): TexSubImage2DImmediate |
| 4226 | 4338 |
| 4227 } // namespace gles2 | 4339 } // namespace gles2 |
| 4228 } // namespace gpu | 4340 } // namespace gpu |
| OLD | NEW |