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 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 init.bind_generates_resource = true; | 4325 init.bind_generates_resource = true; |
4326 InitDecoder(init); | 4326 InitDecoder(init); |
4327 DoBindTexture(GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, | 4327 DoBindTexture(GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, |
4328 kServiceTextureId); | 4328 kServiceTextureId); |
4329 TexStorage2DEXT cmd; | 4329 TexStorage2DEXT cmd; |
4330 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, 2, GL_RGBA8, 4, 4); | 4330 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, 2, GL_RGBA8, 4, 4); |
4331 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4331 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4332 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 4332 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
4333 } | 4333 } |
4334 | 4334 |
| 4335 TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES2) { |
| 4336 InitState init; |
| 4337 init.gl_version = "OpenGL ES 2.0"; |
| 4338 init.extensions = "GL_ARB_texture_storage"; |
| 4339 init.bind_generates_resource = true; |
| 4340 init.context_type = CONTEXT_TYPE_OPENGLES2; |
| 4341 InitDecoder(init); |
| 4342 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4343 EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 2, 2)) |
| 4344 .Times(1) |
| 4345 .RetiresOnSaturation(); |
| 4346 TexStorage2DEXT cmd; |
| 4347 cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 2, 2); |
| 4348 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4349 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4350 TextureRef* texture_ref = |
| 4351 group().texture_manager()->GetTexture(client_texture_id_); |
| 4352 Texture* texture = texture_ref->texture(); |
| 4353 GLenum type; |
| 4354 GLenum internal_format; |
| 4355 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 4356 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 4357 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 4358 } |
| 4359 |
| 4360 TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES3) { |
| 4361 InitState init; |
| 4362 init.gl_version = "OpenGL ES 3.0"; |
| 4363 init.bind_generates_resource = true; |
| 4364 init.context_type = CONTEXT_TYPE_OPENGLES3; |
| 4365 InitDecoder(init); |
| 4366 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 4367 EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2)) |
| 4368 .Times(1) |
| 4369 .RetiresOnSaturation(); |
| 4370 TexStorage2DEXT cmd; |
| 4371 cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2); |
| 4372 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4373 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4374 TextureRef* texture_ref = |
| 4375 group().texture_manager()->GetTexture(client_texture_id_); |
| 4376 Texture* texture = texture_ref->texture(); |
| 4377 GLenum type; |
| 4378 GLenum internal_format; |
| 4379 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 4380 EXPECT_EQ(static_cast<GLenum>(GL_RGBA8), internal_format); |
| 4381 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 4382 } |
| 4383 |
4335 TEST_P(GLES3DecoderTest, TexStorage3DValidArgs) { | 4384 TEST_P(GLES3DecoderTest, TexStorage3DValidArgs) { |
4336 DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId); | 4385 DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId); |
4337 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6)) | 4386 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6)) |
4338 .Times(1) | 4387 .Times(1) |
4339 .RetiresOnSaturation(); | 4388 .RetiresOnSaturation(); |
4340 TexStorage3D cmd; | 4389 TexStorage3D cmd; |
4341 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6); | 4390 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6); |
4342 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4391 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
4343 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4392 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
4344 } | 4393 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4683 // TODO(gman): CompressedTexSubImage2DImmediate | 4732 // TODO(gman): CompressedTexSubImage2DImmediate |
4684 | 4733 |
4685 // TODO(gman): TexImage2D | 4734 // TODO(gman): TexImage2D |
4686 | 4735 |
4687 // TODO(gman): TexImage2DImmediate | 4736 // TODO(gman): TexImage2DImmediate |
4688 | 4737 |
4689 // TODO(gman): TexSubImage2DImmediate | 4738 // TODO(gman): TexSubImage2DImmediate |
4690 | 4739 |
4691 } // namespace gles2 | 4740 } // namespace gles2 |
4692 } // namespace gpu | 4741 } // namespace gpu |
OLD | NEW |