Hash :
0d3683c4
Author :
Date :
2014-10-23T11:08:16
Update ANGLE_platform_angle to allow requesting of Renderer versions. Added enums to allow users to request major and minor versions of the underlying API and if a WARP device is used. BUG=angle:490 Change-Id: I0bfb2ac8d327da28a47cc8e6346300e47ab9538c Reviewed-on: https://chromium-review.googlesource.com/225081 Reviewed-by: Shannon Woods <shannonwoods@chromium.org> Tested-by: 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
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_TYPED_TEST_CASE(SRGBTextureTest, ES2_D3D9, ES2_D3D11, ES3_D3D11);
template<typename T>
class SRGBTextureTest : public ANGLETest
{
protected:
SRGBTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{
setWindowWidth(128);
setWindowHeight(128);
setConfigRedBits(8);
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
}
virtual void SetUp()
{
ANGLETest::SetUp();
}
virtual void TearDown()
{
ANGLETest::TearDown();
}
};
TYPED_TEST(SRGBTextureTest, SRGBValidation)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
GLuint tex = 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
GLubyte pixel[3] = { 0 };
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB, 1, 1, 0, GL_SRGB, GL_UNSIGNED_BYTE, pixel);
if (supported)
{
EXPECT_GL_NO_ERROR();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_SRGB, GL_UNSIGNED_BYTE, pixel);
EXPECT_GL_NO_ERROR();
glGenerateMipmap(GL_TEXTURE_2D);
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
else
{
EXPECT_GL_ERROR(GL_INVALID_ENUM);
}
glDeleteTextures(1, &tex);
}
TYPED_TEST(SRGBTextureTest, SRGBAValidation)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
GLuint tex = 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
GLubyte pixel[4] = { 0 };
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE, pixel);
if (supported)
{
EXPECT_GL_NO_ERROR();
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE, pixel);
EXPECT_GL_NO_ERROR();
glGenerateMipmap(GL_TEXTURE_2D);
if (getClientVersion() == 2)
{
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
else
{
EXPECT_GL_NO_ERROR();
}
}
else
{
EXPECT_GL_ERROR(GL_INVALID_ENUM);
}
glDeleteTextures(1, &tex);
}
TYPED_TEST(SRGBTextureTest, SRGBARenderbuffer)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
GLuint rbo = 0;
glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_SRGB8_ALPHA8_EXT, 1, 1);
if (supported)
{
EXPECT_GL_NO_ERROR();
}
else
{
EXPECT_GL_ERROR(GL_INVALID_ENUM);
// Make sure the rbo has a size for future tests
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8_OES, 1, 1);
EXPECT_GL_NO_ERROR();
}
GLuint fbo = 0;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
EXPECT_GL_NO_ERROR();
GLint colorEncoding = 0;
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT, &colorEncoding);
if (supported)
{
EXPECT_GL_NO_ERROR();
EXPECT_EQ(GL_SRGB_EXT, colorEncoding);
}
else
{
EXPECT_GL_ERROR(GL_INVALID_ENUM);
}
glDeleteFramebuffers(1, &fbo);
glDeleteRenderbuffers(1, &rbo);
}