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

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

Issue 2458103002: Set correct internalformat info for TexStorageEXT according context type (Closed)
Patch Set: Created 4 years, 1 month 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 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 4320 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 init.bind_generates_resource = true; 4331 init.bind_generates_resource = true;
4332 InitDecoder(init); 4332 InitDecoder(init);
4333 DoBindTexture(GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, 4333 DoBindTexture(GL_TEXTURE_RECTANGLE_ARB, client_texture_id_,
4334 kServiceTextureId); 4334 kServiceTextureId);
4335 TexStorage2DEXT cmd; 4335 TexStorage2DEXT cmd;
4336 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, 2, GL_RGBA8, 4, 4); 4336 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, 2, GL_RGBA8, 4, 4);
4337 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4337 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4338 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 4338 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
4339 } 4339 }
4340 4340
4341 TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES2) {
4342 InitState init;
4343 init.gl_version = "OpenGL ES 2.0";
4344 init.extensions = "GL_ARB_texture_storage";
4345 init.bind_generates_resource = true;
4346 InitDecoder(init);
4347 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4348 EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2))
4349 .Times(1)
4350 .RetiresOnSaturation();
4351 TexStorage2DEXT cmd;
4352 cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2);
4353 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4354 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4355 TextureRef* texture_ref =
4356 group().texture_manager()->GetTexture(client_texture_id_);
4357 Texture* texture = texture_ref->texture();
4358 GLenum type;
4359 GLenum internal_format;
4360 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
4361 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
4362 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
4363 }
4364
4365 TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES3) {
4366 base::CommandLine command_line(0, nullptr);
4367 command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
4368 InitState init;
4369 init.gl_version = "OpenGL ES 3.0";
4370 init.bind_generates_resource = true;
4371 init.context_type = CONTEXT_TYPE_OPENGLES3;
4372 InitDecoderWithCommandLine(init, &command_line);
4373 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
4374 EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2))
4375 .Times(1)
4376 .RetiresOnSaturation();
4377 TexStorage2DEXT cmd;
4378 cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2);
4379 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4380 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4381 TextureRef* texture_ref =
4382 group().texture_manager()->GetTexture(client_texture_id_);
4383 Texture* texture = texture_ref->texture();
4384 GLenum type;
4385 GLenum internal_format;
4386 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
4387 EXPECT_EQ(static_cast<GLenum>(GL_RGBA8), internal_format);
4388 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
4389 }
4390
4341 TEST_P(GLES3DecoderTest, TexStorage3DValidArgs) { 4391 TEST_P(GLES3DecoderTest, TexStorage3DValidArgs) {
4342 DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId); 4392 DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId);
4343 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6)) 4393 EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6))
4344 .Times(1) 4394 .Times(1)
4345 .RetiresOnSaturation(); 4395 .RetiresOnSaturation();
4346 TexStorage3D cmd; 4396 TexStorage3D cmd;
4347 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6); 4397 cmd.Init(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6);
4348 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4398 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4349 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4399 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4350 } 4400 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 // TODO(gman): CompressedTexSubImage2DImmediate 4739 // TODO(gman): CompressedTexSubImage2DImmediate
4690 4740
4691 // TODO(gman): TexImage2D 4741 // TODO(gman): TexImage2D
4692 4742
4693 // TODO(gman): TexImage2DImmediate 4743 // TODO(gman): TexImage2DImmediate
4694 4744
4695 // TODO(gman): TexSubImage2DImmediate 4745 // TODO(gman): TexSubImage2DImmediate
4696 4746
4697 } // namespace gles2 4747 } // namespace gles2
4698 } // namespace gpu 4748 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698