Test drawing with a shader with two different sampler types
This adds some test coverage that's missing from dEQP.
The test uses two different samplers in a shader, a cube map sampler
and a 2D texture sampler, adds the sampling results together and checks
if the result is correct.
BUG=angleproject:1261
TEST=angle_end2end_tests
Change-Id: If21e24c964fc208b5d1ccd446834dabf13194944
Reviewed-on: https://chromium-review.googlesource.com/321621
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index d24247a..cddb415 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -444,6 +444,38 @@
EXPECT_GL_NO_ERROR();
}
+// Test drawing with two texture types accessed from the same shader and check that the result of
+// drawing is correct.
+TEST_P(TextureCubeTest, CubeMapDraw)
+{
+ GLubyte texData[4];
+ texData[0] = 0;
+ texData[1] = 60;
+ texData[2] = 0;
+ texData[3] = 255;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, mTexture2D);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, texData);
+
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_CUBE_MAP, mTextureCube);
+ texData[1] = 120;
+ glTexSubImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+ texData);
+ EXPECT_GL_ERROR(GL_NO_ERROR);
+
+ glUseProgram(mProgram);
+ glUniform1i(mTexture2DUniformLocation, 0);
+ glUniform1i(mTextureCubeUniformLocation, 1);
+ drawQuad(mProgram, "position", 0.5f);
+ EXPECT_GL_NO_ERROR();
+
+ int px = getWindowWidth() - 1;
+ int py = 0;
+ EXPECT_PIXEL_NEAR(px, py, 0, 180, 0, 255, 2);
+}
+
// Copy of a test in conformance/textures/texture-mips, to test generate mipmaps
TEST_P(Texture2DTestWithDrawScale, MipmapsTwice)
{