Commit 18b931d5 by Austin Kinross Committed by Geoff Lang

Configure Google Tests to run against multiple renderers/GLES versions

BUG=angle:611 Change-Id: I7d43612171c439045038db9ae82fd8716c0b31c6 Reviewed-on: https://chromium-review.googlesource.com/220400Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarAustin Kinross <aukinros@microsoft.com>
parent 3269bcb4
......@@ -4,14 +4,28 @@
OSWindow *ANGLETest::mOSWindow = NULL;
ANGLETest::ANGLETest()
: mEGLWindow(NULL)
ANGLETest::ANGLETest(EGLint glesMajorVersion, EGLint requestedRenderer)
: mEGLWindow(NULL),
mRequestedRenderer(requestedRenderer)
{
mEGLWindow = new EGLWindow(1280, 720, 2, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
mEGLWindow = new EGLWindow(1280, 720, glesMajorVersion, requestedRenderer);
}
void ANGLETest::SetUp()
{
// As per the spec for ANGLE_platform_angle, the value of EGL_PLATFORM_ANGLE_TYPE_ANGLE is ignored if an EGLDisplay
// was previously created for any value of EGLNativeDisplayType.
// As a result, if we wish to request a different display type then we need to recreate the OS Window.
if (mOSWindow->getRequestedRenderer() != EGL_NONE && mOSWindow->getRequestedRenderer() != mRequestedRenderer)
{
ANGLETest::DestroyTestWindow();
if (!ANGLETest::InitTestWindow())
{
FAIL() << "Failed to create ANGLE test window.";
}
}
ResizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight());
if (!createEGLContext())
{
......@@ -107,11 +121,6 @@ bool ANGLETest::extensionEnabled(const std::string &extName)
return strstr(extString, extName.c_str()) != NULL;
}
void ANGLETest::setClientVersion(int clientVersion)
{
mEGLWindow->setClientVersion(clientVersion);
}
void ANGLETest::setWindowWidth(int width)
{
mEGLWindow->setWidth(width);
......
......@@ -17,6 +17,8 @@
#include "shared_utils.h"
#include "shader_utils.h"
#include "testfixturetypes.h"
#define EXPECT_GL_ERROR(err) EXPECT_EQ((err), glGetError())
#define EXPECT_GL_NO_ERROR() EXPECT_GL_ERROR(GL_NO_ERROR)
......@@ -40,7 +42,7 @@ class OSWindow;
class ANGLETest : public testing::Test
{
protected:
ANGLETest();
ANGLETest(EGLint requestedRenderer, EGLint glesMajorVersion);
public:
static bool InitTestWindow();
......@@ -57,7 +59,6 @@ class ANGLETest : public testing::Test
static GLuint compileShader(GLenum type, const std::string &source);
static bool extensionEnabled(const std::string &extName);
void setClientVersion(int clientVersion);
void setWindowWidth(int width);
void setWindowHeight(int height);
void setConfigRedBits(int bits);
......@@ -79,6 +80,8 @@ class ANGLETest : public testing::Test
EGLWindow *mEGLWindow;
EGLint mRequestedRenderer;
static OSWindow *mOSWindow;
};
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D9>, TFT<Gles::Two, Rend::D3D11>> TestFixtureTypes;
TYPED_TEST_CASE(BlendMinMaxTest, TestFixtureTypes);
template<typename T>
class BlendMinMaxTest : public ANGLETest
{
protected:
BlendMinMaxTest()
BlendMinMaxTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -136,19 +141,19 @@ protected:
GLuint mColorRenderbuffer;
};
TEST_F(BlendMinMaxTest, RGBA8)
TYPED_TEST(BlendMinMaxTest, RGBA8)
{
SetUpFramebuffer(GL_RGBA8);
runTest();
}
TEST_F(BlendMinMaxTest, RGBA32f)
TYPED_TEST(BlendMinMaxTest, RGBA32f)
{
SetUpFramebuffer(GL_RGBA32F);
runTest();
}
TEST_F(BlendMinMaxTest, RGBA16F)
TYPED_TEST(BlendMinMaxTest, RGBA16F)
{
SetUpFramebuffer(GL_RGBA16F);
runTest();
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(BlitFramebufferANGLETest, TestFixtureTypes);
template<typename T>
class BlitFramebufferANGLETest : public ANGLETest
{
protected:
BlitFramebufferANGLETest()
BlitFramebufferANGLETest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(256);
setWindowHeight(256);
......@@ -302,7 +307,7 @@ protected:
};
// Draw to user-created framebuffer, blit whole-buffer color to original framebuffer.
TEST_F(BlitFramebufferANGLETest, BlitColorToDefault)
TYPED_TEST(BlitFramebufferANGLETest, BlitColorToDefault)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -329,7 +334,7 @@ TEST_F(BlitFramebufferANGLETest, BlitColorToDefault)
}
// Draw to system framebuffer, blit whole-buffer color to user-created framebuffer.
TEST_F(BlitFramebufferANGLETest, ReverseColorBlit)
TYPED_TEST(BlitFramebufferANGLETest, ReverseColorBlit)
{
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
......@@ -356,7 +361,7 @@ TEST_F(BlitFramebufferANGLETest, ReverseColorBlit)
}
// blit from user-created FBO to system framebuffer, with the scissor test enabled.
TEST_F(BlitFramebufferANGLETest, ScissoredBlit)
TYPED_TEST(BlitFramebufferANGLETest, ScissoredBlit)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -391,7 +396,7 @@ TEST_F(BlitFramebufferANGLETest, ScissoredBlit)
}
// blit from system FBO to user-created framebuffer, with the scissor test enabled.
TEST_F(BlitFramebufferANGLETest, ReverseScissoredBlit)
TYPED_TEST(BlitFramebufferANGLETest, ReverseScissoredBlit)
{
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
......@@ -426,7 +431,7 @@ TEST_F(BlitFramebufferANGLETest, ReverseScissoredBlit)
}
// blit from user-created FBO to system framebuffer, using region larger than buffer.
TEST_F(BlitFramebufferANGLETest, OversizedBlit)
TYPED_TEST(BlitFramebufferANGLETest, OversizedBlit)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -456,7 +461,7 @@ TEST_F(BlitFramebufferANGLETest, OversizedBlit)
}
// blit from system FBO to user-created framebuffer, using region larger than buffer.
TEST_F(BlitFramebufferANGLETest, ReverseOversizedBlit)
TYPED_TEST(BlitFramebufferANGLETest, ReverseOversizedBlit)
{
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
......@@ -485,7 +490,7 @@ TEST_F(BlitFramebufferANGLETest, ReverseOversizedBlit)
}
// blit from user-created FBO to system framebuffer, with depth buffer.
TEST_F(BlitFramebufferANGLETest, BlitWithDepth)
TYPED_TEST(BlitFramebufferANGLETest, BlitWithDepth)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -522,7 +527,7 @@ TEST_F(BlitFramebufferANGLETest, BlitWithDepth)
}
// blit from system FBO to user-created framebuffer, with depth buffer.
TEST_F(BlitFramebufferANGLETest, ReverseBlitWithDepth)
TYPED_TEST(BlitFramebufferANGLETest, ReverseBlitWithDepth)
{
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
......@@ -559,7 +564,7 @@ TEST_F(BlitFramebufferANGLETest, ReverseBlitWithDepth)
}
// blit from one region of the system fbo to another-- this should fail.
TEST_F(BlitFramebufferANGLETest, BlitSameBufferOriginal)
TYPED_TEST(BlitFramebufferANGLETest, BlitSameBufferOriginal)
{
glBindFramebuffer(GL_FRAMEBUFFER, mOriginalFBO);
......@@ -575,7 +580,7 @@ TEST_F(BlitFramebufferANGLETest, BlitSameBufferOriginal)
}
// blit from one region of the system fbo to another.
TEST_F(BlitFramebufferANGLETest, BlitSameBufferUser)
TYPED_TEST(BlitFramebufferANGLETest, BlitSameBufferUser)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -590,7 +595,7 @@ TEST_F(BlitFramebufferANGLETest, BlitSameBufferUser)
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
TEST_F(BlitFramebufferANGLETest, BlitPartialColor)
TYPED_TEST(BlitFramebufferANGLETest, BlitPartialColor)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -619,7 +624,7 @@ TEST_F(BlitFramebufferANGLETest, BlitPartialColor)
EXPECT_PIXEL_EQ( getWindowWidth() / 4, 3 * getWindowHeight() / 4, 255, 0, 0, 255);
}
TEST_F(BlitFramebufferANGLETest, BlitDifferentSizes)
TYPED_TEST(BlitFramebufferANGLETest, BlitDifferentSizes)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -647,7 +652,7 @@ TEST_F(BlitFramebufferANGLETest, BlitDifferentSizes)
EXPECT_GL_NO_ERROR();
}
TEST_F(BlitFramebufferANGLETest, BlitWithMissingAttachments)
TYPED_TEST(BlitFramebufferANGLETest, BlitWithMissingAttachments)
{
glBindFramebuffer(GL_FRAMEBUFFER, mColorOnlyFBO);
......@@ -685,7 +690,7 @@ TEST_F(BlitFramebufferANGLETest, BlitWithMissingAttachments)
EXPECT_PIXEL_EQ( getWindowWidth() / 4, 3 * getWindowHeight() / 4, 0, 0, 255, 255);
}
TEST_F(BlitFramebufferANGLETest, BlitStencil)
TYPED_TEST(BlitFramebufferANGLETest, BlitStencil)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -727,7 +732,7 @@ TEST_F(BlitFramebufferANGLETest, BlitStencil)
}
// make sure that attempting to blit a partial depth buffer issues an error
TEST_F(BlitFramebufferANGLETest, BlitPartialDepthStencil)
TYPED_TEST(BlitFramebufferANGLETest, BlitPartialDepthStencil)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -746,7 +751,7 @@ TEST_F(BlitFramebufferANGLETest, BlitPartialDepthStencil)
}
// Test blit with MRT framebuffers
TEST_F(BlitFramebufferANGLETest, BlitMRT)
TYPED_TEST(BlitFramebufferANGLETest, BlitMRT)
{
if (!extensionEnabled("GL_EXT_draw_buffers"))
{
......@@ -794,7 +799,7 @@ TEST_F(BlitFramebufferANGLETest, BlitMRT)
}
// Make sure that attempts to stretch in a blit call issue an error
TEST_F(BlitFramebufferANGLETest, ErrorStretching)
TYPED_TEST(BlitFramebufferANGLETest, ErrorStretching)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -813,7 +818,7 @@ TEST_F(BlitFramebufferANGLETest, ErrorStretching)
}
// Make sure that attempts to flip in a blit call issue an error
TEST_F(BlitFramebufferANGLETest, ErrorFlipping)
TYPED_TEST(BlitFramebufferANGLETest, ErrorFlipping)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......@@ -831,7 +836,7 @@ TEST_F(BlitFramebufferANGLETest, ErrorFlipping)
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
TEST_F(BlitFramebufferANGLETest, Errors)
TYPED_TEST(BlitFramebufferANGLETest, Errors)
{
glBindFramebuffer(GL_FRAMEBUFFER, mUserFBO);
......
......@@ -2,13 +2,15 @@
#include <cstdint>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(BufferDataTest, TestFixtureTypes);
template<typename T>
class BufferDataTest : public ANGLETest
{
protected:
BufferDataTest()
: mBuffer(0),
mProgram(0),
mAttribLocation(-1)
BufferDataTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(16);
setWindowHeight(16);
......@@ -17,6 +19,10 @@ class BufferDataTest : public ANGLETest
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
mBuffer = 0;
mProgram = 0;
mAttribLocation = -1;
}
virtual void SetUp()
......@@ -76,7 +82,7 @@ class BufferDataTest : public ANGLETest
GLint mAttribLocation;
};
TEST_F(BufferDataTest, NULLData)
TYPED_TEST(BufferDataTest, NULLData)
{
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
EXPECT_GL_NO_ERROR();
......@@ -99,7 +105,7 @@ TEST_F(BufferDataTest, NULLData)
}
}
TEST_F(BufferDataTest, ZeroNonNULLData)
TYPED_TEST(BufferDataTest, ZeroNonNULLData)
{
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
EXPECT_GL_NO_ERROR();
......@@ -114,7 +120,7 @@ TEST_F(BufferDataTest, ZeroNonNULLData)
delete [] zeroData;
}
TEST_F(BufferDataTest, NULLResolvedData)
TYPED_TEST(BufferDataTest, NULLResolvedData)
{
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
glBufferData(GL_ARRAY_BUFFER, 128, NULL, GL_DYNAMIC_DRAW);
......@@ -127,7 +133,7 @@ TEST_F(BufferDataTest, NULLResolvedData)
drawQuad(mProgram, "position", 0.5f);
}
TEST_F(BufferDataTest, HugeSetDataShouldNotCrash)
TYPED_TEST(BufferDataTest, HugeSetDataShouldNotCrash)
{
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
EXPECT_GL_NO_ERROR();
......@@ -196,10 +202,15 @@ TEST_F(BufferDataTest, HugeSetDataShouldNotCrash)
delete[] data;
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesIndexedBufferCopyTest;
TYPED_TEST_CASE(IndexedBufferCopyTest, TestFixtureTypesIndexedBufferCopyTest);
template<typename T>
class IndexedBufferCopyTest : public ANGLETest
{
protected:
IndexedBufferCopyTest()
IndexedBufferCopyTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(16);
setWindowHeight(16);
......@@ -208,7 +219,6 @@ class IndexedBufferCopyTest : public ANGLETest
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
setClientVersion(3);
}
virtual void SetUp()
......@@ -275,7 +285,7 @@ class IndexedBufferCopyTest : public ANGLETest
// The following test covers an ANGLE bug where our index ranges
// weren't updated from CopyBufferSubData calls
// https://code.google.com/p/angleproject/issues/detail?id=709
TEST_F(IndexedBufferCopyTest, IndexRangeBug)
TYPED_TEST(IndexedBufferCopyTest, IndexRangeBug)
{
unsigned char vertexData[] = { 255, 0, 0, 0, 0, 0 };
unsigned int indexData[] = { 0, 1 };
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(ClearTest, TestFixtureTypes);
template<typename T>
class ClearTest : public ANGLETest
{
protected:
ClearTest()
ClearTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -12,7 +17,6 @@ protected:
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
setClientVersion(3);
}
virtual void SetUp()
......@@ -63,7 +67,7 @@ protected:
GLuint mFBO;
};
TEST_F(ClearTest, ClearIssue)
TYPED_TEST(ClearTest, ClearIssue)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
......@@ -104,7 +108,7 @@ TEST_F(ClearTest, ClearIssue)
// Requires ES3
// This tests a bug where in a masked clear when calling "ClearBuffer", we would
// mistakenly clear every channel (including the masked-out ones)
TEST_F(ClearTest, MaskedClearBufferBug)
TYPED_TEST(ClearTest, MaskedClearBufferBug)
{
unsigned char pixelData[] = { 255, 255, 255, 255 };
......@@ -141,7 +145,7 @@ TEST_F(ClearTest, MaskedClearBufferBug)
glDeleteTextures(2, textures);
}
TEST_F(ClearTest, BadFBOSerialBug)
TYPED_TEST(ClearTest, BadFBOSerialBug)
{
// First make a simple framebuffer, and clear it to green
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
......
#include "ANGLETest.h"
#include "media/pixel.inl"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(CompressedTextureTest, TestFixtureTypes);
template<typename T>
class CompressedTextureTest : public ANGLETest
{
protected:
CompressedTextureTest()
CompressedTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(512);
setWindowHeight(512);
......@@ -66,7 +71,7 @@ protected:
GLint mTextureUniformLocation;
};
TEST_F(CompressedTextureTest, CompressedTexImage)
TYPED_TEST(CompressedTextureTest, CompressedTexImage)
{
if (getClientVersion() < 3 && !extensionEnabled("GL_EXT_texture_compression_dxt1"))
{
......@@ -106,7 +111,7 @@ TEST_F(CompressedTextureTest, CompressedTexImage)
EXPECT_GL_NO_ERROR();
}
TEST_F(CompressedTextureTest, CompressedTexStorage)
TYPED_TEST(CompressedTextureTest, CompressedTexStorage)
{
if (getClientVersion() < 3 && !extensionEnabled("GL_EXT_texture_compression_dxt1"))
{
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(DepthStencilFormatsTest, TestFixtureTypes);
template<typename T>
class DepthStencilFormatsTest : public ANGLETest
{
protected:
DepthStencilFormatsTest()
DepthStencilFormatsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -11,7 +16,6 @@ protected:
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setClientVersion(2);
}
bool checkTexImageFormatSupport(GLenum format, GLenum type)
......@@ -64,7 +68,7 @@ protected:
}
};
TEST_F(DepthStencilFormatsTest, DepthTexture)
TYPED_TEST(DepthStencilFormatsTest, DepthTexture)
{
bool shouldHaveTextureSupport = extensionEnabled("GL_ANGLE_depth_texture");
EXPECT_EQ(shouldHaveTextureSupport, checkTexImageFormatSupport(GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT));
......@@ -77,7 +81,7 @@ TEST_F(DepthStencilFormatsTest, DepthTexture)
}
}
TEST_F(DepthStencilFormatsTest, PackedDepthStencil)
TYPED_TEST(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.
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9> > TestFixtureTypes;
TYPED_TEST_CASE(DrawBuffersTest, TestFixtureTypes);
template<typename T>
class DrawBuffersTest : public ANGLETest
{
protected:
DrawBuffersTest(int clientVersion)
DrawBuffersTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -12,7 +17,6 @@ class DrawBuffersTest : public ANGLETest
setConfigBlueBits(8);
setConfigAlphaBits(8);
setConfigDepthBits(24);
setClientVersion(clientVersion);
}
virtual void SetUp()
......@@ -190,140 +194,94 @@ class DrawBuffersTest : public ANGLETest
EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, r, g, b, 255);
}
void gapsTest()
{
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, mTextures[0], 0);
bool flags[8] = { false, true };
GLuint program;
setupMRTProgram(flags, &program);
GLuint mFBO;
GLuint mTextures[4];
GLuint mBuffer;
};
const GLenum bufs[] =
{
GL_NONE,
GL_COLOR_ATTACHMENT1
};
glUseProgram(program);
glDrawBuffersEXT(2, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
TYPED_TEST(DrawBuffersTest, Gaps)
{
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, mTextures[0], 0);
verifyAttachment(1, mTextures[0]);
bool flags[8] = { false, true };
glDeleteProgram(program);
}
GLuint program;
setupMRTProgram(flags, &program);
void firstAndLastTest()
const GLenum bufs[] =
{
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextures[0], 0);
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, mTextures[1], 0);
bool flags[8] = { true, false, false, true };
GL_NONE,
GL_COLOR_ATTACHMENT1
};
glUseProgram(program);
glDrawBuffersEXT(2, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
GLuint program;
setupMRTProgram(flags, &program);
verifyAttachment(1, mTextures[0]);
const GLenum bufs[] =
{
GL_COLOR_ATTACHMENT0,
GL_NONE,
GL_NONE,
GL_COLOR_ATTACHMENT3
};
glDeleteProgram(program);
}
glUseProgram(program);
glDrawBuffersEXT(4, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
TYPED_TEST(DrawBuffersTest, FirstAndLast)
{
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextures[0], 0);
verifyAttachment(0, mTextures[0]);
verifyAttachment(3, mTextures[1]);
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, mTextures[1], 0);
EXPECT_GL_NO_ERROR();
bool flags[8] = { true, false, false, true };
glDeleteProgram(program);
}
GLuint program;
setupMRTProgram(flags, &program);
void firstHalfNULLTest()
const GLenum bufs[] =
{
bool flags[8] = { false };
GLenum bufs[8] = { GL_NONE };
for (unsigned int texIndex = 0; texIndex < 4; texIndex++)
{
glBindTexture(GL_TEXTURE_2D, mTextures[texIndex]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT4 + texIndex, GL_TEXTURE_2D, mTextures[texIndex], 0);
flags[texIndex + 4] = true;
bufs[texIndex + 4] = GL_COLOR_ATTACHMENT4 + texIndex;
}
GL_COLOR_ATTACHMENT0,
GL_NONE,
GL_NONE,
GL_COLOR_ATTACHMENT3
};
GLuint program;
setupMRTProgram(flags, &program);
glUseProgram(program);
glDrawBuffersEXT(4, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
glUseProgram(program);
glDrawBuffersEXT(8, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
verifyAttachment(0, mTextures[0]);
verifyAttachment(3, mTextures[1]);
for (unsigned int texIndex = 0; texIndex < 4; texIndex++)
{
verifyAttachment(texIndex + 4, mTextures[texIndex]);
}
EXPECT_GL_NO_ERROR();
glDeleteProgram(program);
}
EXPECT_GL_NO_ERROR();
GLuint mFBO;
GLuint mTextures[4];
GLuint mBuffer;
};
class DrawBuffersTestESSL3 : public DrawBuffersTest
{
protected:
DrawBuffersTestESSL3()
: DrawBuffersTest(3)
{}
};
glDeleteProgram(program);
}
class DrawBuffersTestESSL1 : public DrawBuffersTest
TYPED_TEST(DrawBuffersTest, FirstHalfNULL)
{
protected:
DrawBuffersTestESSL1()
: DrawBuffersTest(2)
{}
};
bool flags[8] = { false };
GLenum bufs[8] = { GL_NONE };
TEST_F(DrawBuffersTestESSL3, Gaps)
{
gapsTest();
}
for (unsigned int texIndex = 0; texIndex < 4; texIndex++)
{
glBindTexture(GL_TEXTURE_2D, mTextures[texIndex]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT4 + texIndex, GL_TEXTURE_2D, mTextures[texIndex], 0);
flags[texIndex + 4] = true;
bufs[texIndex + 4] = GL_COLOR_ATTACHMENT4 + texIndex;
}
TEST_F(DrawBuffersTestESSL1, Gaps)
{
gapsTest();
}
GLuint program;
setupMRTProgram(flags, &program);
TEST_F(DrawBuffersTestESSL3, FirstAndLast)
{
firstAndLastTest();
}
glUseProgram(program);
glDrawBuffersEXT(8, bufs);
glDrawArrays(GL_TRIANGLES, 0, 3);
TEST_F(DrawBuffersTestESSL1, FirstAndLast)
{
firstAndLastTest();
}
for (unsigned int texIndex = 0; texIndex < 4; texIndex++)
{
verifyAttachment(texIndex + 4, mTextures[texIndex]);
}
TEST_F(DrawBuffersTestESSL3, FirstHalfNULL)
{
firstHalfNULLTest();
}
EXPECT_GL_NO_ERROR();
TEST_F(DrawBuffersTestESSL1, FirstHalfNULL)
{
firstHalfNULLTest();
}
glDeleteProgram(program);
}
\ No newline at end of file
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(FramebufferFormatsTest, TestFixtureTypes);
template<typename T>
class FramebufferFormatsTest : public ANGLETest
{
protected:
FramebufferFormatsTest()
FramebufferFormatsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -71,27 +76,27 @@ protected:
}
};
TEST_F(FramebufferFormatsTest, RGBA4)
TYPED_TEST(FramebufferFormatsTest, RGBA4)
{
testTextureFormat(GL_RGBA4, 4, 4, 4, 4);
}
TEST_F(FramebufferFormatsTest, RGB565)
TYPED_TEST(FramebufferFormatsTest, RGB565)
{
testTextureFormat(GL_RGB565, 5, 6, 5, 0);
}
TEST_F(FramebufferFormatsTest, RGB8)
TYPED_TEST(FramebufferFormatsTest, RGB8)
{
testTextureFormat(GL_RGB8_OES, 8, 8, 8, 0);
}
TEST_F(FramebufferFormatsTest, BGRA8)
TYPED_TEST(FramebufferFormatsTest, BGRA8)
{
testTextureFormat(GL_BGRA8_EXT, 8, 8, 8, 8);
}
TEST_F(FramebufferFormatsTest, RGBA8)
TYPED_TEST(FramebufferFormatsTest, RGBA8)
{
testTextureFormat(GL_RGBA8_OES, 8, 8, 8, 8);
}
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(GLSLTest, TestFixtureTypes);
template<typename T>
class GLSLTest : public ANGLETest
{
protected:
GLSLTest()
GLSLTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -254,7 +259,7 @@ protected:
std::string mSimpleVSSource;
};
TEST_F(GLSLTest, NamelessScopedStructs)
TYPED_TEST(GLSLTest, NamelessScopedStructs)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -275,7 +280,8 @@ TEST_F(GLSLTest, NamelessScopedStructs)
GLuint program = CompileProgram(mSimpleVSSource, fragmentShaderSource);
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, ScopedStructsOrderBug)
TYPED_TEST(GLSLTest, ScopedStructsOrderBug)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -307,7 +313,7 @@ TEST_F(GLSLTest, ScopedStructsOrderBug)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, ScopedStructsBug)
TYPED_TEST(GLSLTest, ScopedStructsBug)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -339,7 +345,7 @@ TEST_F(GLSLTest, ScopedStructsBug)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, DxPositionBug)
TYPED_TEST(GLSLTest, DxPositionBug)
{
const std::string &vertexShaderSource = SHADER_SOURCE
(
......@@ -368,7 +374,7 @@ TEST_F(GLSLTest, DxPositionBug)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, ElseIfRewriting)
TYPED_TEST(GLSLTest, ElseIfRewriting)
{
const std::string &vertexShaderSource =
"attribute vec4 a_position;\n"
......@@ -403,7 +409,7 @@ TEST_F(GLSLTest, ElseIfRewriting)
EXPECT_PIXEL_EQ(getWindowWidth()-1, 0, 0, 255, 0, 255);
}
TEST_F(GLSLTest, TwoElseIfRewriting)
TYPED_TEST(GLSLTest, TwoElseIfRewriting)
{
const std::string &vertexShaderSource =
"attribute vec4 a_position;\n"
......@@ -430,7 +436,7 @@ TEST_F(GLSLTest, TwoElseIfRewriting)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantVaryingOut)
TYPED_TEST(GLSLTest, InvariantVaryingOut)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -450,7 +456,7 @@ TEST_F(GLSLTest, InvariantVaryingOut)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, FrontFacingAndVarying)
TYPED_TEST(GLSLTest, FrontFacingAndVarying)
{
const std::string vertexShaderSource = SHADER_SOURCE
(
......@@ -487,7 +493,7 @@ TEST_F(GLSLTest, FrontFacingAndVarying)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantVaryingIn)
TYPED_TEST(GLSLTest, InvariantVaryingIn)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -507,7 +513,7 @@ TEST_F(GLSLTest, InvariantVaryingIn)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantVaryingBoth)
TYPED_TEST(GLSLTest, InvariantVaryingBoth)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -527,7 +533,7 @@ TEST_F(GLSLTest, InvariantVaryingBoth)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantGLPosition)
TYPED_TEST(GLSLTest, InvariantGLPosition)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -548,7 +554,7 @@ TEST_F(GLSLTest, InvariantGLPosition)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, InvariantAll)
TYPED_TEST(GLSLTest, InvariantAll)
{
const std::string fragmentShaderSource = SHADER_SOURCE
(
......@@ -567,7 +573,7 @@ TEST_F(GLSLTest, InvariantAll)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3)
TYPED_TEST(GLSLTest, MaxVaryingVec3)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -581,7 +587,7 @@ TEST_F(GLSLTest, MaxVaryingVec3)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3Array)
TYPED_TEST(GLSLTest, MaxVaryingVec3Array)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -595,7 +601,7 @@ TEST_F(GLSLTest, MaxVaryingVec3Array)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3AndOneFloat)
TYPED_TEST(GLSLTest, MaxVaryingVec3AndOneFloat)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -609,7 +615,7 @@ TEST_F(GLSLTest, MaxVaryingVec3AndOneFloat)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3ArrayAndOneFloatArray)
TYPED_TEST(GLSLTest, MaxVaryingVec3ArrayAndOneFloatArray)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -623,7 +629,7 @@ TEST_F(GLSLTest, MaxVaryingVec3ArrayAndOneFloatArray)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, TwiceMaxVaryingVec2)
TYPED_TEST(GLSLTest, TwiceMaxVaryingVec2)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -637,7 +643,7 @@ TEST_F(GLSLTest, TwiceMaxVaryingVec2)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec2Arrays)
TYPED_TEST(GLSLTest, MaxVaryingVec2Arrays)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -651,7 +657,7 @@ TEST_F(GLSLTest, MaxVaryingVec2Arrays)
EXPECT_NE(0u, program);
}
TEST_F(GLSLTest, MaxPlusOneVaryingVec3)
TYPED_TEST(GLSLTest, MaxPlusOneVaryingVec3)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -665,7 +671,7 @@ TEST_F(GLSLTest, MaxPlusOneVaryingVec3)
EXPECT_EQ(0u, program);
}
TEST_F(GLSLTest, MaxPlusOneVaryingVec3Array)
TYPED_TEST(GLSLTest, MaxPlusOneVaryingVec3Array)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -679,7 +685,7 @@ TEST_F(GLSLTest, MaxPlusOneVaryingVec3Array)
EXPECT_EQ(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3AndOneVec2)
TYPED_TEST(GLSLTest, MaxVaryingVec3AndOneVec2)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -693,7 +699,7 @@ TEST_F(GLSLTest, MaxVaryingVec3AndOneVec2)
EXPECT_EQ(0u, program);
}
TEST_F(GLSLTest, MaxPlusOneVaryingVec2)
TYPED_TEST(GLSLTest, MaxPlusOneVaryingVec2)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -707,7 +713,7 @@ TEST_F(GLSLTest, MaxPlusOneVaryingVec2)
EXPECT_EQ(0u, program);
}
TEST_F(GLSLTest, MaxVaryingVec3ArrayAndMaxPlusOneFloatArray)
TYPED_TEST(GLSLTest, MaxVaryingVec3ArrayAndMaxPlusOneFloatArray)
{
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......
......@@ -2,10 +2,15 @@
#include <vector>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(IncompleteTextureTest, TestFixtureTypes);
template<typename T>
class IncompleteTextureTest : public ANGLETest
{
protected:
IncompleteTextureTest()
IncompleteTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -76,7 +81,7 @@ protected:
GLint mTextureUniformLocation;
};
TEST_F(IncompleteTextureTest, IncompleteTexture2D)
TYPED_TEST(IncompleteTextureTest, IncompleteTexture2D)
{
GLuint tex;
glGenTextures(1, &tex);
......@@ -110,7 +115,7 @@ TEST_F(IncompleteTextureTest, IncompleteTexture2D)
glDeleteTextures(1, &tex);
}
TEST_F(IncompleteTextureTest, UpdateTexture)
TYPED_TEST(IncompleteTextureTest, UpdateTexture)
{
GLuint tex;
glGenTextures(1, &tex);
......
......@@ -5,7 +5,7 @@ template <typename IndexType, GLenum IndexTypeName>
class IndexedPointsTest : public ANGLETest
{
protected:
IndexedPointsTest()
IndexedPointsTest() : ANGLETest(2, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
setWindowWidth(128);
setWindowHeight(128);
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(LineLoopTest, TestFixtureTypes);
template<typename T>
class LineLoopTest : public ANGLETest
{
protected:
LineLoopTest()
LineLoopTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(256);
setWindowHeight(256);
......@@ -126,19 +131,19 @@ protected:
GLint mColorLocation;
};
TEST_F(LineLoopTest, LineLoopUByteIndices)
TYPED_TEST(LineLoopTest, LineLoopUByteIndices)
{
static const GLubyte indices[] = { 0, 7, 6, 9, 8, 0 };
runTest(GL_UNSIGNED_BYTE, 0, indices + 1);
}
TEST_F(LineLoopTest, LineLoopUShortIndices)
TYPED_TEST(LineLoopTest, LineLoopUShortIndices)
{
static const GLushort indices[] = { 0, 7, 6, 9, 8, 0 };
runTest(GL_UNSIGNED_SHORT, 0, indices + 1);
}
TEST_F(LineLoopTest, LineLoopUIntIndices)
TYPED_TEST(LineLoopTest, LineLoopUIntIndices)
{
if (!extensionEnabled("GL_OES_element_index_uint"))
{
......@@ -149,7 +154,7 @@ TEST_F(LineLoopTest, LineLoopUIntIndices)
runTest(GL_UNSIGNED_INT, 0, indices + 1);
}
TEST_F(LineLoopTest, LineLoopUByteIndexBuffer)
TYPED_TEST(LineLoopTest, LineLoopUByteIndexBuffer)
{
static const GLubyte indices[] = { 0, 7, 6, 9, 8, 0 };
......@@ -163,7 +168,7 @@ TEST_F(LineLoopTest, LineLoopUByteIndexBuffer)
glDeleteBuffers(1, &buf);
}
TEST_F(LineLoopTest, LineLoopUShortIndexBuffer)
TYPED_TEST(LineLoopTest, LineLoopUShortIndexBuffer)
{
static const GLushort indices[] = { 0, 7, 6, 9, 8, 0 };
......@@ -177,7 +182,7 @@ TEST_F(LineLoopTest, LineLoopUShortIndexBuffer)
glDeleteBuffers(1, &buf);
}
TEST_F(LineLoopTest, LineLoopUIntIndexBuffer)
TYPED_TEST(LineLoopTest, LineLoopUIntIndexBuffer)
{
if (!extensionEnabled("GL_OES_element_index_uint"))
{
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(MaxTextureSizeTest, TestFixtureTypes);
template<typename T>
class MaxTextureSizeTest : public ANGLETest
{
protected:
MaxTextureSizeTest()
MaxTextureSizeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(512);
setWindowHeight(512);
......@@ -86,7 +91,7 @@ protected:
GLint mMaxRenderbufferSize;
};
TEST_F(MaxTextureSizeTest, SpecificationTexImage)
TYPED_TEST(MaxTextureSizeTest, SpecificationTexImage)
{
GLuint tex;
glGenTextures(1, &tex);
......@@ -141,7 +146,7 @@ TEST_F(MaxTextureSizeTest, SpecificationTexImage)
}
}
TEST_F(MaxTextureSizeTest, SpecificationTexStorage)
TYPED_TEST(MaxTextureSizeTest, SpecificationTexStorage)
{
if (getClientVersion() < 3 && (!extensionEnabled("GL_EXT_texture_storage") || !extensionEnabled("GL_OES_rgb8_rgba8")))
{
......@@ -211,7 +216,7 @@ TEST_F(MaxTextureSizeTest, SpecificationTexStorage)
}
}
TEST_F(MaxTextureSizeTest, RenderToTexture)
TYPED_TEST(MaxTextureSizeTest, RenderToTexture)
{
GLuint fbo = 0;
GLuint textureId = 0;
......
......@@ -3,10 +3,15 @@
// Needed for Sleep()
#include <Windows.h>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(OcclusionQueriesTest, TestFixtureTypes);
template<typename T>
class OcclusionQueriesTest : public ANGLETest
{
protected:
OcclusionQueriesTest()
OcclusionQueriesTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -58,7 +63,7 @@ protected:
GLuint mProgram;
};
TEST_F(OcclusionQueriesTest, IsOccluded)
TYPED_TEST(OcclusionQueriesTest, IsOccluded)
{
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
......@@ -98,7 +103,7 @@ TEST_F(OcclusionQueriesTest, IsOccluded)
EXPECT_EQ(result, GL_FALSE);
}
TEST_F(OcclusionQueriesTest, IsNotOccluded)
TYPED_TEST(OcclusionQueriesTest, IsNotOccluded)
{
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
......@@ -125,7 +130,7 @@ TEST_F(OcclusionQueriesTest, IsNotOccluded)
EXPECT_EQ(result, GL_TRUE);
}
TEST_F(OcclusionQueriesTest, Errors)
TYPED_TEST(OcclusionQueriesTest, Errors)
{
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(PBOExtensionTest, TestFixtureTypes);
template<typename T>
class PBOExtensionTest : public ANGLETest
{
protected:
PBOExtensionTest()
PBOExtensionTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setClientVersion(2);
setWindowWidth(32);
setWindowHeight(32);
setConfigRedBits(8);
......@@ -73,7 +77,7 @@ protected:
GLuint mPositionVBO;
};
TEST_F(PBOExtensionTest, PBOWithOtherTarget)
TYPED_TEST(PBOExtensionTest, PBOWithOtherTarget)
{
if (extensionEnabled("NV_pixel_buffer_object"))
{
......@@ -101,7 +105,7 @@ TEST_F(PBOExtensionTest, PBOWithOtherTarget)
EXPECT_GL_NO_ERROR();
}
TEST_F(PBOExtensionTest, PBOWithExistingData)
TYPED_TEST(PBOExtensionTest, PBOWithExistingData)
{
if (extensionEnabled("NV_pixel_buffer_object"))
{
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(ProgramBinaryTest, TestFixtureTypes);
template<typename T>
class ProgramBinaryTest : public ANGLETest
{
protected:
ProgramBinaryTest()
ProgramBinaryTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -62,7 +67,7 @@ protected:
// This tests the assumption that float attribs of different size
// should not internally cause a vertex shader recompile (for conversion).
TEST_F(ProgramBinaryTest, FloatDynamicShaderSize)
TYPED_TEST(ProgramBinaryTest, FloatDynamicShaderSize)
{
glUseProgram(mProgram);
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes;
TYPED_TEST_CASE(ReadPixelsTest, TestFixtureTypes);
template<typename T>
class ReadPixelsTest : public ANGLETest
{
protected:
ReadPixelsTest()
ReadPixelsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setClientVersion(3);
setWindowWidth(32);
setWindowHeight(32);
setConfigRedBits(8);
......@@ -84,7 +88,7 @@ protected:
GLuint mPositionVBO;
};
TEST_F(ReadPixelsTest, OutOfBounds)
TYPED_TEST(ReadPixelsTest, OutOfBounds)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -117,7 +121,7 @@ TEST_F(ReadPixelsTest, OutOfBounds)
}
}
TEST_F(ReadPixelsTest, PBOWithOtherTarget)
TYPED_TEST(ReadPixelsTest, PBOWithOtherTarget)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -142,7 +146,7 @@ TEST_F(ReadPixelsTest, PBOWithOtherTarget)
EXPECT_GL_NO_ERROR();
}
TEST_F(ReadPixelsTest, PBOWithExistingData)
TYPED_TEST(ReadPixelsTest, PBOWithExistingData)
{
// Clear backbuffer to red
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
......@@ -180,7 +184,7 @@ TEST_F(ReadPixelsTest, PBOWithExistingData)
EXPECT_GL_NO_ERROR();
}
TEST_F(ReadPixelsTest, PBOAndSubData)
TYPED_TEST(ReadPixelsTest, PBOAndSubData)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -208,7 +212,7 @@ TEST_F(ReadPixelsTest, PBOAndSubData)
EXPECT_GL_NO_ERROR();
}
TEST_F(ReadPixelsTest, PBOAndSubDataOffset)
TYPED_TEST(ReadPixelsTest, PBOAndSubDataOffset)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
......@@ -241,7 +245,7 @@ TEST_F(ReadPixelsTest, PBOAndSubDataOffset)
EXPECT_GL_NO_ERROR();
}
TEST_F(ReadPixelsTest, DrawWithPBO)
TYPED_TEST(ReadPixelsTest, DrawWithPBO)
{
unsigned char data[4] = { 1, 2, 3, 4 };
......@@ -294,7 +298,7 @@ TEST_F(ReadPixelsTest, DrawWithPBO)
EXPECT_EQ(4, data[3]);
}
TEST_F(ReadPixelsTest, MultisampledPBO)
TYPED_TEST(ReadPixelsTest, MultisampledPBO)
{
GLuint fbo;
glGenFramebuffers(1, &fbo);
......
#include "ANGLETest.h"
// These tests are designed to ensure that the various configurations of the test fixtures work as expected.
// If one of these tests fails, then it is likely that some of the other tests are being configured incorrectly.
// For example, they might be using the D3D11 renderer when the test is meant to be using the D3D9 renderer.
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>,
TFT<Gles::Three, Rend::WARP>, TFT<Gles::Two, Rend::WARP>,
TFT<Gles::Two, Rend::D3D9> > TestFixtureTypes;
TYPED_TEST_CASE(RendererTest, TestFixtureTypes);
template<typename T>
class RendererTest : public ANGLETest
{
protected:
RendererTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
}
T fixtureType;
};
TYPED_TEST(RendererTest, RequestedRendererCreated)
{
std::string rendererString = std::string(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
std::transform(rendererString.begin(), rendererString.end(), rendererString.begin(), ::tolower);
std::string versionString = std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
std::transform(versionString.begin(), versionString.end(), versionString.begin(), ::tolower);
// Ensure that the renderer string contains D3D11, if we requested a D3D11 renderer.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE || fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
{
ASSERT_NE(rendererString.find(std::string("direct3d11")), std::string::npos);
}
// Ensure that the renderer string contains D3D9, if we requested a D3D9 renderer.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
{
ASSERT_NE(rendererString.find(std::string("direct3d9")), std::string::npos);
}
// Ensure that the renderer uses WARP, if we requested it.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
{
ASSERT_NE(rendererString.find(std::string("microsoft basic render")), std::string::npos);
}
// Ensure that the renderer string contains GL ES 3.0, if we requested a GL ES 3.0
if (fixtureType.GetGlesMajorVersion() == 3)
{
ASSERT_NE(versionString.find(std::string("es 3.0")), std::string::npos);
}
// Ensure that the version string contains GL ES 2.0, if we requested GL ES 2.0
if (fixtureType.GetGlesMajorVersion() == 2)
{
ASSERT_NE(versionString.find(std::string("es 2.0")), std::string::npos);
}
}
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(SRGBTextureTest, TestFixtureTypes);
template<typename T>
class SRGBTextureTest : public ANGLETest
{
protected:
SRGBTextureTest()
SRGBTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -24,7 +29,7 @@ protected:
}
};
TEST_F(SRGBTextureTest, SRGBValidation)
TYPED_TEST(SRGBTextureTest, SRGBValidation)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
......@@ -52,7 +57,7 @@ TEST_F(SRGBTextureTest, SRGBValidation)
glDeleteTextures(1, &tex);
}
TEST_F(SRGBTextureTest, SRGBAValidation)
TYPED_TEST(SRGBTextureTest, SRGBAValidation)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
......@@ -87,7 +92,7 @@ TEST_F(SRGBTextureTest, SRGBAValidation)
glDeleteTextures(1, &tex);
}
TEST_F(SRGBTextureTest, SRGBARenderbuffer)
TYPED_TEST(SRGBTextureTest, SRGBARenderbuffer)
{
bool supported = extensionEnabled("GL_EXT_sRGB") || getClientVersion() == 3;
......
......@@ -2,10 +2,15 @@
#include <vector>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes;
TYPED_TEST_CASE(SwizzleTest, TestFixtureTypes);
template<typename T>
class SwizzleTest : public ANGLETest
{
protected:
SwizzleTest()
SwizzleTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -13,7 +18,6 @@ protected:
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setClientVersion(3);
GLenum swizzles[] =
{
......@@ -181,77 +185,77 @@ protected:
std::vector<swizzlePermutation> mPermutations;
};
TEST_F(SwizzleTest, RGBA8_2D)
TYPED_TEST(SwizzleTest, RGBA8_2D)
{
GLubyte data[] = { 1, 64, 128, 200 };
init2DTexture(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, data);
runTest2D();
}
TEST_F(SwizzleTest, RGB8_2D)
TYPED_TEST(SwizzleTest, RGB8_2D)
{
GLubyte data[] = { 77, 66, 55 };
init2DTexture(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, data);
runTest2D();
}
TEST_F(SwizzleTest, RG8_2D)
TYPED_TEST(SwizzleTest, RG8_2D)
{
GLubyte data[] = { 11, 99 };
init2DTexture(GL_RG8, GL_RG, GL_UNSIGNED_BYTE, data);
runTest2D();
}
TEST_F(SwizzleTest, R8_2D)
TYPED_TEST(SwizzleTest, R8_2D)
{
GLubyte data[] = { 2 };
init2DTexture<GLubyte>(GL_R8, GL_RED, GL_UNSIGNED_BYTE, data);
runTest2D();
}
TEST_F(SwizzleTest, RGBA32F_2D)
TYPED_TEST(SwizzleTest, RGBA32F_2D)
{
GLfloat data[] = { 0.25f, 0.5f, 0.75f, 0.8f };
init2DTexture(GL_RGBA32F, GL_RGBA, GL_FLOAT, data);
runTest2D();
}
TEST_F(SwizzleTest, RGB32F_2D)
TYPED_TEST(SwizzleTest, RGB32F_2D)
{
GLfloat data[] = { 0.1f, 0.2f, 0.3f };
init2DTexture(GL_RGB32F, GL_RGB, GL_FLOAT, data);
runTest2D();
}
TEST_F(SwizzleTest, RG32F_2D)
TYPED_TEST(SwizzleTest, RG32F_2D)
{
GLfloat data[] = { 0.9f, 0.1f };
init2DTexture(GL_RG32F, GL_RG, GL_FLOAT, data);
runTest2D();
}
TEST_F(SwizzleTest, R32F_2D)
TYPED_TEST(SwizzleTest, R32F_2D)
{
GLfloat data[] = { 0.5f };
init2DTexture(GL_R32F, GL_RED, GL_FLOAT, data);
runTest2D();
}
TEST_F(SwizzleTest, D32F_2D)
TYPED_TEST(SwizzleTest, D32F_2D)
{
GLfloat data[] = { 0.5f };
init2DTexture(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, data);
runTest2D();
}
TEST_F(SwizzleTest, D16_2D)
TYPED_TEST(SwizzleTest, D16_2D)
{
GLushort data[] = { 0xFF };
init2DTexture(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, data);
runTest2D();
}
TEST_F(SwizzleTest, D24_2D)
TYPED_TEST(SwizzleTest, D24_2D)
{
GLuint data[] = { 0xFFFF };
init2DTexture(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, data);
......@@ -260,7 +264,7 @@ TEST_F(SwizzleTest, D24_2D)
#include "media/pixel.inl"
TEST_F(SwizzleTest, CompressedDXT_2D)
TYPED_TEST(SwizzleTest, CompressedDXT_2D)
{
init2DCompressedTexture(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, pixel_0_width, pixel_0_height, pixel_0_size, pixel_0_data);
runTest2D();
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(TextureTest, TestFixtureTypes);
template<typename T>
class TextureTest : public ANGLETest
{
protected:
TextureTest()
TextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -96,7 +101,7 @@ protected:
GLint mTexture2DUniformLocation;
};
TEST_F(TextureTest, NegativeAPISubImage)
TYPED_TEST(TextureTest, NegativeAPISubImage)
{
glBindTexture(GL_TEXTURE_2D, mTexture2D);
EXPECT_GL_ERROR(GL_NO_ERROR);
......@@ -106,7 +111,7 @@ TEST_F(TextureTest, NegativeAPISubImage)
EXPECT_GL_ERROR(GL_INVALID_VALUE);
}
TEST_F(TextureTest, ZeroSizedUploads)
TYPED_TEST(TextureTest, ZeroSizedUploads)
{
glBindTexture(GL_TEXTURE_2D, mTexture2D);
EXPECT_GL_ERROR(GL_NO_ERROR);
......@@ -129,7 +134,7 @@ TEST_F(TextureTest, ZeroSizedUploads)
}
// Test drawing with two texture types, to trigger an ANGLE bug in validation
TEST_F(TextureTest, CubeMapBug)
TYPED_TEST(TextureTest, CubeMapBug)
{
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, mTexture2D);
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes;
TYPED_TEST_CASE(TransformFeedbackTest, TestFixtureTypes);
template<typename T>
class TransformFeedbackTest : public ANGLETest
{
protected:
TransformFeedbackTest()
TransformFeedbackTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -11,7 +16,6 @@ class TransformFeedbackTest : public ANGLETest
setConfigGreenBits(8);
setConfigBlueBits(8);
setConfigAlphaBits(8);
setClientVersion(3);
}
virtual void SetUp()
......@@ -66,7 +70,7 @@ class TransformFeedbackTest : public ANGLETest
GLuint mTransformFeedbackBuffer;
};
TEST_F(TransformFeedbackTest, ZeroSizedViewport)
TYPED_TEST(TransformFeedbackTest, ZeroSizedViewport)
{
// Set the program's transform feedback varyings (just gl_Position)
const GLchar* transformFeedbackVaryings[] =
......
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(UniformTest, TestFixtureTypes);
template<typename T>
class UniformTest : public ANGLETest
{
protected:
UniformTest()
UniformTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -47,7 +52,7 @@ class UniformTest : public ANGLETest
GLint mUniformILocation;
};
TEST_F(UniformTest, GetUniformNoCurrentProgram)
TYPED_TEST(UniformTest, GetUniformNoCurrentProgram)
{
glUseProgram(mProgram);
glUniform1f(mUniformFLocation, 1.0f);
......
......@@ -2,10 +2,15 @@
#include <array>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(UnpackAlignmentTest, TestFixtureTypes);
template<typename T>
class UnpackAlignmentTest : public ANGLETest
{
protected:
UnpackAlignmentTest()
UnpackAlignmentTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -133,7 +138,7 @@ protected:
GLuint mProgram;
};
TEST_F(UnpackAlignmentTest, DefaultAlignment)
TYPED_TEST(UnpackAlignmentTest, DefaultAlignment)
{
GLint defaultAlignment;
glGetIntegerv(GL_UNPACK_ALIGNMENT, &defaultAlignment);
......@@ -141,165 +146,165 @@ TEST_F(UnpackAlignmentTest, DefaultAlignment)
}
TEST_F(UnpackAlignmentTest, Alignment1RGBAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment1RGBAUByte)
{
testAlignment(1, 7 * 4, GL_RGBA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment1RGBUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment1RGBUByte)
{
testAlignment(1, 7 * 3, GL_RGB, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment1RGBAUShort4444)
TYPED_TEST(UnpackAlignmentTest, Alignment1RGBAUShort4444)
{
testAlignment(1, 7 * 2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
}
TEST_F(UnpackAlignmentTest, Alignment1RGBAUShort5551)
TYPED_TEST(UnpackAlignmentTest, Alignment1RGBAUShort5551)
{
testAlignment(1, 7 * 2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
}
TEST_F(UnpackAlignmentTest, Alignment1RGBAUShort565)
TYPED_TEST(UnpackAlignmentTest, Alignment1RGBAUShort565)
{
testAlignment(1, 7 * 2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
}
TEST_F(UnpackAlignmentTest, Alignment1LAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment1LAUByte)
{
testAlignment(1, 7 * 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment1LUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment1LUByte)
{
testAlignment(1, 7, GL_LUMINANCE, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment1AUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment1AUByte)
{
testAlignment(1, 7, GL_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment2RGBAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment2RGBAUByte)
{
testAlignment(2, 7 * 4, GL_RGBA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment2RGBUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment2RGBUByte)
{
testAlignment(2, 7 * 3 + 1, GL_RGB, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment2RGBAUShort4444)
TYPED_TEST(UnpackAlignmentTest, Alignment2RGBAUShort4444)
{
testAlignment(2, 7 * 2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
}
TEST_F(UnpackAlignmentTest, Alignment2RGBAUShort5551)
TYPED_TEST(UnpackAlignmentTest, Alignment2RGBAUShort5551)
{
testAlignment(2, 7 * 2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
}
TEST_F(UnpackAlignmentTest, Alignment2RGBAUShort565)
TYPED_TEST(UnpackAlignmentTest, Alignment2RGBAUShort565)
{
testAlignment(2, 7 * 2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
}
TEST_F(UnpackAlignmentTest, Alignment2LAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment2LAUByte)
{
testAlignment(2, 7 * 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment2LAByte)
TYPED_TEST(UnpackAlignmentTest, Alignment2LAByte)
{
testAlignment(2, 7 + 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment2AUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment2AUByte)
{
testAlignment(2, 7 + 1, GL_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment4RGBAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment4RGBAUByte)
{
testAlignment(4, 7 * 4, GL_RGBA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment4RGBUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment4RGBUByte)
{
testAlignment(4, 7 * 3 + 3, GL_RGB, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment4RGBAUShort4444)
TYPED_TEST(UnpackAlignmentTest, Alignment4RGBAUShort4444)
{
testAlignment(4, 7 * 2 + 2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
}
TEST_F(UnpackAlignmentTest, Alignment4RGBAUShort5551)
TYPED_TEST(UnpackAlignmentTest, Alignment4RGBAUShort5551)
{
testAlignment(4, 7 * 2 + 2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
}
TEST_F(UnpackAlignmentTest, Alignment4RGBAUShort565)
TYPED_TEST(UnpackAlignmentTest, Alignment4RGBAUShort565)
{
testAlignment(4, 7 * 2 + 2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
}
TEST_F(UnpackAlignmentTest, Alignment4LAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment4LAUByte)
{
testAlignment(4, 7 * 2 + 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment4LUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment4LUByte)
{
testAlignment(4, 7 + 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment4AUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment4AUByte)
{
testAlignment(4, 7 + 1, GL_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment8RGBAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment8RGBAUByte)
{
testAlignment(8, 7 * 4 + 4, GL_RGBA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment8RGBUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment8RGBUByte)
{
testAlignment(8, 7 * 3 + 3, GL_RGB, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment8RGBAUShort4444)
TYPED_TEST(UnpackAlignmentTest, Alignment8RGBAUShort4444)
{
testAlignment(8, 7 * 2 + 2, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
}
TEST_F(UnpackAlignmentTest, Alignment8RGBAUShort5551)
TYPED_TEST(UnpackAlignmentTest, Alignment8RGBAUShort5551)
{
testAlignment(8, 7 * 2 + 2, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
}
TEST_F(UnpackAlignmentTest, Alignment8RGBAUShort565)
TYPED_TEST(UnpackAlignmentTest, Alignment8RGBAUShort565)
{
testAlignment(8, 7 * 2 + 2, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
}
TEST_F(UnpackAlignmentTest, Alignment8LAUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment8LAUByte)
{
testAlignment(8, 7 * 2 + 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment8LUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment8LUByte)
{
testAlignment(8, 7 + 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
}
TEST_F(UnpackAlignmentTest, Alignment8AUByte)
TYPED_TEST(UnpackAlignmentTest, Alignment8AUByte)
{
testAlignment(8, 7 + 1, GL_ALPHA, GL_UNSIGNED_BYTE);
}
#include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes;
TYPED_TEST_CASE(VertexAttributeTest, TestFixtureTypes);
template<typename T>
class VertexAttributeTest : public ANGLETest
{
protected:
VertexAttributeTest()
VertexAttributeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer())
{
setWindowWidth(128);
setWindowHeight(128);
......@@ -118,7 +123,7 @@ protected:
GLint mExpectedAttrib;
};
TEST_F(VertexAttributeTest, UnsignedByteUnnormalized)
TYPED_TEST(VertexAttributeTest, UnsignedByteUnnormalized)
{
GLubyte inputData[mVertexCount] = { 0, 1, 2, 3, 4, 5, 6, 7, 125, 126, 127, 128, 129, 250, 251, 252, 253, 254, 255 };
GLfloat expectedData[mVertexCount];
......@@ -131,7 +136,7 @@ TEST_F(VertexAttributeTest, UnsignedByteUnnormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, UnsignedByteNormalized)
TYPED_TEST(VertexAttributeTest, UnsignedByteNormalized)
{
GLubyte inputData[mVertexCount] = { 0, 1, 2, 3, 4, 5, 6, 7, 125, 126, 127, 128, 129, 250, 251, 252, 253, 254, 255 };
GLfloat expectedData[mVertexCount];
......@@ -144,7 +149,7 @@ TEST_F(VertexAttributeTest, UnsignedByteNormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, ByteUnnormalized)
TYPED_TEST(VertexAttributeTest, ByteUnnormalized)
{
GLbyte inputData[mVertexCount] = { 0, 1, 2, 3, 4, -1, -2, -3, -4, 125, 126, 127, -128, -127, -126 };
GLfloat expectedData[mVertexCount];
......@@ -157,7 +162,7 @@ TEST_F(VertexAttributeTest, ByteUnnormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, ByteNormalized)
TYPED_TEST(VertexAttributeTest, ByteNormalized)
{
GLbyte inputData[mVertexCount] = { 0, 1, 2, 3, 4, -1, -2, -3, -4, 125, 126, 127, -128, -127, -126 };
GLfloat expectedData[mVertexCount];
......@@ -170,7 +175,7 @@ TEST_F(VertexAttributeTest, ByteNormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, UnsignedShortUnnormalized)
TYPED_TEST(VertexAttributeTest, UnsignedShortUnnormalized)
{
GLushort inputData[mVertexCount] = { 0, 1, 2, 3, 254, 255, 256, 32766, 32767, 32768, 65533, 65534, 65535 };
GLfloat expectedData[mVertexCount];
......@@ -183,7 +188,7 @@ TEST_F(VertexAttributeTest, UnsignedShortUnnormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, UnsignedShortNormalized)
TYPED_TEST(VertexAttributeTest, UnsignedShortNormalized)
{
GLushort inputData[mVertexCount] = { 0, 1, 2, 3, 254, 255, 256, 32766, 32767, 32768, 65533, 65534, 65535 };
GLfloat expectedData[mVertexCount];
......@@ -196,7 +201,7 @@ TEST_F(VertexAttributeTest, UnsignedShortNormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, ShortUnnormalized)
TYPED_TEST(VertexAttributeTest, ShortUnnormalized)
{
GLshort inputData[mVertexCount] = { 0, 1, 2, 3, -1, -2, -3, -4, 32766, 32767, -32768, -32767, -32766 };
GLfloat expectedData[mVertexCount];
......@@ -209,7 +214,7 @@ TEST_F(VertexAttributeTest, ShortUnnormalized)
runTest(data);
}
TEST_F(VertexAttributeTest, ShortNormalized)
TYPED_TEST(VertexAttributeTest, ShortNormalized)
{
GLshort inputData[mVertexCount] = { 0, 1, 2, 3, -1, -2, -3, -4, 32766, 32767, -32768, -32767, -32766 };
GLfloat expectedData[mVertexCount];
......
......@@ -66,7 +66,7 @@ EGLContext EGLWindow::getContext() const
return mContext;
}
bool EGLWindow::initializeGL(const OSWindow *osWindow)
bool EGLWindow::initializeGL(OSWindow *osWindow)
{
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
if (!eglGetPlatformDisplayEXT)
......@@ -87,6 +87,15 @@ bool EGLWindow::initializeGL(const OSWindow *osWindow)
return false;
}
if (osWindow->getRequestedRenderer() != EGL_NONE && osWindow->getRequestedRenderer() != mRequestedRenderer)
{
// The OS window should be recreated in this case, to ensure the requested renderer is created.
destroyGL();
return false;
}
osWindow->setRequestedRenderer(mRequestedRenderer);
EGLint majorVersion, minorVersion;
if (!eglInitialize(mDisplay, &majorVersion, &minorVersion))
{
......
......@@ -29,8 +29,8 @@ class EGLWindow
{
public:
EGLWindow(size_t width, size_t height,
EGLint glesMajorVersion = 2,
EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLint glesMajorVersion,
EGLint requestedRenderer);
~EGLWindow();
......@@ -64,7 +64,7 @@ class EGLWindow
bool isMultisample() const { return mMultisample; }
EGLint getSwapInterval() const { return mSwapInterval; }
bool initializeGL(const OSWindow *osWindow);
bool initializeGL(OSWindow *osWindow);
void destroyGL();
private:
......
......@@ -8,7 +8,8 @@
OSWindow::OSWindow()
: mWidth(0),
mHeight(0)
mHeight(0),
mRequestedRenderer(EGL_NONE)
{
}
......@@ -51,3 +52,13 @@ void OSWindow::pushEvent(Event event)
mEvents.push_back(event);
}
void OSWindow::setRequestedRenderer(EGLint requestedDisplayType)
{
mRequestedRenderer = requestedDisplayType;
}
EGLint OSWindow::getRequestedRenderer() const
{
return mRequestedRenderer;
}
\ No newline at end of file
......@@ -28,6 +28,9 @@ class OSWindow
virtual EGLNativeWindowType getNativeWindow() const = 0;
virtual EGLNativeDisplayType getNativeDisplay() const = 0;
void setRequestedRenderer(EGLint requestedDisplayType);
EGLint getRequestedRenderer() const ;
virtual void messageLoop() = 0;
bool popEvent(Event *event);
......@@ -41,6 +44,8 @@ class OSWindow
int mWidth;
int mHeight;
EGLint mRequestedRenderer;
std::list<Event> mEvents;
};
......
//
// Copyright (c) 2014 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.
//
#ifndef UTIL_TEST_FIXTURE_TYPES_H
#define UTIL_TEST_FIXTURE_TYPES_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
namespace Gles
{
struct Two
{
static EGLint GetGlesMajorVersion()
{
return 2;
};
};
struct Three
{
static EGLint GetGlesMajorVersion()
{
return 3;
};
};
}
namespace Rend
{
struct D3D11
{
static EGLint GetRequestedRenderer()
{
return EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
};
};
struct D3D9
{
static EGLint GetRequestedRenderer()
{
return EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE;
};
};
struct WARP
{
static EGLint GetRequestedRenderer()
{
return EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE;
};
};
}
// Test Fixture Type
template<typename GlesVersionT, typename RendererT>
struct TFT
{
static EGLint GetGlesMajorVersion()
{
return GlesVersionT::GetGlesMajorVersion();
}
static EGLint GetRequestedRenderer()
{
return RendererT::GetRequestedRenderer();
}
};
#endif // UTIL_TEST_FIXTURE_TYPES_H
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment