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

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: use RGBA8_OES for ES2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4392f9e8b4b141a53dfaf653e5404cadee6e4eaf..c88e13a01c036ca10776c39404b8a4ae0a39da95 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -4332,6 +4332,55 @@ 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;
+ init.context_type = CONTEXT_TYPE_OPENGLES2;
+ InitDecoder(init);
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
+ EXPECT_CALL(*gl_, TexStorage2DEXT(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 2, 2))
+ .Times(1)
+ .RetiresOnSaturation();
+ TexStorage2DEXT cmd;
+ cmd.Init(GL_TEXTURE_2D, 2, GL_RGBA8_OES, 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) {
+ InitState init;
+ init.gl_version = "OpenGL ES 3.0";
+ init.bind_generates_resource = true;
+ init.context_type = CONTEXT_TYPE_OPENGLES3;
+ 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_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))
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698