Path: blob/main_old/src/tests/gl_tests/DepthStencilTest.cpp
1693 views
//1// Copyright 2018 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//5// DepthStencilTest:6// Tests covering depth- or stencil-only rendering to make sure the other non-existing aspect is7// not affecting the results (since the format may be emulated with one that has both aspects).8//910#include "test_utils/ANGLETest.h"1112#include "platform/FeaturesVk.h"13#include "test_utils/gl_raii.h"1415using namespace angle;1617namespace18{1920class DepthStencilTest : public ANGLETest21{22protected:23DepthStencilTest()24{25setWindowWidth(128);26setWindowHeight(128);27setConfigRedBits(8);28setConfigGreenBits(8);29setConfigBlueBits(8);30setConfigAlphaBits(8);31setConfigDepthBits(24);32setConfigStencilBits(8);33}3435void testSetUp() override36{37glBindTexture(GL_TEXTURE_2D, mColorTexture);38glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA,39GL_UNSIGNED_BYTE, nullptr);4041// Setup Color/Stencil FBO with a stencil format that's emulated with packed depth/stencil.42glBindFramebuffer(GL_FRAMEBUFFER, mColorStencilFBO);4344glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mColorTexture,450);46glBindRenderbuffer(GL_RENDERBUFFER, mStencilTexture);47glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, getWindowWidth(),48getWindowHeight());49glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,50mStencilTexture);5152ASSERT_GL_NO_ERROR();5354// Note: GL_DEPTH_COMPONENT24 is allowed in GLES2 with GL_OES_depth24 extension.55if (getClientMajorVersion() >= 3 || IsGLExtensionEnabled("GL_OES_depth24"))56{57// Setup Color/Depth FBO with a depth format that's emulated with packed depth/stencil.58glBindFramebuffer(GL_FRAMEBUFFER, mColorDepthFBO);5960glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,61mColorTexture, 0);62glBindRenderbuffer(GL_RENDERBUFFER, mDepthTexture);63glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, getWindowWidth(),64getWindowHeight());65glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,66mDepthTexture);67}6869ASSERT_GL_NO_ERROR();70}7172void bindColorStencilFBO()73{74glBindFramebuffer(GL_FRAMEBUFFER, mColorStencilFBO);75mHasDepth = false;76}7778void bindColorDepthFBO()79{80glBindFramebuffer(GL_FRAMEBUFFER, mColorDepthFBO);81mHasStencil = false;82}8384// Override a feature to force emulation of stencil-only and depth-only formats with a packed85// depth/stencil format86void overrideFeaturesVk(FeaturesVk *featuresVk) override87{88featuresVk->overrideFeatures({"force_fallback_format"}, true);89}9091void prepareSingleEmulatedWithPacked();92void ensureColor(GLColor color);93void ensureDepthUnaffected();94void ensureStencilUnaffected();9596private:97GLFramebuffer mColorStencilFBO;98GLFramebuffer mColorDepthFBO;99GLTexture mColorTexture;100GLRenderbuffer mDepthTexture;101GLRenderbuffer mStencilTexture;102103bool mHasDepth = true;104bool mHasStencil = true;105};106107class DepthStencilTestES3 : public DepthStencilTest108{109protected:110void compareDepth(uint32_t expected);111void clearAndCompareDepth(GLfloat depth, uint32_t expected);112void drawAndCompareDepth(GLProgram &program, GLfloat depth, uint32_t expected);113};114115void DepthStencilTest::ensureColor(GLColor color)116{117const int width = getWindowWidth();118const int height = getWindowHeight();119120std::vector<GLColor> pixelData(width * height);121glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixelData.data());122123for (int i = 0; i < width * height; i += 16)124{125GLColor actualColor = pixelData[i];126EXPECT_NEAR(color.R, actualColor.R, 1);127EXPECT_NEAR(color.G, actualColor.G, 1);128EXPECT_NEAR(color.B, actualColor.B, 1);129EXPECT_NEAR(color.A, actualColor.A, 1);130131if (i % width == 0)132i += 16 * width;133}134}135136void DepthStencilTest::ensureDepthUnaffected()137{138ANGLE_GL_PROGRAM(depthTestProgram, essl1_shaders::vs::Passthrough(), essl1_shaders::fs::Blue());139glEnable(GL_DEPTH_TEST);140glDepthFunc(GL_EQUAL);141drawQuad(depthTestProgram, essl1_shaders::PositionAttrib(), 0.123f);142glDisable(GL_DEPTH_TEST);143ASSERT_GL_NO_ERROR();144145// Since depth shouldn't exist, the drawQuad above should succeed in turning the whole image146// blue.147ensureColor(GLColor::blue);148}149150void DepthStencilTest::ensureStencilUnaffected()151{152ANGLE_GL_PROGRAM(stencilTestProgram, essl1_shaders::vs::Passthrough(),153essl1_shaders::fs::Green());154glEnable(GL_STENCIL_TEST);155glStencilFunc(GL_EQUAL, 0x1B, 0xFF);156drawQuad(stencilTestProgram, essl1_shaders::PositionAttrib(), 0.0f);157glDisable(GL_STENCIL_TEST);158ASSERT_GL_NO_ERROR();159160// Since stencil shouldn't exist, the drawQuad above should succeed in turning the whole image161// green.162ensureColor(GLColor::green);163}164165void DepthStencilTest::prepareSingleEmulatedWithPacked()166{167const int w = getWindowWidth();168const int h = getWindowHeight();169const int whalf = w >> 1;170const int hhalf = h >> 1;171172// Clear to a random color, 0.75 depth and 0x36 stencil173Vector4 color1(0.1f, 0.2f, 0.3f, 0.4f);174GLColor color1RGB(color1);175176glClearColor(color1[0], color1[1], color1[2], color1[3]);177glClearDepthf(0.75f);178glClearStencil(0x36);179glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);180ASSERT_GL_NO_ERROR();181182// Verify color was cleared correctly.183EXPECT_PIXEL_COLOR_NEAR(0, 0, color1RGB, 1);184185// Use masked color to clear two channels of the image to a second color, 0.25 depth and 0x59186// stencil.187Vector4 color2(0.2f, 0.4f, 0.6f, 0.8f);188glClearColor(color2[0], color2[1], color2[2], color2[3]);189glClearDepthf(0.25f);190glClearStencil(0x59);191glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_FALSE);192glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);193glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);194ASSERT_GL_NO_ERROR();195196GLColor color2RGB(Vector4(color2[0], color1[1], color2[2], color1[3]));197198EXPECT_PIXEL_COLOR_NEAR(whalf, hhalf, color2RGB, 1);199200EXPECT_PIXEL_COLOR_NEAR(0, 0, color2RGB, 1);201EXPECT_PIXEL_COLOR_NEAR(w - 1, 0, color2RGB, 1);202EXPECT_PIXEL_COLOR_NEAR(0, h - 1, color2RGB, 1);203EXPECT_PIXEL_COLOR_NEAR(w - 1, h - 1, color2RGB, 1);204205// Use scissor to clear the center to a third color, 0.5 depth and 0xA9 stencil.206glEnable(GL_SCISSOR_TEST);207glScissor(whalf / 2, hhalf / 2, whalf, hhalf);208209Vector4 color3(0.3f, 0.5f, 0.7f, 0.9f);210GLColor color3RGB(color3);211glClearColor(color3[0], color3[1], color3[2], color3[3]);212glClearDepthf(0.5f);213glClearStencil(0xA9);214glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);215glDisable(GL_SCISSOR_TEST);216ASSERT_GL_NO_ERROR();217218EXPECT_PIXEL_COLOR_NEAR(whalf, hhalf, color3RGB, 1);219220EXPECT_PIXEL_COLOR_NEAR(0, 0, color2RGB, 1);221EXPECT_PIXEL_COLOR_NEAR(w - 1, 0, color2RGB, 1);222EXPECT_PIXEL_COLOR_NEAR(0, h - 1, color2RGB, 1);223EXPECT_PIXEL_COLOR_NEAR(w - 1, h - 1, color2RGB, 1);224225// Use scissor to draw to the right half of the image with a fourth color, 0.6 depth and 0x84226// stencil.227glEnable(GL_SCISSOR_TEST);228glScissor(whalf, 0, whalf, h);229230ANGLE_GL_PROGRAM(redProgram, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());231glEnable(GL_STENCIL_TEST);232glStencilFunc(GL_ALWAYS, 0x84, 0xFF);233glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);234glStencilMask(0xFF);235drawQuad(redProgram, essl1_shaders::PositionAttrib(), 0.2f);236237glDisable(GL_STENCIL_TEST);238glDisable(GL_SCISSOR_TEST);239}240241// Tests that clearing or rendering into a depth-only format doesn't affect stencil.242TEST_P(DepthStencilTest, DepthOnlyEmulatedWithPacked)243{244ANGLE_SKIP_TEST_IF(getClientMajorVersion() < 3 && !IsGLExtensionEnabled("GL_OES_depth24"));245246bindColorDepthFBO();247prepareSingleEmulatedWithPacked();248ensureStencilUnaffected();249}250251// Tests that clearing or rendering into a stencil-only format doesn't affect depth.252TEST_P(DepthStencilTest, StencilOnlyEmulatedWithPacked)253{254// http://anglebug.com/4092255ANGLE_SKIP_TEST_IF(IsWindows() && IsD3D9());256bindColorStencilFBO();257prepareSingleEmulatedWithPacked();258ensureDepthUnaffected();259}260261// Tests that clearing depth/stencil followed by draw works when the depth/stencil attachment is a262// texture.263TEST_P(DepthStencilTestES3, ClearThenDraw)264{265GLFramebuffer FBO;266glBindFramebuffer(GL_FRAMEBUFFER, FBO);267268constexpr GLsizei kSize = 6;269270// Create framebuffer to draw into, with both color and depth attachments.271GLTexture color;272glBindTexture(GL_TEXTURE_2D, color);273glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kSize, kSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);274275GLTexture depth;276glBindTexture(GL_TEXTURE_2D, depth);277glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, kSize, kSize, 0, GL_DEPTH_STENCIL,278GL_UNSIGNED_INT_24_8_OES, nullptr);279280GLFramebuffer fbo;281glBindFramebuffer(GL_FRAMEBUFFER, fbo);282glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color, 0);283glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, depth, 0);284ASSERT_GL_NO_ERROR();285286// Set viewport and clear depth/stencil287glViewport(0, 0, kSize, kSize);288glClearDepthf(1);289glClearStencil(0x55);290glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);291292// If depth is not cleared to 1, rendering would fail.293glEnable(GL_DEPTH_TEST);294glDepthFunc(GL_LESS);295296// If stencil is not clear to 0x55, rendering would fail.297glEnable(GL_STENCIL_TEST);298glStencilFunc(GL_EQUAL, 0x55, 0xFF);299glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);300glStencilMask(0xFF);301302// Set up program303ANGLE_GL_PROGRAM(drawRed, essl1_shaders::vs::Simple(), essl1_shaders::fs::Red());304305// Draw red306drawQuad(drawRed, essl1_shaders::PositionAttrib(), 0.0f);307ASSERT_GL_NO_ERROR();308309// Verify.310EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);311EXPECT_PIXEL_COLOR_EQ(kSize - 1, 0, GLColor::red);312EXPECT_PIXEL_COLOR_EQ(0, kSize - 1, GLColor::red);313EXPECT_PIXEL_COLOR_EQ(kSize - 1, kSize - 1, GLColor::red);314}315316void DepthStencilTestES3::compareDepth(uint32_t expected)317{318uint32_t pixel;319glReadPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &pixel);320ASSERT_GL_NO_ERROR();321322// Right shift by 8 bits to only compare 24 depth bits323// and ignore 8 undefined bits.324pixel = pixel >> 8;325326EXPECT_NEAR(pixel, expected, 1);327}328329void DepthStencilTestES3::clearAndCompareDepth(GLfloat depth, uint32_t expected)330{331glClearDepthf(depth);332glClear(GL_DEPTH_BUFFER_BIT);333compareDepth(expected);334}335336void DepthStencilTestES3::drawAndCompareDepth(GLProgram &program,337GLfloat positionZ,338uint32_t expected)339{340glEnable(GL_DEPTH_TEST);341glDepthFunc(GL_ALWAYS);342drawQuad(program, essl3_shaders::PositionAttrib(), positionZ, 1.0f);343glDisable(GL_DEPTH_TEST);344compareDepth(expected);345}346347TEST_P(DepthStencilTestES3, ReadPixelsDepth24)348{349ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_depth24") ||350!IsGLExtensionEnabled("GL_NV_read_depth"));351352// The test fails on native GLES on Android in glReadPixels353// with GL_INVALID_OPERATION due to the format/type combination354// not being supported.355ANGLE_SKIP_TEST_IF(IsAndroid() && IsOpenGLES());356357// Create GL_DEPTH_COMPONENT24 texture358GLTexture depthTexture;359glBindTexture(GL_TEXTURE_2D, depthTexture);360glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, getWindowWidth(), getWindowHeight(), 0,361GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, nullptr);362363// Set up framebuffer364GLFramebuffer depthFBO;365GLRenderbuffer depthRenderbuffer;366367glBindFramebuffer(GL_FRAMEBUFFER, depthFBO);368369glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);370glBindRenderbuffer(GL_RENDERBUFFER, depthRenderbuffer);371glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, getWindowWidth(),372getWindowHeight());373glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER,374depthRenderbuffer);375376ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);377ASSERT_GL_NO_ERROR();378379// Test clear380clearAndCompareDepth(0.0f, 0x0);381clearAndCompareDepth(0.125f, 0x200000);382clearAndCompareDepth(0.5f, 0x800000);383clearAndCompareDepth(1.0f, 0xffffff);384385// Test draw386ANGLE_GL_PROGRAM(depthTestProgram, essl3_shaders::vs::Simple(), essl3_shaders::fs::Green());387drawAndCompareDepth(depthTestProgram, 0.0f, 0x800000);388drawAndCompareDepth(depthTestProgram, 0.125f, 0x8fffff);389drawAndCompareDepth(depthTestProgram, 0.5f, 0xbfffff);390drawAndCompareDepth(depthTestProgram, 1.0f, 0xffffff);391392ASSERT_GL_NO_ERROR();393}394395// Tests that the stencil test is correctly handled when a framebuffer is cleared before that396// framebuffer's stencil attachment has been configured.397TEST_P(DepthStencilTestES3, FramebufferClearThenStencilAttachedThenStencilTestState)398{399ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_NV_read_stencil"));400401GLFramebuffer fbo;402glBindFramebuffer(GL_FRAMEBUFFER, fbo);403404GLRenderbuffer colorRbo;405glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);406glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, getWindowWidth(), getWindowHeight());407glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);408glClearColor(0.f, 0.f, 0.f, 0.f);409glClear(GL_COLOR_BUFFER_BIT);410411GLRenderbuffer stencilRbo;412glBindRenderbuffer(GL_RENDERBUFFER, stencilRbo);413glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, getWindowWidth(), getWindowHeight());414glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencilRbo);415glClearStencil(2);416glClear(GL_STENCIL_BUFFER_BIT);417418ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);419ASSERT_GL_NO_ERROR();420421EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::transparentBlack);422EXPECT_PIXEL_STENCIL_EQ(0, 0, 2);423424ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());425426GLint colorLocation = glGetUniformLocation(program, angle::essl1_shaders::ColorUniform());427ASSERT_NE(-1, colorLocation);428429glUseProgram(program);430glUniform4f(colorLocation, 1.0f, 0.0f, 0.0f, 1.0f);431432glEnable(GL_STENCIL_TEST);433glStencilFunc(GL_ALWAYS, 0, 0xFF);434glStencilOp(GL_KEEP, GL_INCR, GL_INCR);435drawQuad(program, "a_position", 0.5f);436437EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);438EXPECT_PIXEL_STENCIL_EQ(0, 0, 3);439}440441// Tests that the stencil test is correctly handled when both the stencil test state is configured442// and a framebuffer is cleared before that framebuffer's stencil attachment has been configured.443TEST_P(DepthStencilTestES3, StencilTestStateThenFramebufferClearThenStencilAttached)444{445ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_NV_read_stencil"));446447glEnable(GL_STENCIL_TEST);448glStencilFunc(GL_ALWAYS, 0, 0xFF);449glStencilOp(GL_KEEP, GL_INCR, GL_INCR);450451GLFramebuffer fbo;452glBindFramebuffer(GL_FRAMEBUFFER, fbo);453454GLRenderbuffer colorRbo;455glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);456glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, getWindowWidth(), getWindowHeight());457glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);458glClearColor(0.f, 0.f, 0.f, 0.f);459glClear(GL_COLOR_BUFFER_BIT);460461GLRenderbuffer stencilRbo;462glBindRenderbuffer(GL_RENDERBUFFER, stencilRbo);463glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, getWindowWidth(), getWindowHeight());464glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencilRbo);465glClearStencil(2);466glClear(GL_STENCIL_BUFFER_BIT);467468ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);469ASSERT_GL_NO_ERROR();470471EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::transparentBlack);472EXPECT_PIXEL_STENCIL_EQ(0, 0, 2);473474ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());475476GLint colorLocation = glGetUniformLocation(program, angle::essl1_shaders::ColorUniform());477ASSERT_NE(-1, colorLocation);478479glUseProgram(program);480glUniform4f(colorLocation, 1.0f, 0.0f, 0.0f, 1.0f);481482drawQuad(program, "a_position", 0.5f);483484EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);485EXPECT_PIXEL_STENCIL_EQ(0, 0, 3);486}487488// Tests that the stencil test is correctly handled when a framebuffer is cleared before that489// framebuffer's stencil attachment has been configured and the stencil test state is configured490// during framebuffer setup.491TEST_P(DepthStencilTestES3, FramebufferClearThenStencilTestStateThenStencilAttached)492{493ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_NV_read_stencil"));494495GLFramebuffer fbo;496glBindFramebuffer(GL_FRAMEBUFFER, fbo);497498GLRenderbuffer colorRbo;499glBindRenderbuffer(GL_RENDERBUFFER, colorRbo);500glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, getWindowWidth(), getWindowHeight());501glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRbo);502glClearColor(0.f, 0.f, 0.f, 0.f);503glClear(GL_COLOR_BUFFER_BIT);504505glEnable(GL_STENCIL_TEST);506glStencilFunc(GL_ALWAYS, 0, 0xFF);507glStencilOp(GL_KEEP, GL_INCR, GL_INCR);508509GLRenderbuffer stencilRbo;510glBindRenderbuffer(GL_RENDERBUFFER, stencilRbo);511glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, getWindowWidth(), getWindowHeight());512glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, stencilRbo);513glClearStencil(2);514glClear(GL_STENCIL_BUFFER_BIT);515516ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);517ASSERT_GL_NO_ERROR();518519EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::transparentBlack);520EXPECT_PIXEL_STENCIL_EQ(0, 0, 2);521522ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), essl1_shaders::fs::UniformColor());523524GLint colorLocation = glGetUniformLocation(program, angle::essl1_shaders::ColorUniform());525ASSERT_NE(-1, colorLocation);526527glUseProgram(program);528glUniform4f(colorLocation, 1.0f, 0.0f, 0.0f, 1.0f);529530drawQuad(program, "a_position", 0.5f);531532EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);533EXPECT_PIXEL_STENCIL_EQ(0, 0, 3);534}535536ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(DepthStencilTest);537538GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DepthStencilTestES3);539ANGLE_INSTANTIATE_TEST_ES3(DepthStencilTestES3);540541} // anonymous namespace542543544