Hash :
e0cc2a4a
Author :
Date :
2016-01-20T10:58:17
Enable all angle_end2end_tests targeting OpenGL and OpenGL ES backends. Added failure supressions and filed bugs for failing tests. BUG=angleproject:1145 BUG=angleproject:1289 BUG=angleproject:1291 BUG=angleproject:1292 BUG=angleproject:1293 BUG=angleproject:1296 Change-Id: Ida78ba855500fe8a6ce6154d43ee01520330e3b1 Reviewed-on: https://chromium-review.googlesource.com/322695 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "test_utils/ANGLETest.h"
using namespace angle;
class DepthStencilFormatsTestBase : public ANGLETest
{
protected:
DepthStencilFormatsTestBase()
{
setWindowWidth(128);
setWindowHeight(128);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
bool checkTexImageFormatSupport(GLenum format, GLenum type)
{
EXPECT_GL_NO_ERROR();
GLuint tex = 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, format, 1, 1, 0, format, type, NULL);
glDeleteTextures(1, &tex);
return (glGetError() == GL_NO_ERROR);
}
bool checkTexStorageFormatSupport(GLenum internalFormat)
{
EXPECT_GL_NO_ERROR();
GLuint tex = 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
glDeleteTextures(1, &tex);
return (glGetError() == GL_NO_ERROR);
}
bool checkRenderbufferFormatSupport(GLenum internalFormat)
{
EXPECT_GL_NO_ERROR();
GLuint rb = 0;
glGenRenderbuffers(1, &rb);
glBindRenderbuffer(GL_RENDERBUFFER, rb);
glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, 1, 1);
glDeleteRenderbuffers(1, &rb);
return (glGetError() == GL_NO_ERROR);
}
virtual void SetUp()
{
ANGLETest::SetUp();
const std::string vertexShaderSource = SHADER_SOURCE
(
precision highp float;
attribute vec4 position;
varying vec2 texcoord;
void main()
{
gl_Position = position;
texcoord = (position.xy * 0.5) + 0.5;
}
);
const std::string fragmentShaderSource = SHADER_SOURCE
(
precision highp float;
uniform sampler2D tex;
varying vec2 texcoord;
void main()
{
gl_FragColor = texture2D(tex, texcoord);
}
);
mProgram = CompileProgram(vertexShaderSource, fragmentShaderSource);
if (mProgram == 0)
{
FAIL() << "shader compilation failed.";
}
mTextureUniformLocation = glGetUniformLocation(mProgram, "tex");
EXPECT_NE(-1, mTextureUniformLocation);
glGenTextures(1, &mTexture);
ASSERT_GL_NO_ERROR();
}
virtual void TearDown()
{
glDeleteProgram(mProgram);
glDeleteTextures(1, &mTexture);
ANGLETest::TearDown();
}
GLuint mProgram;
GLuint mTexture;
GLint mTextureUniformLocation;
};
class DepthStencilFormatsTest : public DepthStencilFormatsTestBase
{};
class DepthStencilFormatsTestES3 : public DepthStencilFormatsTestBase
{};
TEST_P(DepthStencilFormatsTest, DepthTexture)
{
bool shouldHaveTextureSupport = extensionEnabled("GL_ANGLE_depth_texture");
EXPECT_EQ(shouldHaveTextureSupport, checkTexImageFormatSupport(GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT));
EXPECT_EQ(shouldHaveTextureSupport, checkTexImageFormatSupport(GL_DEPTH_COMPONENT, GL_UNSIGNED_INT));
if (extensionEnabled("GL_EXT_texture_storage"))
{
EXPECT_EQ(shouldHaveTextureSupport, checkTexStorageFormatSupport(GL_DEPTH_COMPONENT16));
EXPECT_EQ(shouldHaveTextureSupport, checkTexStorageFormatSupport(GL_DEPTH_COMPONENT32_OES));
}
}
TEST_P(DepthStencilFormatsTest, PackedDepthStencil)
{
// Expected to fail in D3D9 if GL_OES_packed_depth_stencil is not present.
// Expected to fail in D3D11 if GL_OES_packed_depth_stencil or GL_ANGLE_depth_texture is not present.
bool shouldHaveRenderbufferSupport = extensionEnabled("GL_OES_packed_depth_stencil");
EXPECT_EQ(shouldHaveRenderbufferSupport, checkRenderbufferFormatSupport(GL_DEPTH24_STENCIL8_OES));
bool shouldHaveTextureSupport = extensionEnabled("GL_OES_packed_depth_stencil") &&
extensionEnabled("GL_ANGLE_depth_texture");
EXPECT_EQ(shouldHaveTextureSupport, checkTexImageFormatSupport(GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES));
if (extensionEnabled("GL_EXT_texture_storage"))
{
EXPECT_EQ(shouldHaveTextureSupport, checkTexStorageFormatSupport(GL_DEPTH24_STENCIL8_OES));
}
}
TEST_P(DepthStencilFormatsTestES3, DrawWithDepthStencil)
{
GLushort data[16];
for (unsigned int i = 0; i < 16; i++)
{
data[i] = std::numeric_limits<GLushort>::max();
}
glBindTexture(GL_TEXTURE_2D, mTexture);
glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT16, 4, 4);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glUseProgram(mProgram);
glUniform1i(mTextureUniformLocation, 0);
glClear(GL_COLOR_BUFFER_BIT);
drawQuad(mProgram, "position", 0.5f);
ASSERT_GL_NO_ERROR();
GLubyte pixel[4];
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
// Only require the red and alpha channels have the correct values, the depth texture extensions
// leave the green and blue channels undefined
ASSERT_NEAR(255, pixel[0], 2.0);
ASSERT_EQ(255, pixel[3]);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_OPENGL(),
ES2_OPENGLES());
ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());