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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
index 5b0036a401f9ade9f75317bf615e5a3475166810..1288368d52fedc13014031e676a530a0e6f293c4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -4338,6 +4338,56 @@ TEST_P(GLES2DecoderManualInitTest, TexStorageInvalidLevels) {
EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
}
+TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES2) {
+ InitState init;
+ init.gl_version = "OpenGL ES 2.0";
+ init.extensions = "GL_ARB_texture_storage";
+ init.bind_generates_resource = true;
+ InitDecoder(init);
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
+ EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2))
+ .Times(1)
+ .RetiresOnSaturation();
+ TexStorage2DEXT cmd;
+ cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ TextureRef* texture_ref =
+ group().texture_manager()->GetTexture(client_texture_id_);
+ Texture* texture = texture_ref->texture();
+ GLenum type;
+ GLenum internal_format;
+ EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
+ EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
+ EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
+}
+
+TEST_P(GLES2DecoderManualInitTest, TexStorageFormatAndTypeES3) {
+ base::CommandLine command_line(0, nullptr);
+ command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
+ InitState init;
+ init.gl_version = "OpenGL ES 3.0";
+ init.bind_generates_resource = true;
+ init.context_type = CONTEXT_TYPE_OPENGLES3;
+ InitDecoderWithCommandLine(init, &command_line);
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
+ EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2))
+ .Times(1)
+ .RetiresOnSaturation();
+ TexStorage2DEXT cmd;
+ cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8, 2, 2);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ TextureRef* texture_ref =
+ group().texture_manager()->GetTexture(client_texture_id_);
+ Texture* texture = texture_ref->texture();
+ GLenum type;
+ GLenum internal_format;
+ EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
+ EXPECT_EQ(static_cast<GLenum>(GL_RGBA8), internal_format);
+ EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
+}
+
TEST_P(GLES3DecoderTest, TexStorage3DValidArgs) {
DoBindTexture(GL_TEXTURE_3D, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*gl_, TexStorage3D(GL_TEXTURE_3D, 2, GL_RGB565, 4, 5, 6))

Powered by Google App Engine
This is Rietveld 408576698