summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/tests/gl_tests
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
commitfc61780b35af913801d72086456f493f63197da6 (patch)
treef85891288a7bd988da9f0f15ae64e5c63f00d493 /gfx/angle/src/tests/gl_tests
parent69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff)
parent50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff)
downloadUXP-2018.07.18.tar
UXP-2018.07.18.tar.gz
UXP-2018.07.18.tar.lz
UXP-2018.07.18.tar.xz
UXP-2018.07.18.zip
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts: # browser/app/profile/firefox.js # browser/components/preferences/jar.mn
Diffstat (limited to 'gfx/angle/src/tests/gl_tests')
-rw-r--r--gfx/angle/src/tests/gl_tests/BindGeneratesResourceTest.cpp123
-rwxr-xr-xgfx/angle/src/tests/gl_tests/BlendMinMaxTest.cpp79
-rwxr-xr-xgfx/angle/src/tests/gl_tests/BufferDataTest.cpp56
-rw-r--r--gfx/angle/src/tests/gl_tests/CopyCompressedTextureTest.cpp369
-rwxr-xr-xgfx/angle/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp9
-rwxr-xr-xgfx/angle/src/tests/gl_tests/D3D11FormatTablesTest.cpp14
-rw-r--r--gfx/angle/src/tests/gl_tests/D3DTextureTest.cpp326
-rwxr-xr-xgfx/angle/src/tests/gl_tests/DrawBuffersTest.cpp21
-rwxr-xr-xgfx/angle/src/tests/gl_tests/ETCTextureTest.cpp8
-rwxr-xr-xgfx/angle/src/tests/gl_tests/GLSLTest.cpp188
-rwxr-xr-xgfx/angle/src/tests/gl_tests/MipmapTest.cpp10
-rwxr-xr-xgfx/angle/src/tests/gl_tests/MultisampleCompatibilityTest.cpp140
-rwxr-xr-xgfx/angle/src/tests/gl_tests/ReadPixelsTest.cpp145
-rw-r--r--gfx/angle/src/tests/gl_tests/RobustClientMemoryTest.cpp385
-rw-r--r--gfx/angle/src/tests/gl_tests/SRGBFramebufferTest.cpp141
-rwxr-xr-xgfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp122
-rwxr-xr-xgfx/angle/src/tests/gl_tests/SwizzleTest.cpp31
-rwxr-xr-xgfx/angle/src/tests/gl_tests/TextureTest.cpp248
-rwxr-xr-xgfx/angle/src/tests/gl_tests/TimerQueriesTest.cpp7
-rwxr-xr-xgfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp77
-rwxr-xr-xgfx/angle/src/tests/gl_tests/UniformBufferTest.cpp242
-rwxr-xr-xgfx/angle/src/tests/gl_tests/UniformTest.cpp52
-rwxr-xr-xgfx/angle/src/tests/gl_tests/VertexAttributeTest.cpp2
-rw-r--r--gfx/angle/src/tests/gl_tests/WebGLCompatibilityTest.cpp154
24 files changed, 207 insertions, 2742 deletions
diff --git a/gfx/angle/src/tests/gl_tests/BindGeneratesResourceTest.cpp b/gfx/angle/src/tests/gl_tests/BindGeneratesResourceTest.cpp
deleted file mode 100644
index e8ae739f8..000000000
--- a/gfx/angle/src/tests/gl_tests/BindGeneratesResourceTest.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// 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.
-//
-
-// BindGeneratesResourceTest.cpp : Tests of the GL_CHROMIUM_bind_generates_resource extension.
-
-#include "test_utils/ANGLETest.h"
-
-namespace angle
-{
-
-class BindGeneratesResourceTest : public ANGLETest
-{
- protected:
- BindGeneratesResourceTest() { setBindGeneratesResource(false); }
-};
-
-// Context creation would fail if EGL_CHROMIUM_create_context_bind_generates_resource was not
-// available so the GL extension should always be present
-TEST_P(BindGeneratesResourceTest, ExtensionStringExposed)
-{
- EXPECT_TRUE(extensionEnabled("GL_CHROMIUM_bind_generates_resource"));
-}
-
-// Verify that GL_BIND_GENERATES_RESOURCE_CHROMIUM can be queried but not changed
-TEST_P(BindGeneratesResourceTest, QueryValidation)
-{
- GLint intValue = 2;
- glGetIntegerv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &intValue);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(intValue, GL_FALSE);
-
- float floatValue = 2.0f;
- glGetFloatv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &floatValue);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(floatValue, 0.0f);
-
- GLboolean boolValue = GL_TRUE;
- glGetBooleanv(GL_BIND_GENERATES_RESOURCE_CHROMIUM, &boolValue);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(boolValue, GL_FALSE);
-
- boolValue = glIsEnabled(GL_BIND_GENERATES_RESOURCE_CHROMIUM);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(boolValue, GL_FALSE);
-
- glEnable(GL_BIND_GENERATES_RESOURCE_CHROMIUM);
- EXPECT_GL_ERROR(GL_INVALID_ENUM);
-
- glDisable(GL_BIND_GENERATES_RESOURCE_CHROMIUM);
- EXPECT_GL_ERROR(GL_INVALID_ENUM);
-}
-
-// Test that buffers cannot be generated on bind
-TEST_P(BindGeneratesResourceTest, Buffers)
-{
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 2);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- EXPECT_GL_NO_ERROR();
-
- if (getClientMajorVersion() >= 3)
- {
- glBindBufferBase(GL_UNIFORM_BUFFER, 0, 3);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindBufferBase(GL_UNIFORM_BUFFER, 0, 0);
- EXPECT_GL_NO_ERROR();
-
- glBindBufferRange(GL_UNIFORM_BUFFER, 0, 4, 1, 2);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindBufferRange(GL_UNIFORM_BUFFER, 0, 0, 1, 2);
- EXPECT_GL_NO_ERROR();
- }
-}
-
-// Test that textures cannot be generated on bind
-TEST_P(BindGeneratesResourceTest, Textures)
-{
- glBindTexture(GL_TEXTURE_2D, 2);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- EXPECT_GL_NO_ERROR();
-}
-
-// Test that framebuffers cannot be generated on bind
-TEST_P(BindGeneratesResourceTest, Framebuffers)
-{
- glBindFramebuffer(GL_FRAMEBUFFER, 2);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- EXPECT_GL_NO_ERROR();
-}
-
-// Test that renderbuffer cannot be generated on bind
-TEST_P(BindGeneratesResourceTest, Renderbuffers)
-{
- glBindRenderbuffer(GL_RENDERBUFFER, 2);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- glBindRenderbuffer(GL_RENDERBUFFER, 0);
- EXPECT_GL_NO_ERROR();
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(BindGeneratesResourceTest,
- ES2_D3D9(),
- ES2_D3D11(),
- ES3_D3D11(),
- ES2_D3D11_FL9_3(),
- ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
-
-} // namespace
diff --git a/gfx/angle/src/tests/gl_tests/BlendMinMaxTest.cpp b/gfx/angle/src/tests/gl_tests/BlendMinMaxTest.cpp
index 39f5251e5..8ccaf9274 100755
--- a/gfx/angle/src/tests/gl_tests/BlendMinMaxTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/BlendMinMaxTest.cpp
@@ -32,12 +32,13 @@ class BlendMinMaxTest : public ANGLETest
float values[4];
};
- static float getExpected(bool blendMin, float curColor, float prevColor)
+ static GLubyte getExpected(bool blendMin, float curColor, GLubyte prevColor)
{
- return blendMin ? std::min(curColor, prevColor) : std::max(curColor, prevColor);
+ GLubyte curAsUbyte = static_cast<GLubyte>((curColor * std::numeric_limits<GLubyte>::max()) + 0.5f);
+ return blendMin ? std::min<GLubyte>(curAsUbyte, prevColor) : std::max<GLubyte>(curAsUbyte, prevColor);
}
- void runTest(GLenum colorFormat, GLenum type)
+ void runTest(GLenum colorFormat)
{
if (getClientMajorVersion() < 3 && !extensionEnabled("GL_EXT_blend_minmax"))
{
@@ -54,26 +55,17 @@ class BlendMinMaxTest : public ANGLETest
SetUpFramebuffer(colorFormat);
- int minValue = 0;
- int maxValue = 1;
- if (type == GL_FLOAT)
- {
- minValue = -1024;
- maxValue = 1024;
- }
-
- const size_t colorCount = 128;
+ const size_t colorCount = 1024;
Color colors[colorCount];
for (size_t i = 0; i < colorCount; i++)
{
for (size_t j = 0; j < 4; j++)
{
- colors[i].values[j] =
- static_cast<float>(minValue + (rand() % (maxValue - minValue)));
+ colors[i].values[j] = (rand() % 255) / 255.0f;
}
}
- float prevColor[4];
+ GLubyte prevColor[4];
for (size_t i = 0; i < colorCount; i++)
{
const Color &color = colors[i];
@@ -85,37 +77,16 @@ class BlendMinMaxTest : public ANGLETest
drawQuad(mProgram, "aPosition", 0.5f);
- float pixel[4];
- if (type == GL_UNSIGNED_BYTE)
- {
- GLubyte ubytePixel[4];
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, ubytePixel);
- for (size_t componentIdx = 0; componentIdx < ArraySize(pixel); componentIdx++)
- {
- pixel[componentIdx] = ubytePixel[componentIdx] / 255.0f;
- }
- }
- else if (type == GL_FLOAT)
- {
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_FLOAT, pixel);
- }
- else
- {
- FAIL() << "Unexpected pixel type";
- }
-
if (i > 0)
{
- const float errorRange = 1.0f / 255.0f;
- for (size_t componentIdx = 0; componentIdx < ArraySize(pixel); componentIdx++)
- {
- EXPECT_NEAR(
- getExpected(blendMin, color.values[componentIdx], prevColor[componentIdx]),
- pixel[componentIdx], errorRange);
- }
+ EXPECT_PIXEL_EQ(0, 0,
+ getExpected(blendMin, color.values[0], prevColor[0]),
+ getExpected(blendMin, color.values[1], prevColor[1]),
+ getExpected(blendMin, color.values[2], prevColor[2]),
+ getExpected(blendMin, color.values[3], prevColor[3]));
}
- memcpy(prevColor, pixel, sizeof(pixel));
+ glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, prevColor);
}
}
@@ -171,9 +142,6 @@ class BlendMinMaxTest : public ANGLETest
glRenderbufferStorage(GL_RENDERBUFFER, colorFormat, getWindowWidth(), getWindowHeight());
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mColorRenderbuffer);
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- glClear(GL_COLOR_BUFFER_BIT);
-
ASSERT_GL_NO_ERROR();
}
@@ -195,10 +163,10 @@ class BlendMinMaxTest : public ANGLETest
TEST_P(BlendMinMaxTest, RGBA8)
{
- runTest(GL_RGBA8, GL_UNSIGNED_BYTE);
+ runTest(GL_RGBA8);
}
-TEST_P(BlendMinMaxTest, RGBA32F)
+TEST_P(BlendMinMaxTest, RGBA32f)
{
if (getClientMajorVersion() < 3 || !extensionEnabled("GL_EXT_color_buffer_float"))
{
@@ -221,7 +189,7 @@ TEST_P(BlendMinMaxTest, RGBA32F)
return;
}
- runTest(GL_RGBA32F, GL_FLOAT);
+ runTest(GL_RGBA32F);
}
TEST_P(BlendMinMaxTest, RGBA16F)
@@ -240,16 +208,21 @@ TEST_P(BlendMinMaxTest, RGBA16F)
return;
}
- runTest(GL_RGBA16F, GL_FLOAT);
+ // TODO(geofflang): This fails because readpixels with UNSIGNED_BYTE/RGBA does not work with
+ // half float buffers (http://anglebug.com/1288)
+ if (GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE)
+ {
+ std::cout << "Test skipped on OpenGL ES targets." << std::endl;
+ return;
+ }
+
+ runTest(GL_RGBA16F);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(BlendMinMaxTest,
ES2_D3D9(),
ES2_D3D11(),
- ES3_D3D11(),
ES2_D3D11_FL9_3(),
ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
+ ES2_OPENGLES());
diff --git a/gfx/angle/src/tests/gl_tests/BufferDataTest.cpp b/gfx/angle/src/tests/gl_tests/BufferDataTest.cpp
index 7707a4a56..572cce9c8 100755
--- a/gfx/angle/src/tests/gl_tests/BufferDataTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/BufferDataTest.cpp
@@ -5,7 +5,6 @@
//
#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
#include <stdint.h>
@@ -448,8 +447,24 @@ class BufferDataOverflowTest : public ANGLETest
{
protected:
BufferDataOverflowTest()
+ : mProgram(0)
{
}
+
+ ~BufferDataOverflowTest()
+ {
+ if (!mBuffers.empty())
+ {
+ glDeleteBuffers(static_cast<GLsizei>(mBuffers.size()), &mBuffers[0]);
+ }
+ if (mProgram != 0u)
+ {
+ glDeleteProgram(mProgram);
+ }
+ }
+
+ std::vector<GLuint> mBuffers;
+ GLuint mProgram;
};
// See description above.
@@ -457,9 +472,9 @@ TEST_P(BufferDataOverflowTest, VertexBufferIntegerOverflow)
{
// These values are special, to trigger the rounding bug.
unsigned int numItems = 0x7FFFFFE;
- constexpr GLsizei bufferCnt = 8;
+ GLsizei bufferCnt = 8;
- std::vector<GLBuffer> buffers(bufferCnt);
+ mBuffers.resize(bufferCnt);
std::stringstream vertexShaderStr;
@@ -487,27 +502,30 @@ TEST_P(BufferDataOverflowTest, VertexBufferIntegerOverflow)
" gl_FragColor = vec4(v_attrib, 0, 0, 1);\n"
"}";
- ANGLE_GL_PROGRAM(program, vertexShaderStr.str(), fragmentShader);
- glUseProgram(program.get());
+ mProgram = CompileProgram(vertexShaderStr.str(), fragmentShader);
+ ASSERT_NE(0u, mProgram);
+ glUseProgram(mProgram);
+
+ glGenBuffers(bufferCnt, &mBuffers[0]);
std::vector<GLfloat> data(numItems, 1.0f);
for (GLsizei bufferIndex = 0; bufferIndex < bufferCnt; ++bufferIndex)
{
- glBindBuffer(GL_ARRAY_BUFFER, buffers[bufferIndex].get());
+ glBindBuffer(GL_ARRAY_BUFFER, mBuffers[bufferIndex]);
glBufferData(GL_ARRAY_BUFFER, numItems * sizeof(float), &data[0], GL_DYNAMIC_DRAW);
std::stringstream attribNameStr;
attribNameStr << "attrib" << bufferIndex;
- GLint attribLocation = glGetAttribLocation(program.get(), attribNameStr.str().c_str());
+ GLint attribLocation = glGetAttribLocation(mProgram, attribNameStr.str().c_str());
ASSERT_NE(-1, attribLocation);
glVertexAttribPointer(attribLocation, 1, GL_FLOAT, GL_FALSE, 4, nullptr);
glEnableVertexAttribArray(attribLocation);
}
- GLint positionLocation = glGetAttribLocation(program.get(), "position");
+ GLint positionLocation = glGetAttribLocation(mProgram, "position");
ASSERT_NE(-1, positionLocation);
glDisableVertexAttribArray(positionLocation);
glVertexAttrib2f(positionLocation, 1.0f, 1.0f);
@@ -517,28 +535,6 @@ TEST_P(BufferDataOverflowTest, VertexBufferIntegerOverflow)
EXPECT_GL_ERROR(GL_OUT_OF_MEMORY);
}
-// Tests a security bug in our CopyBufferSubData validation (integer overflow).
-TEST_P(BufferDataOverflowTest, CopySubDataValidation)
-{
- GLBuffer readBuffer, writeBuffer;
-
- glBindBuffer(GL_COPY_READ_BUFFER, readBuffer.get());
- glBindBuffer(GL_COPY_WRITE_BUFFER, writeBuffer.get());
-
- constexpr int bufSize = 100;
-
- glBufferData(GL_COPY_READ_BUFFER, bufSize, nullptr, GL_STATIC_DRAW);
- glBufferData(GL_COPY_WRITE_BUFFER, bufSize, nullptr, GL_STATIC_DRAW);
-
- GLintptr big = std::numeric_limits<GLintptr>::max() - bufSize + 90;
-
- glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, big, 0, 50);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-
- glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, big, 50);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-}
-
ANGLE_INSTANTIATE_TEST(BufferDataOverflowTest, ES3_D3D11());
#endif // _WIN64
diff --git a/gfx/angle/src/tests/gl_tests/CopyCompressedTextureTest.cpp b/gfx/angle/src/tests/gl_tests/CopyCompressedTextureTest.cpp
deleted file mode 100644
index 4d4151949..000000000
--- a/gfx/angle/src/tests/gl_tests/CopyCompressedTextureTest.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-//
-// Copyright 2016 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.
-//
-
-// CopyCompressedTextureTest.cpp: Tests of the GL_CHROMIUM_copy_compressed_texture extension
-
-#include "test_utils/ANGLETest.h"
-
-namespace angle
-{
-
-class CopyCompressedTextureTest : public ANGLETest
-{
- protected:
- CopyCompressedTextureTest()
- {
- setWindowWidth(256);
- setWindowHeight(256);
- setConfigRedBits(8);
- setConfigGreenBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- }
-
- void SetUp() override
- {
- ANGLETest::SetUp();
-
- glGenTextures(2, mTextures);
-
- mProgram = CompileProgram(
- "attribute vec2 a_position;\n"
- "varying vec2 v_texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(a_position, 0.0, 1.0);\n"
- " v_texcoord = (a_position + 1.0) * 0.5;\n"
- "}\n",
- "precision mediump float;\n"
- "uniform sampler2D u_texture;\n"
- "varying vec2 v_texcoord;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texture2D(u_texture, v_texcoord);\n"
- "}\n");
- ASSERT_NE(0u, mProgram);
-
- if (extensionEnabled("GL_CHROMIUM_copy_compressed_texture"))
- {
- glCompressedCopyTextureCHROMIUM =
- reinterpret_cast<PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC>(
- eglGetProcAddress("glCompressedCopyTextureCHROMIUM"));
- }
- }
-
- void TearDown() override
- {
- glDeleteTextures(2, mTextures);
- glDeleteProgram(mProgram);
-
- ANGLETest::TearDown();
- }
-
- bool checkExtensions() const
- {
- if (!extensionEnabled("GL_CHROMIUM_copy_compressed_texture"))
- {
- std::cout
- << "Test skipped because GL_CHROMIUM_copy_compressed_texture is not available."
- << std::endl;
- return false;
- }
-
- EXPECT_NE(nullptr, glCompressedCopyTextureCHROMIUM);
- if (glCompressedCopyTextureCHROMIUM == nullptr)
- {
- return false;
- }
-
- return true;
- }
-
- GLuint mProgram = 0;
- GLuint mTextures[2] = {0, 0};
-
- PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC glCompressedCopyTextureCHROMIUM = nullptr;
-};
-
-namespace
-{
-
-const GLColor &CompressedImageColor = GLColor::red;
-
-// Single compressed ATC block of source pixels all set to:
-// CompressedImageColor.
-const uint8_t CompressedImageATC[8] = {0x0, 0x7c, 0x0, 0xf8, 0x55, 0x55, 0x55, 0x55};
-
-// Single compressed ATCIA block of source pixels all set to:
-// CompressedImageColor.
-const uint8_t CompressedImageATCIA[16] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0x7c, 0x0, 0xf8, 0x55, 0x55, 0x55, 0x55};
-
-// Single compressed DXT1 block of source pixels all set to:
-// CompressedImageColor.
-const uint8_t CompressedImageDXT1[8] = {0x00, 0xf8, 0x00, 0xf8, 0xaa, 0xaa, 0xaa, 0xaa};
-
-// Single compressed DXT5 block of source pixels all set to:
-// CompressedImageColor.
-const uint8_t CompressedImageDXT5[16] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
- 0x0, 0xf8, 0x0, 0xf8, 0xaa, 0xaa, 0xaa, 0xaa};
-
-// Single compressed DXT1 block of source pixels all set to:
-// CompressedImageColor.
-const uint8_t CompressedImageETC1[8] = {0x0, 0x0, 0xf8, 0x2, 0xff, 0xff, 0x0, 0x0};
-
-} // anonymous namespace
-
-// Test to ensure that the basic functionality of the extension works.
-TEST_P(CopyCompressedTextureTest, Basic)
-{
- if (!checkExtensions())
- {
- return;
- }
-
- if (!extensionEnabled("GL_EXT_texture_compression_dxt1"))
- {
- std::cout << "Test skipped because GL_EXT_texture_compression_dxt1 is not available."
- << std::endl;
- return;
- }
-
- glBindTexture(GL_TEXTURE_2D, mTextures[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0,
- sizeof(CompressedImageDXT1), CompressedImageDXT1);
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- ASSERT_GL_NO_ERROR();
-
- // Load texture.
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- GLint textureLoc = glGetUniformLocation(mProgram, "u_texture");
- glUseProgram(mProgram);
- glUniform1i(textureLoc, 0);
-
- // Draw.
- drawQuad(mProgram, "a_position", 0.5f);
-
- EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 2, getWindowHeight() / 2, CompressedImageColor);
- ASSERT_GL_NO_ERROR();
-}
-
-// Test validation of compressed formats
-TEST_P(CopyCompressedTextureTest, InternalFormat)
-{
- if (!checkExtensions())
- {
- return;
- }
-
- struct Data
- {
- GLint format;
- const uint8_t *data;
- GLsizei dataSize;
-
- Data() : Data(GL_NONE, nullptr, 0) {}
- Data(GLint format, const uint8_t *data, GLsizei dataSize)
- : format(format), data(data), dataSize(dataSize)
- {
- }
- };
- std::vector<Data> supportedFormats;
-
- if (extensionEnabled("GL_AMD_compressed_ATC_texture"))
- {
- supportedFormats.push_back(
- Data(GL_ATC_RGB_AMD, CompressedImageATC, sizeof(CompressedImageATC)));
- supportedFormats.push_back(Data(GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD, CompressedImageATCIA,
- sizeof(CompressedImageATCIA)));
- }
- if (extensionEnabled("GL_EXT_texture_compression_dxt1"))
- {
- supportedFormats.push_back(Data(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, CompressedImageDXT1,
- sizeof(CompressedImageDXT1)));
- }
- if (extensionEnabled("GL_ANGLE_texture_compression_dxt5"))
- {
- supportedFormats.push_back(Data(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, CompressedImageDXT5,
- sizeof(CompressedImageDXT5)));
- }
- if (extensionEnabled("GL_OES_compressed_ETC1_RGB8_texture"))
- {
- supportedFormats.push_back(
- Data(GL_ETC1_RGB8_OES, CompressedImageETC1, sizeof(CompressedImageETC1)));
- }
-
- for (const auto &supportedFormat : supportedFormats)
- {
- glBindTexture(GL_TEXTURE_2D, mTextures[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, supportedFormat.format, 4, 4, 0,
- supportedFormat.dataSize, supportedFormat.data);
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- ASSERT_GL_NO_ERROR();
- }
-}
-
-// Test that uncompressed textures generate errors when copying
-TEST_P(CopyCompressedTextureTest, InternalFormatNotSupported)
-{
- if (!checkExtensions())
- {
- return;
- }
-
- glBindTexture(GL_TEXTURE_2D, mTextures[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &GLColor::red);
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- ASSERT_GL_NO_ERROR();
-
- // Check that the GL_RGBA format reports an error.
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-}
-
-// Test validation of texture IDs
-TEST_P(CopyCompressedTextureTest, InvalidTextureIds)
-{
- if (!checkExtensions())
- {
- return;
- }
-
- glBindTexture(GL_TEXTURE_2D, mTextures[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0,
- sizeof(CompressedImageDXT1), CompressedImageDXT1);
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- ASSERT_GL_NO_ERROR();
-
- glCompressedCopyTextureCHROMIUM(mTextures[0], 99993);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-
- glCompressedCopyTextureCHROMIUM(99994, mTextures[1]);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-
- glCompressedCopyTextureCHROMIUM(99995, 99996);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- EXPECT_GL_NO_ERROR();
-}
-
-// Test that only 2D textures are valid
-TEST_P(CopyCompressedTextureTest, BindingPoints)
-{
- if (!checkExtensions())
- {
- return;
- }
-
- glBindTexture(GL_TEXTURE_CUBE_MAP, mTextures[0]);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
- face++)
- {
- glCompressedTexImage2D(face, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0,
- sizeof(CompressedImageDXT1), CompressedImageDXT1);
- }
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_CUBE_MAP, mTextures[1]);
- glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- ASSERT_GL_NO_ERROR();
-
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- EXPECT_GL_ERROR(GL_INVALID_VALUE);
-}
-
-// Test the destination texture cannot be immutable
-TEST_P(CopyCompressedTextureTest, Immutable)
-{
- if (!checkExtensions() || getClientMajorVersion() < 3)
- {
- return;
- }
-
- glBindTexture(GL_TEXTURE_2D, mTextures[0]);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4, 0,
- sizeof(CompressedImageDXT1), CompressedImageDXT1);
- ASSERT_GL_NO_ERROR();
-
- glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexStorage2D(GL_TEXTURE_2D, 1, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, 4, 4);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- ASSERT_GL_NO_ERROR();
-
- glCompressedCopyTextureCHROMIUM(mTextures[0], mTextures[1]);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(CopyCompressedTextureTest,
- ES2_D3D9(),
- ES2_D3D11(),
- ES3_D3D11(),
- ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
-
-} // namespace angle
diff --git a/gfx/angle/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp b/gfx/angle/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
index c26cf0e08..5cdcb96cc 100755
--- a/gfx/angle/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/D3D11EmulatedIndexedBufferTest.cpp
@@ -35,10 +35,9 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
rx::Context11 *context11 = rx::GetImplAs<rx::Context11>(context);
mRenderer = context11->getRenderer();
- mSourceBuffer = new rx::Buffer11(mBufferState, mRenderer);
+ mSourceBuffer = new rx::Buffer11(mRenderer);
GLfloat testData[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f };
- gl::Error error =
- mSourceBuffer->setData(GL_ARRAY_BUFFER, testData, sizeof(testData), GL_STATIC_DRAW);
+ gl::Error error = mSourceBuffer->setData(testData, sizeof(testData), GL_STATIC_DRAW);
ASSERT_FALSE(error.isError());
mTranslatedAttribute.baseOffset = 0;
@@ -127,7 +126,6 @@ class D3D11EmulatedIndexedBufferTest : public ANGLETest
std::vector<GLubyte> mubyteIndices;
std::vector<GLuint> muintIndices;
std::vector<GLushort> mushortIndices;
- gl::BufferState mBufferState;
};
// This tests that a GL_UNSIGNED_BYTE indices list can be successfully expanded
@@ -164,8 +162,7 @@ TEST_P(D3D11EmulatedIndexedBufferTest, TestNativeToExpandedUsingGLuintIndices)
TEST_P(D3D11EmulatedIndexedBufferTest, TestSourceBufferRemainsUntouchedAfterExpandOperation)
{
// Copy the original source buffer before any expand calls have been made
- gl::BufferState cleanSourceState;
- rx::Buffer11 *cleanSourceBuffer = new rx::Buffer11(cleanSourceState, mRenderer);
+ rx::Buffer11 *cleanSourceBuffer = new rx::Buffer11(mRenderer);
cleanSourceBuffer->copySubData(mSourceBuffer, 0, 0, mSourceBuffer->getSize());
// Do a basic exanded and compare test.
diff --git a/gfx/angle/src/tests/gl_tests/D3D11FormatTablesTest.cpp b/gfx/angle/src/tests/gl_tests/D3D11FormatTablesTest.cpp
index e407d1190..1876e3b34 100755
--- a/gfx/angle/src/tests/gl_tests/D3D11FormatTablesTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/D3D11FormatTablesTest.cpp
@@ -11,7 +11,6 @@
#include "libANGLE/Context.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/d3d11/Context11.h"
-#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
@@ -66,22 +65,13 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
}
}
- UINT texSupport = 0;
+ UINT texSupport;
bool texSuccess = SUCCEEDED(device->CheckFormatSupport(formatInfo.texFormat, &texSupport));
bool textureable = texSuccess && ((texSupport & texSupportMask) == texSupportMask);
EXPECT_EQ(textureable, textureInfo.texturable);
- // Bits for mipmap auto-gen.
- bool expectedMipGen = texSuccess && ((texSupport & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
- auto featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
- const auto &dxgiSupport = rx::d3d11::GetDXGISupport(formatInfo.texFormat, featureLevel);
- bool actualMipGen =
- ((dxgiSupport.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
- EXPECT_EQ(0u, dxgiSupport.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN);
- EXPECT_EQ(expectedMipGen, actualMipGen);
-
// Bits for filtering
- UINT filterSupport = 0;
+ UINT filterSupport;
bool filterSuccess =
SUCCEEDED(device->CheckFormatSupport(formatInfo.srvFormat, &filterSupport));
bool filterable = filterSuccess && ((filterSupport & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE) != 0);
diff --git a/gfx/angle/src/tests/gl_tests/D3DTextureTest.cpp b/gfx/angle/src/tests/gl_tests/D3DTextureTest.cpp
deleted file mode 100644
index 028b24a81..000000000
--- a/gfx/angle/src/tests/gl_tests/D3DTextureTest.cpp
+++ /dev/null
@@ -1,326 +0,0 @@
-//
-// 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.
-//
-// D3DTextureTest:
-// Tests of the EGL_ANGLE_d3d_texture_client_buffer extension
-
-#include "test_utils/ANGLETest.h"
-
-#include <d3d11.h>
-#include <windows.h>
-
-#include "com_utils.h"
-
-namespace angle
-{
-
-class D3DTextureTest : public ANGLETest
-{
- protected:
- D3DTextureTest()
- {
- setWindowWidth(128);
- setWindowHeight(128);
- setConfigRedBits(8);
- setConfigGreenBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- }
-
- void SetUp() override
- {
- ANGLETest::SetUp();
-
- // clang-format off
- const std::string vsSource = SHADER_SOURCE
- (
- precision highp float;
- attribute vec4 position;
- varying vec2 texcoord;
-
- void main()
- {
- gl_Position = position;
- texcoord = (position.xy * 0.5) + 0.5;
- texcoord.y = 1.0 - texcoord.y;
- }
- );
-
- const std::string textureFSSource = SHADER_SOURCE
- (
- precision highp float;
- uniform sampler2D tex;
- varying vec2 texcoord;
-
- void main()
- {
- gl_FragColor = texture2D(tex, texcoord);
- }
- );
- // clang-format on
-
- mTextureProgram = CompileProgram(vsSource, textureFSSource);
- ASSERT_NE(0u, mTextureProgram) << "shader compilation failed.";
-
- mTextureUniformLocation = glGetUniformLocation(mTextureProgram, "tex");
- ASSERT_NE(-1, mTextureUniformLocation);
-
- mD3D11Module = LoadLibrary(TEXT("d3d11.dll"));
- ASSERT_NE(nullptr, mD3D11Module);
-
- PFN_D3D11_CREATE_DEVICE createDeviceFunc = reinterpret_cast<PFN_D3D11_CREATE_DEVICE>(
- GetProcAddress(mD3D11Module, "D3D11CreateDevice"));
-
- EGLWindow *window = getEGLWindow();
- EGLDisplay display = window->getDisplay();
- if (eglDisplayExtensionEnabled(display, "EGL_EXT_device_query"))
- {
- PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT =
- reinterpret_cast<PFNEGLQUERYDISPLAYATTRIBEXTPROC>(
- eglGetProcAddress("eglQueryDisplayAttribEXT"));
- PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT =
- reinterpret_cast<PFNEGLQUERYDEVICEATTRIBEXTPROC>(
- eglGetProcAddress("eglQueryDeviceAttribEXT"));
-
- EGLDeviceEXT device = 0;
- {
- EGLAttrib result = 0;
- EXPECT_EGL_TRUE(eglQueryDisplayAttribEXT(display, EGL_DEVICE_EXT, &result));
- device = reinterpret_cast<EGLDeviceEXT>(result);
- }
-
- if (eglDeviceExtensionEnabled(device, "EGL_ANGLE_device_d3d"))
- {
- EGLAttrib result = 0;
- if (eglQueryDeviceAttribEXT(device, EGL_D3D11_DEVICE_ANGLE, &result))
- {
- mD3D11Device = reinterpret_cast<ID3D11Device *>(result);
- mD3D11Device->AddRef();
- }
- else if (eglQueryDeviceAttribEXT(device, EGL_D3D9_DEVICE_ANGLE, &result))
- {
- mD3D9Device = reinterpret_cast<IDirect3DDevice9 *>(result);
- mD3D9Device->AddRef();
- }
- }
- }
- else
- {
- ASSERT_TRUE(
- SUCCEEDED(createDeviceFunc(nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, nullptr,
- 0, D3D11_SDK_VERSION, &mD3D11Device, nullptr, nullptr)));
- }
- }
-
- void TearDown() override
- {
- glDeleteProgram(mTextureProgram);
-
- if (mD3D11Device)
- {
- mD3D11Device->Release();
- mD3D11Device = nullptr;
- }
-
- FreeLibrary(mD3D11Module);
- mD3D11Module = nullptr;
-
- if (mD3D9Device)
- {
- mD3D9Device->Release();
- mD3D9Device = nullptr;
- }
-
- ANGLETest::TearDown();
- }
-
- EGLSurface createPBuffer(size_t width,
- size_t height,
- EGLint eglTextureFormat,
- EGLint eglTextureTarget)
- {
- EGLWindow *window = getEGLWindow();
- EGLDisplay display = window->getDisplay();
- EGLConfig config = window->getConfig();
-
- EGLint attribs[] = {
- EGL_TEXTURE_FORMAT, eglTextureFormat, EGL_TEXTURE_TARGET,
- eglTextureTarget, EGL_NONE, EGL_NONE,
- };
-
- if (mD3D11Device)
- {
- ID3D11Texture2D *texture = nullptr;
- CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8G8B8A8_UNORM, static_cast<UINT>(width),
- static_cast<UINT>(height), 1, 1,
- D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
- EXPECT_TRUE(SUCCEEDED(mD3D11Device->CreateTexture2D(&desc, nullptr, &texture)));
-
- EGLSurface pbuffer = eglCreatePbufferFromClientBuffer(display, EGL_D3D_TEXTURE_ANGLE,
- texture, config, attribs);
-
- texture->Release();
-
- return pbuffer;
- }
- else if (mD3D9Device)
- {
- IDirect3DTexture9 *texture = nullptr;
- EXPECT_TRUE(SUCCEEDED(mD3D9Device->CreateTexture(
- static_cast<UINT>(width), static_cast<UINT>(height), 1, D3DUSAGE_RENDERTARGET,
- D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &texture, nullptr)));
-
- EGLSurface pbuffer = eglCreatePbufferFromClientBuffer(display, EGL_D3D_TEXTURE_ANGLE,
- texture, config, attribs);
-
- texture->Release();
-
- return pbuffer;
- }
- else
- {
- return EGL_NO_SURFACE;
- }
- }
-
- bool valid() const
- {
- EGLWindow *window = getEGLWindow();
- EGLDisplay display = window->getDisplay();
- if (!eglDisplayExtensionEnabled(display, "EGL_ANGLE_d3d_texture_client_buffer"))
- {
- std::cout << "Test skipped due to missing EGL_ANGLE_d3d_texture_client_buffer"
- << std::endl;
- return false;
- }
-
- if (!mD3D11Device && !mD3D9Device)
- {
- std::cout << "Test skipped due to no D3D devices being available." << std::endl;
- return false;
- }
-
- if (IsWindows() && IsAMD() && IsOpenGL())
- {
- std::cout << "Test skipped on Windows AMD OpenGL." << std::endl;
- return false;
- }
-
- if (IsWindows() && IsIntel() && IsOpenGL())
- {
- std::cout << "Test skipped on Windows Intel OpenGL." << std::endl;
- return false;
- }
- return true;
- }
-
- GLuint mTextureProgram;
- GLint mTextureUniformLocation;
-
- HMODULE mD3D11Module = nullptr;
- ID3D11Device *mD3D11Device = nullptr;
-
- IDirect3DDevice9 *mD3D9Device = nullptr;
-};
-
-// Test creating a pbuffer from a d3d surface and clearing it
-TEST_P(D3DTextureTest, Clear)
-{
- if (!valid())
- {
- return;
- }
-
- EGLWindow *window = getEGLWindow();
- EGLDisplay display = window->getDisplay();
-
- const size_t bufferSize = 32;
-
- EGLSurface pbuffer = createPBuffer(bufferSize, bufferSize, EGL_NO_TEXTURE, EGL_NO_TEXTURE);
- ASSERT_EGL_SUCCESS();
- ASSERT_NE(pbuffer, EGL_NO_SURFACE);
-
- // Apply the Pbuffer and clear it to purple and verify
- eglMakeCurrent(display, pbuffer, pbuffer, window->getContext());
- ASSERT_EGL_SUCCESS();
-
- glViewport(0, 0, static_cast<GLsizei>(bufferSize), static_cast<GLsizei>(bufferSize));
- glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_EQ(static_cast<GLint>(bufferSize) / 2, static_cast<GLint>(bufferSize) / 2, 255, 0,
- 255, 255);
-
- eglDestroySurface(display, pbuffer);
-}
-
-// Test creating a pbuffer from a d3d surface and binding it to a texture
-TEST_P(D3DTextureTest, BindTexImage)
-{
- if (!valid())
- {
- return;
- }
-
- EGLWindow *window = getEGLWindow();
-
- const size_t bufferSize = 32;
-
- EGLSurface pbuffer = createPBuffer(bufferSize, bufferSize, EGL_TEXTURE_RGBA, EGL_TEXTURE_2D);
- ASSERT_EGL_SUCCESS();
- ASSERT_NE(pbuffer, EGL_NO_SURFACE);
-
- // Apply the Pbuffer and clear it to purple
- eglMakeCurrent(window->getDisplay(), pbuffer, pbuffer, window->getContext());
- ASSERT_EGL_SUCCESS();
-
- glViewport(0, 0, static_cast<GLsizei>(bufferSize), static_cast<GLsizei>(bufferSize));
- glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ASSERT_GL_NO_ERROR();
-
- EXPECT_PIXEL_EQ(static_cast<GLint>(bufferSize) / 2, static_cast<GLint>(bufferSize) / 2, 255, 0,
- 255, 255);
-
- // Apply the window surface
- eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(),
- window->getContext());
-
- // Create a texture and bind the Pbuffer to it
- GLuint texture = 0;
- glGenTextures(1, &texture);
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- EXPECT_GL_NO_ERROR();
-
- eglBindTexImage(window->getDisplay(), pbuffer, EGL_BACK_BUFFER);
- glViewport(0, 0, getWindowWidth(), getWindowHeight());
- ASSERT_EGL_SUCCESS();
-
- // Draw a quad and verify that it is purple
- glUseProgram(mTextureProgram);
- glUniform1i(mTextureUniformLocation, 0);
-
- drawQuad(mTextureProgram, "position", 0.5f);
- EXPECT_GL_NO_ERROR();
-
- // Unbind the texture
- eglReleaseTexImage(window->getDisplay(), pbuffer, EGL_BACK_BUFFER);
- ASSERT_EGL_SUCCESS();
-
- // Verify that purple was drawn
- EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255);
-
- glDeleteTextures(1, &texture);
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(D3DTextureTest, ES2_D3D9(), ES2_D3D11(), ES2_OPENGL());
-
-} // namespace
diff --git a/gfx/angle/src/tests/gl_tests/DrawBuffersTest.cpp b/gfx/angle/src/tests/gl_tests/DrawBuffersTest.cpp
index daf09e93c..48a6b65c9 100755
--- a/gfx/angle/src/tests/gl_tests/DrawBuffersTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/DrawBuffersTest.cpp
@@ -256,13 +256,6 @@ TEST_P(DrawBuffersTest, Gaps)
return;
}
- if (IsWindows() && IsAMD() && IsDesktopOpenGL())
- {
- // TODO(ynovikov): Investigate the failure (http://anglebug.com/1535)
- std::cout << "Test disabled on Windows AMD OpenGL." << std::endl;
- return;
- }
-
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, mTextures[0], 0);
@@ -294,13 +287,6 @@ TEST_P(DrawBuffersTest, FirstAndLast)
return;
}
- if (IsWindows() && IsAMD() && IsDesktopOpenGL())
- {
- // TODO(ynovikov): Investigate the failure (https://anglebug.com/1533)
- std::cout << "Test disabled on Windows AMD OpenGL." << std::endl;
- return;
- }
-
glBindTexture(GL_TEXTURE_2D, mTextures[0]);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTextures[0], 0);
@@ -341,13 +327,6 @@ TEST_P(DrawBuffersTest, FirstHalfNULL)
return;
}
- if (IsWindows() && IsAMD() && IsDesktopOpenGL())
- {
- // TODO(ynovikov): Investigate the failure (https://anglebug.com/1533)
- std::cout << "Test disabled on Windows AMD OpenGL." << std::endl;
- return;
- }
-
bool flags[8] = { false };
GLenum bufs[8] = { GL_NONE };
diff --git a/gfx/angle/src/tests/gl_tests/ETCTextureTest.cpp b/gfx/angle/src/tests/gl_tests/ETCTextureTest.cpp
index 24fdd2263..f34ac24b3 100755
--- a/gfx/angle/src/tests/gl_tests/ETCTextureTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/ETCTextureTest.cpp
@@ -52,7 +52,7 @@ TEST_P(ETCTextureTest, ETC1Validation)
glBindTexture(GL_TEXTURE_2D, mTexture);
- GLubyte pixel[8] = { 0x0, 0x0, 0xf8, 0x2, 0x43, 0xff, 0x4, 0x12 };
+ GLubyte pixel[8] = {0};
glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, 4, 4, 0,
sizeof(pixel), pixel);
if (supported)
@@ -62,12 +62,6 @@ TEST_P(ETCTextureTest, ETC1Validation)
glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 4, 4, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE,
sizeof(pixel), pixel);
EXPECT_GL_NO_ERROR();
-
-
- glCompressedTexImage2D(GL_TEXTURE_2D, 1, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, 2, 2, 0,
- sizeof(pixel), pixel);
- glCompressedTexImage2D(GL_TEXTURE_2D, 2, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, 1, 1, 0,
- sizeof(pixel), pixel);
}
else
{
diff --git a/gfx/angle/src/tests/gl_tests/GLSLTest.cpp b/gfx/angle/src/tests/gl_tests/GLSLTest.cpp
index 00000612d..bdcbc5d20 100755
--- a/gfx/angle/src/tests/gl_tests/GLSLTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/GLSLTest.cpp
@@ -1063,37 +1063,6 @@ TEST_P(GLSLTest_ES3, MissingReturnArrayOfStructs)
EXPECT_NE(0u, program);
}
-// Verify that functions without return statements still compile
-TEST_P(GLSLTest_ES3, MissingReturnStructOfArrays)
-{
- // TODO(cwallez) remove the suppression once NVIDIA removes the restriction for
- // GLSL >= 300. It was defined only in GLSL 2.0, section 6.1.
- if (IsNVIDIA() && IsOpenGLES())
- {
- std::cout << "Test skipped on NVIDIA OpenGL ES because it disallows returning "
- "structure of arrays"
- << std::endl;
- return;
- }
-
- const std::string vertexShaderSource =
- "#version 300 es\n"
- "in float v_varying;\n"
- "struct s { float a[2]; int b[2]; vec2 c[2]; };\n"
- "s f() { if (v_varying > 0.0) { return s(float[2](1.0, 1.0), int[2](1, 1),"
- "vec2[2](vec2(1.0, 1.0), vec2(1.0, 1.0))); } }\n"
- "void main() { gl_Position = vec4(f().a[0], 0, 0, 1); }\n";
-
- const std::string fragmentShaderSource =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 my_FragColor;\n"
- "void main() { my_FragColor = vec4(0, 0, 0, 1); }\n";
-
- GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
- EXPECT_NE(0u, program);
-}
-
// Verify that using invariant(all) in both shaders fails in ESSL 3.00.
TEST_P(GLSLTest_ES3, InvariantAllBoth)
{
@@ -2241,104 +2210,6 @@ TEST_P(GLSLTest, NestedPowStatements)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
-// Convers a bug with the unary minus operator on signed integer workaround.
-TEST_P(GLSLTest_ES3, UnaryMinusOperatorSignedInt)
-{
- const std::string &vert =
- "#version 300 es\n"
- "in highp vec4 position;\n"
- "out mediump vec4 v_color;\n"
- "uniform int ui_one;\n"
- "uniform int ui_two;\n"
- "uniform int ui_three;\n"
- "void main() {\n"
- " int s[3];\n"
- " s[0] = ui_one;\n"
- " s[1] = -(-(-ui_two + 1) + 1);\n" // s[1] = -ui_two
- " s[2] = ui_three;\n"
- " int result = 0;\n"
- " for (int i = 0; i < ui_three; i++) {\n"
- " result += s[i];\n"
- " }\n"
- " v_color = (result == 2) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);\n"
- " gl_Position = position;\n"
- "}\n";
- const std::string &frag =
- "#version 300 es\n"
- "in mediump vec4 v_color;\n"
- "layout(location=0) out mediump vec4 o_color;\n"
- "void main() {\n"
- " o_color = v_color;\n"
- "}\n";
-
- ANGLE_GL_PROGRAM(prog, vert, frag);
-
- gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext());
- gl::Program *glProgram = context->getProgram(prog.get());
- GLint oneIndex = glProgram->getUniformLocation("ui_one");
- ASSERT_NE(-1, oneIndex);
- GLint twoIndex = glProgram->getUniformLocation("ui_two");
- ASSERT_NE(-1, twoIndex);
- GLint threeIndex = glProgram->getUniformLocation("ui_three");
- ASSERT_NE(-1, threeIndex);
- glUseProgram(prog.get());
- glUniform1i(oneIndex, 1);
- glUniform1i(twoIndex, 2);
- glUniform1i(threeIndex, 3);
-
- drawQuad(prog.get(), "position", 0.5f);
- EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
-}
-
-// Convers a bug with the unary minus operator on unsigned integer workaround.
-TEST_P(GLSLTest_ES3, UnaryMinusOperatorUnsignedInt)
-{
- const std::string &vert =
- "#version 300 es\n"
- "in highp vec4 position;\n"
- "out mediump vec4 v_color;\n"
- "uniform uint ui_one;\n"
- "uniform uint ui_two;\n"
- "uniform uint ui_three;\n"
- "void main() {\n"
- " uint s[3];\n"
- " s[0] = ui_one;\n"
- " s[1] = -(-(-ui_two + 1u) + 1u);\n" // s[1] = -ui_two
- " s[2] = ui_three;\n"
- " uint result = 0u;\n"
- " for (uint i = 0u; i < ui_three; i++) {\n"
- " result += s[i];\n"
- " }\n"
- " v_color = (result == 2u) ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);\n"
- " gl_Position = position;\n"
- "}\n";
- const std::string &frag =
- "#version 300 es\n"
- "in mediump vec4 v_color;\n"
- "layout(location=0) out mediump vec4 o_color;\n"
- "void main() {\n"
- " o_color = v_color;\n"
- "}\n";
-
- ANGLE_GL_PROGRAM(prog, vert, frag);
-
- gl::Context *context = reinterpret_cast<gl::Context *>(getEGLWindow()->getContext());
- gl::Program *glProgram = context->getProgram(prog.get());
- GLint oneIndex = glProgram->getUniformLocation("ui_one");
- ASSERT_NE(-1, oneIndex);
- GLint twoIndex = glProgram->getUniformLocation("ui_two");
- ASSERT_NE(-1, twoIndex);
- GLint threeIndex = glProgram->getUniformLocation("ui_three");
- ASSERT_NE(-1, threeIndex);
- glUseProgram(prog.get());
- glUniform1ui(oneIndex, 1u);
- glUniform1ui(twoIndex, 2u);
- glUniform1ui(threeIndex, 3u);
-
- drawQuad(prog.get(), "position", 0.5f);
- EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
-}
-
// Test a nested sequence operator with a ternary operator inside. The ternary operator is
// intended to be such that it gets converted to an if statement on the HLSL backend.
TEST_P(GLSLTest, NestedSequenceOperatorWithTernaryInside)
@@ -2368,65 +2239,6 @@ TEST_P(GLSLTest, NestedSequenceOperatorWithTernaryInside)
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
-// Test that using a sampler2D and samplerExternalOES in the same shader works (anglebug.com/1534)
-TEST_P(GLSLTest, ExternalAnd2DSampler)
-{
- if (!extensionEnabled("GL_OES_EGL_image_external"))
- {
- std::cout << "Test skipped because GL_OES_EGL_image_external is not available."
- << std::endl;
- return;
- }
-
- const std::string fragmentShader =
- "precision mediump float;\n"
- "uniform samplerExternalOES tex0;\n"
- "uniform sampler2D tex1;\n"
- "void main(void)\n"
- "{\n"
- " vec2 uv = vec2(0.0, 0.0);"
- " gl_FragColor = texture2D(tex0, uv) + texture2D(tex1, uv);\n"
- "}\n";
-
- ANGLE_GL_PROGRAM(program, mSimpleVSSource, fragmentShader);
-}
-
-// Test that using an invalid constant right-shift produces an error.
-TEST_P(GLSLTest_ES3, FoldedInvalidRightShift)
-{
- const std::string &fragmentShader =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 color;\n"
- "void main(void)\n"
- "{\n"
- " int diff = -100 >> -100;\n"
- " color = vec4(float(diff));\n"
- "}\n";
-
- GLuint program = CompileProgram(mSimpleVSSource, fragmentShader);
- EXPECT_EQ(0u, program);
- glDeleteProgram(program);
-}
-
-// Test that using an invalid constant left-shift produces an error.
-TEST_P(GLSLTest_ES3, FoldedInvalidLeftShift)
-{
- const std::string &fragmentShader =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 color;\n"
- "void main(void)\n"
- "{\n"
- " int diff = -100 << -100;\n"
- " color = vec4(float(diff));\n"
- "}\n";
-
- GLuint program = CompileProgram(mSimpleVSSource, fragmentShader);
- EXPECT_EQ(0u, program);
- glDeleteProgram(program);
-}
-
} // anonymous namespace
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
diff --git a/gfx/angle/src/tests/gl_tests/MipmapTest.cpp b/gfx/angle/src/tests/gl_tests/MipmapTest.cpp
index 2ab9411a8..9691b1820 100755
--- a/gfx/angle/src/tests/gl_tests/MipmapTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/MipmapTest.cpp
@@ -919,8 +919,6 @@ TEST_P(MipmapTestES3, GenerateMipmapBaseLevel)
glBindTexture(GL_TEXTURE_2D, mTexture);
- ASSERT(getWindowWidth() == getWindowHeight());
-
// Fill level 0 with blue
std::vector<GLColor> pixelsBlue(getWindowWidth() * getWindowHeight(), GLColor::blue);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, getWindowWidth(), getWindowHeight(), 0, GL_RGBA,
@@ -951,6 +949,14 @@ TEST_P(MipmapTestES3, GenerateMipmapBaseLevel)
clearAndDrawQuad(m2DProgram, getWindowWidth() / 4, getWindowHeight() / 4);
EXPECT_PIXEL_COLOR_EQ(getWindowWidth() / 8, getWindowHeight() / 8, GLColor::red);
+ if (IsNVIDIA() && IsOpenGL())
+ {
+ // Observed incorrect rendering on NVIDIA, level zero seems to be incorrectly affected by
+ // GenerateMipmap.
+ std::cout << "Test partially skipped on NVIDIA OpenGL." << std::endl;
+ return;
+ }
+
// Draw using level 0. It should still be blue.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
clearAndDrawQuad(m2DProgram, getWindowWidth(), getWindowHeight());
diff --git a/gfx/angle/src/tests/gl_tests/MultisampleCompatibilityTest.cpp b/gfx/angle/src/tests/gl_tests/MultisampleCompatibilityTest.cpp
index 0edc221d7..30708eeec 100755
--- a/gfx/angle/src/tests/gl_tests/MultisampleCompatibilityTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/MultisampleCompatibilityTest.cpp
@@ -9,7 +9,6 @@
//
#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
#include "shader_utils.h"
using namespace angle;
@@ -297,142 +296,5 @@ TEST_P(EXTMultisampleCompatibilityTest, DrawAlphaOneAndResolve)
EXPECT_EQ(0, memcmp(results[0].get(), results[2].get(), kResultSize));
}
-ANGLE_INSTANTIATE_TEST(EXTMultisampleCompatibilityTest, ES2_OPENGL(), ES2_OPENGLES(), ES3_OPENGL());
-class MultisampleCompatibilityTest : public ANGLETest
-{
-
- protected:
- MultisampleCompatibilityTest()
- {
- setWindowWidth(64);
- setWindowHeight(64);
- setConfigRedBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- }
-
- void prepareForDraw(GLsizei numSamples)
- {
- // Create a sample buffer.
- glGenRenderbuffers(1, &mSampleRB);
- glBindRenderbuffer(GL_RENDERBUFFER, mSampleRB);
- glRenderbufferStorageMultisampleANGLE(GL_RENDERBUFFER, numSamples, GL_RGBA8, kWidth,
- kHeight);
- GLint param = 0;
- glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_SAMPLES, &param);
- EXPECT_GE(param, numSamples);
- glGenFramebuffers(1, &mSampleFBO);
- glBindFramebuffer(GL_FRAMEBUFFER, mSampleFBO);
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mSampleRB);
- EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- // Create another FBO to resolve the multisample buffer into.
- glGenTextures(1, &mResolveTex);
- glBindTexture(GL_TEXTURE_2D, mResolveTex);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
- NULL);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glGenFramebuffers(1, &mResolveFBO);
- glBindFramebuffer(GL_FRAMEBUFFER, mResolveFBO);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mResolveTex, 0);
- EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
- glViewport(0, 0, kWidth, kHeight);
- glBindFramebuffer(GL_FRAMEBUFFER, mSampleFBO);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- ASSERT_GL_NO_ERROR();
- }
-
- void prepareForVerify()
- {
- // Resolve.
- glBindFramebuffer(GL_READ_FRAMEBUFFER, mSampleFBO);
- glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mResolveFBO);
- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- glBlitFramebufferANGLE(0, 0, kWidth, kHeight, 0, 0, kWidth, kHeight, GL_COLOR_BUFFER_BIT,
- GL_NEAREST);
- glBindFramebuffer(GL_READ_FRAMEBUFFER, mResolveFBO);
-
- ASSERT_GL_NO_ERROR();
- }
-
- void cleanup()
- {
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glDeleteFramebuffers(1, &mResolveFBO);
- glDeleteFramebuffers(1, &mSampleFBO);
- glDeleteTextures(1, &mResolveTex);
- glDeleteRenderbuffers(1, &mSampleRB);
-
- ASSERT_GL_NO_ERROR();
- }
-
- bool isApplicable() const
- {
- return extensionEnabled("GL_ANGLE_framebuffer_multisample") &&
- extensionEnabled("GL_OES_rgb8_rgba8");
- }
-
- GLuint mSampleFBO;
- GLuint mResolveFBO;
- GLuint mSampleRB;
- GLuint mResolveTex;
-};
-
-// Test that enabling GL_SAMPLE_COVERAGE affects rendering.
-TEST_P(MultisampleCompatibilityTest, DrawCoverageAndResolve)
-{
- if (!isApplicable())
- return;
-
- // TODO: Figure out why this fails on Android.
- if (IsAndroid())
- {
- std::cout << "Test skipped on Android." << std::endl;
- return;
- }
-
- const std::string &vertex =
- "attribute vec4 position;\n"
- "void main()\n"
- "{ gl_Position = position; }";
- const std::string &fragment =
- "void main()\n"
- "{ gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }";
-
- ANGLE_GL_PROGRAM(drawRed, vertex, fragment);
-
- GLsizei maxSamples = 0;
- glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
- int iterationCount = maxSamples + 1;
- for (int samples = 1; samples < iterationCount; samples++)
- {
- prepareForDraw(samples);
- glEnable(GL_SAMPLE_COVERAGE);
- glSampleCoverage(1.0, false);
- drawQuad(drawRed.get(), "position", 0.5f);
-
- prepareForVerify();
- GLsizei pixelCount = kWidth * kHeight;
- std::vector<GLColor> actual(pixelCount, GLColor::black);
- glReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, actual.data());
- glDisable(GL_SAMPLE_COVERAGE);
- cleanup();
-
- std::vector<GLColor> expected(pixelCount, GLColor::red);
- EXPECT_EQ(expected, actual);
- }
-}
-
-ANGLE_INSTANTIATE_TEST(MultisampleCompatibilityTest,
- ES2_D3D9(),
- ES2_OPENGL(),
- ES2_OPENGLES(),
- ES3_D3D11(),
- ES3_OPENGL(),
- ES3_OPENGLES()); \ No newline at end of file
+ANGLE_INSTANTIATE_TEST(EXTMultisampleCompatibilityTest, ES2_OPENGL(), ES2_OPENGLES(), ES3_OPENGL()); \ No newline at end of file
diff --git a/gfx/angle/src/tests/gl_tests/ReadPixelsTest.cpp b/gfx/angle/src/tests/gl_tests/ReadPixelsTest.cpp
index 47d2e3dba..2a9fe8e5a 100755
--- a/gfx/angle/src/tests/gl_tests/ReadPixelsTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/ReadPixelsTest.cpp
@@ -32,7 +32,7 @@ class ReadPixelsTest : public ANGLETest
}
};
-// Test out of bounds framebuffer reads.
+// Test out of bounds reads.
TEST_P(ReadPixelsTest, OutOfBounds)
{
// TODO: re-enable once root cause of http://anglebug.com/1413 is fixed
@@ -49,17 +49,26 @@ TEST_P(ReadPixelsTest, OutOfBounds)
GLsizei pixelsWidth = 32;
GLsizei pixelsHeight = 32;
GLint offset = 16;
- std::vector<GLColor> pixels((pixelsWidth + offset) * (pixelsHeight + offset));
+ std::vector<GLubyte> pixels((pixelsWidth + offset) * (pixelsHeight + offset) * 4);
glReadPixels(-offset, -offset, pixelsWidth + offset, pixelsHeight + offset, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]);
EXPECT_GL_NO_ERROR();
- // Expect that all pixels which fell within the framebuffer are red
for (int y = pixelsHeight / 2; y < pixelsHeight; y++)
{
for (int x = pixelsWidth / 2; x < pixelsWidth; x++)
{
- EXPECT_EQ(GLColor::red, pixels[y * (pixelsWidth + offset) + x]);
+ const GLubyte* pixel = &pixels[0] + ((y * (pixelsWidth + offset) + x) * 4);
+ unsigned int r = static_cast<unsigned int>(pixel[0]);
+ unsigned int g = static_cast<unsigned int>(pixel[1]);
+ unsigned int b = static_cast<unsigned int>(pixel[2]);
+ unsigned int a = static_cast<unsigned int>(pixel[3]);
+
+ // Expect that all pixels which fell within the framebuffer are red
+ EXPECT_EQ(255u, r);
+ EXPECT_EQ(0u, g);
+ EXPECT_EQ(0u, b);
+ EXPECT_EQ(255u, a);
}
}
}
@@ -74,22 +83,16 @@ class ReadPixelsPBOTest : public ReadPixelsTest
ANGLETest::SetUp();
glGenBuffers(1, &mPBO);
- glGenFramebuffers(1, &mFBO);
-
- Reset(4 * getWindowWidth() * getWindowHeight(), 4, 1);
- }
-
- void Reset(GLuint bufferSize, GLuint fboWidth, GLuint fboHeight)
- {
glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO);
- glBufferData(GL_PIXEL_PACK_BUFFER, bufferSize, nullptr, GL_STATIC_DRAW);
+ glBufferData(GL_PIXEL_PACK_BUFFER, 4 * getWindowWidth() * getWindowHeight(), nullptr,
+ GL_STATIC_DRAW);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
- glDeleteTextures(1, &mTexture);
glGenTextures(1, &mTexture);
glBindTexture(GL_TEXTURE_2D, mTexture);
- glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, fboWidth, fboHeight);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, 4, 1);
+ glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -106,60 +109,11 @@ class ReadPixelsPBOTest : public ReadPixelsTest
ANGLETest::TearDown();
}
- GLuint mPBO = 0;
- GLuint mTexture = 0;
- GLuint mFBO = 0;
+ GLuint mPBO;
+ GLuint mTexture;
+ GLuint mFBO;
};
-// Test basic usage of PBOs.
-TEST_P(ReadPixelsPBOTest, Basic)
-{
- glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_GL_NO_ERROR();
-
- glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO);
- glReadPixels(0, 0, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-
- GLvoid *mappedPtr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, 32, GL_MAP_READ_BIT);
- GLColor *dataColor = static_cast<GLColor *>(mappedPtr);
- EXPECT_GL_NO_ERROR();
-
- EXPECT_EQ(GLColor::red, dataColor[0]);
-
- glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
- EXPECT_GL_NO_ERROR();
-}
-
-// Test an error is generated when the PBO is too small.
-TEST_P(ReadPixelsPBOTest, PBOTooSmall)
-{
- Reset(4 * 16 * 16 - 1, 16, 16);
-
- glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_GL_NO_ERROR();
-
- glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO);
- glReadPixels(0, 0, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-}
-
-// Test an error is generated when the PBO is mapped.
-TEST_P(ReadPixelsPBOTest, PBOMapped)
-{
- glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT);
- EXPECT_GL_NO_ERROR();
-
- glBindBuffer(GL_PIXEL_PACK_BUFFER, mPBO);
- glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, 32, GL_MAP_READ_BIT);
- glReadPixels(0, 0, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-}
-
// Test that binding a PBO to ARRAY_BUFFER works as expected.
TEST_P(ReadPixelsPBOTest, ArrayBufferTarget)
{
@@ -174,10 +128,13 @@ TEST_P(ReadPixelsPBOTest, ArrayBufferTarget)
glBindBuffer(GL_ARRAY_BUFFER, mPBO);
GLvoid *mappedPtr = glMapBufferRange(GL_ARRAY_BUFFER, 0, 32, GL_MAP_READ_BIT);
- GLColor *dataColor = static_cast<GLColor *>(mappedPtr);
+ unsigned char *dataPtr = static_cast<unsigned char *>(mappedPtr);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GLColor::red, dataColor[0]);
+ EXPECT_EQ(255, dataPtr[0]);
+ EXPECT_EQ(0, dataPtr[1]);
+ EXPECT_EQ(0, dataPtr[2]);
+ EXPECT_EQ(255, dataPtr[3]);
glUnmapBuffer(GL_ARRAY_BUFFER);
EXPECT_GL_NO_ERROR();
@@ -209,15 +166,21 @@ TEST_P(ReadPixelsPBOTest, ExistingDataPreserved)
// Read 16x16 region from green backbuffer to PBO at offset 16
glReadPixels(0, 0, 16, 16, GL_RGBA, GL_UNSIGNED_BYTE, reinterpret_cast<GLvoid*>(16));
- GLvoid *mappedPtr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, 32, GL_MAP_READ_BIT);
- GLColor *dataColor = static_cast<GLColor *>(mappedPtr);
+ GLvoid * mappedPtr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, 32, GL_MAP_READ_BIT);
+ unsigned char *dataPtr = static_cast<unsigned char *>(mappedPtr);
EXPECT_GL_NO_ERROR();
// Test pixel 0 is red (existing data)
- EXPECT_EQ(GLColor::red, dataColor[0]);
+ EXPECT_EQ(255, dataPtr[0]);
+ EXPECT_EQ(0, dataPtr[1]);
+ EXPECT_EQ(0, dataPtr[2]);
+ EXPECT_EQ(255, dataPtr[3]);
// Test pixel 16 is green (new data)
- EXPECT_EQ(GLColor::green, dataColor[16]);
+ EXPECT_EQ(0, dataPtr[16 * 4 + 0]);
+ EXPECT_EQ(255, dataPtr[16 * 4 + 1]);
+ EXPECT_EQ(0, dataPtr[16 * 4 + 2]);
+ EXPECT_EQ(255, dataPtr[16 * 4 + 3]);
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
EXPECT_GL_NO_ERROR();
@@ -239,11 +202,14 @@ TEST_P(ReadPixelsPBOTest, SubDataPreservesContents)
glBindBuffer(GL_ARRAY_BUFFER, mPBO);
glBufferSubData(GL_ARRAY_BUFFER, 0, 4, data);
- GLvoid *mappedPtr = glMapBufferRange(GL_ARRAY_BUFFER, 0, 32, GL_MAP_READ_BIT);
- GLColor *dataColor = static_cast<GLColor *>(mappedPtr);
+ GLvoid *mappedPtr = glMapBufferRange(GL_ARRAY_BUFFER, 0, 32, GL_MAP_READ_BIT);
+ unsigned char *dataPtr = static_cast<unsigned char *>(mappedPtr);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GLColor(1, 2, 3, 4), dataColor[0]);
+ EXPECT_EQ(1, dataPtr[0]);
+ EXPECT_EQ(2, dataPtr[1]);
+ EXPECT_EQ(3, dataPtr[2]);
+ EXPECT_EQ(4, dataPtr[3]);
glUnmapBuffer(GL_ARRAY_BUFFER);
EXPECT_GL_NO_ERROR();
@@ -272,12 +238,19 @@ TEST_P(ReadPixelsPBOTest, SubDataOffsetPreservesContents)
glBindBuffer(GL_ARRAY_BUFFER, mPBO);
glBufferSubData(GL_ARRAY_BUFFER, 16, 4, data);
- GLvoid *mappedPtr = glMapBufferRange(GL_ARRAY_BUFFER, 0, 32, GL_MAP_READ_BIT);
- GLColor *dataColor = static_cast<GLColor *>(mappedPtr);
+ GLvoid *mappedPtr = glMapBufferRange(GL_ARRAY_BUFFER, 0, 32, GL_MAP_READ_BIT);
+ unsigned char *dataPtr = static_cast<unsigned char *>(mappedPtr);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GLColor::red, dataColor[0]);
- EXPECT_EQ(GLColor(1, 2, 3, 4), dataColor[4]);
+ EXPECT_EQ(255, dataPtr[0]);
+ EXPECT_EQ(0, dataPtr[1]);
+ EXPECT_EQ(0, dataPtr[2]);
+ EXPECT_EQ(255, dataPtr[3]);
+
+ EXPECT_EQ(1, dataPtr[16]);
+ EXPECT_EQ(2, dataPtr[17]);
+ EXPECT_EQ(3, dataPtr[18]);
+ EXPECT_EQ(4, dataPtr[19]);
glUnmapBuffer(GL_ARRAY_BUFFER);
EXPECT_GL_NO_ERROR();
@@ -331,9 +304,10 @@ class ReadPixelsPBODrawTest : public ReadPixelsPBOTest
// Test that we can draw with PBO data.
TEST_P(ReadPixelsPBODrawTest, DrawWithPBO)
{
- GLColor color(1, 2, 3, 4);
+ unsigned char data[4] = { 1, 2, 3, 4 };
+
glBindTexture(GL_TEXTURE_2D, mTexture);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, data);
EXPECT_GL_NO_ERROR();
glBindFramebuffer(GL_READ_FRAMEBUFFER, mFBO);
@@ -370,11 +344,14 @@ TEST_P(ReadPixelsPBODrawTest, DrawWithPBO)
glDrawArrays(GL_POINTS, 0, 1);
EXPECT_GL_NO_ERROR();
- color = GLColor(0, 0, 0, 0);
- glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color);
+ memset(data, 0, 4);
+ glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, data);
EXPECT_GL_NO_ERROR();
- EXPECT_EQ(GLColor(1, 2, 3, 4), color);
+ EXPECT_EQ(1, data[0]);
+ EXPECT_EQ(2, data[1]);
+ EXPECT_EQ(3, data[2]);
+ EXPECT_EQ(4, data[3]);
}
class ReadPixelsMultisampleTest : public ReadPixelsTest
diff --git a/gfx/angle/src/tests/gl_tests/RobustClientMemoryTest.cpp b/gfx/angle/src/tests/gl_tests/RobustClientMemoryTest.cpp
deleted file mode 100644
index b5f89e904..000000000
--- a/gfx/angle/src/tests/gl_tests/RobustClientMemoryTest.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-//
-// Copyright 2016 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.
-//
-
-// RobustClientMemoryTest.cpp : Tests of the GL_ANGLE_robust_client_memory extension.
-
-#include "test_utils/ANGLETest.h"
-
-#include "test_utils/gl_raii.h"
-
-namespace angle
-{
-class RobustClientMemoryTest : public ANGLETest
-{
- protected:
- RobustClientMemoryTest()
- {
- setWindowWidth(128);
- setWindowHeight(128);
- setConfigRedBits(8);
- setConfigGreenBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- }
-
- void SetUp() override
- {
- ANGLETest::SetUp();
-
- glGetBooleanvRobustANGLE = reinterpret_cast<PFNGLGETBOOLEANVROBUSTANGLE>(
- eglGetProcAddress("glGetBooleanvRobustANGLE"));
- glGetBufferParameterivRobustANGLE = reinterpret_cast<PFNGLGETBUFFERPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetBufferParameterivRobustANGLE"));
- glGetFloatvRobustANGLE = reinterpret_cast<PFNGLGETFLOATVROBUSTANGLE>(
- eglGetProcAddress("glGetFloatvRobustANGLE"));
- glGetFramebufferAttachmentParameterivRobustANGLE =
- reinterpret_cast<PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetFramebufferAttachmentParameterivRobustANGLE"));
- glGetIntegervRobustANGLE = reinterpret_cast<PFNGLGETINTEGERVROBUSTANGLE>(
- eglGetProcAddress("glGetIntegervRobustANGLE"));
- glGetProgramivRobustANGLE = reinterpret_cast<PFNGLGETPROGRAMIVROBUSTANGLE>(
- eglGetProcAddress("glGetProgramivRobustANGLE"));
- glGetRenderbufferParameterivRobustANGLE =
- reinterpret_cast<PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetRenderbufferParameterivRobustANGLE"));
- glGetShaderivRobustANGLE = reinterpret_cast<PFNGLGETSHADERIVROBUSTANGLE>(
- eglGetProcAddress("glGetShaderivRobustANGLE"));
- glGetTexParameterfvRobustANGLE = reinterpret_cast<PFNGLGETTEXPARAMETERFVROBUSTANGLE>(
- eglGetProcAddress("glGetTexParameterfvRobustANGLE"));
- glGetTexParameterivRobustANGLE = reinterpret_cast<PFNGLGETTEXPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetTexParameterivRobustANGLE"));
- glGetUniformfvRobustANGLE = reinterpret_cast<PFNGLGETUNIFORMFVROBUSTANGLE>(
- eglGetProcAddress("glGetUniformfvRobustANGLE"));
- glGetUniformivRobustANGLE = reinterpret_cast<PFNGLGETUNIFORMIVROBUSTANGLE>(
- eglGetProcAddress("glGetUniformivRobustANGLE"));
- glGetVertexAttribfvRobustANGLE = reinterpret_cast<PFNGLGETVERTEXATTRIBFVROBUSTANGLE>(
- eglGetProcAddress("glGetVertexAttribfvRobustANGLE"));
- glGetVertexAttribivRobustANGLE = reinterpret_cast<PFNGLGETVERTEXATTRIBIVROBUSTANGLE>(
- eglGetProcAddress("glGetVertexAttribivRobustANGLE"));
- glGetVertexAttribPointervRobustANGLE =
- reinterpret_cast<PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLE>(
- eglGetProcAddress("glGetVertexAttribPointervRobustANGLE"));
- glReadPixelsRobustANGLE = reinterpret_cast<PFNGLREADPIXELSROBUSTANGLE>(
- eglGetProcAddress("glReadPixelsRobustANGLE"));
- glTexImage2DRobustANGLE = reinterpret_cast<PFNGLTEXIMAGE2DROBUSTANGLE>(
- eglGetProcAddress("glTexImage2DRobustANGLE"));
- glTexParameterfvRobustANGLE = reinterpret_cast<PFNGLTEXPARAMETERFVROBUSTANGLE>(
- eglGetProcAddress("glTexParameterfvRobustANGLE"));
- glTexParameterivRobustANGLE = reinterpret_cast<PFNGLTEXPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glTexParameterivRobustANGLE"));
- glTexSubImage2DRobustANGLE = reinterpret_cast<PFNGLTEXSUBIMAGE2DROBUSTANGLE>(
- eglGetProcAddress("glTexSubImage2DRobustANGLE"));
- glTexImage3DRobustANGLE = reinterpret_cast<PFNGLTEXIMAGE3DROBUSTANGLE>(
- eglGetProcAddress("glTexImage3DRobustANGLE"));
- glTexSubImage3DRobustANGLE = reinterpret_cast<PFNGLTEXSUBIMAGE3DROBUSTANGLE>(
- eglGetProcAddress("glTexSubImage3DRobustANGLE"));
- glGetQueryivRobustANGLE = reinterpret_cast<PFNGLGETQUERYIVROBUSTANGLE>(
- eglGetProcAddress("glGetQueryivRobustANGLE"));
- glGetQueryObjectuivRobustANGLE = reinterpret_cast<PFNGLGETQUERYOBJECTUIVROBUSTANGLE>(
- eglGetProcAddress("glGetQueryObjectuivRobustANGLE"));
- glGetBufferPointervRobustANGLE = reinterpret_cast<PFNGLGETBUFFERPOINTERVROBUSTANGLE>(
- eglGetProcAddress("glGetBufferPointervRobustANGLE"));
- glGetIntegeri_vRobustANGLE = reinterpret_cast<PFNGLGETINTEGERI_VROBUSTANGLE>(
- eglGetProcAddress("glGetIntegeri_vRobustANGLE"));
- glGetInternalformativRobustANGLE = reinterpret_cast<PFNGETINTERNALFORMATIVROBUSTANGLE>(
- eglGetProcAddress("glGetInternalformativRobustANGLE"));
- glGetVertexAttribIivRobustANGLE = reinterpret_cast<PFNGLGETVERTEXATTRIBIIVROBUSTANGLE>(
- eglGetProcAddress("glGetVertexAttribIivRobustANGLE"));
- glGetVertexAttribIuivRobustANGLE = reinterpret_cast<PFNGLGETVERTEXATTRIBIUIVROBUSTANGLE>(
- eglGetProcAddress("glGetVertexAttribIuivRobustANGLE"));
- glGetUniformuivRobustANGLE = reinterpret_cast<PFNGLGETUNIFORMUIVROBUSTANGLE>(
- eglGetProcAddress("glGetUniformuivRobustANGLE"));
- glGetActiveUniformBlockivRobustANGLE =
- reinterpret_cast<PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLE>(
- eglGetProcAddress("glGetActiveUniformBlockivRobustANGLE"));
- glGetInteger64vRobustANGLE = reinterpret_cast<PFNGLGETINTEGER64VROBUSTANGLE>(
- eglGetProcAddress("glGetInteger64vRobustANGLE"));
- glGetInteger64i_vRobustANGLE = reinterpret_cast<PFNGLGETINTEGER64I_VROBUSTANGLE>(
- eglGetProcAddress("glGetInteger64i_vRobustANGLE"));
- glGetBufferParameteri64vRobustANGLE =
- reinterpret_cast<PFNGLGETBUFFERPARAMETERI64VROBUSTANGLE>(
- eglGetProcAddress("glGetBufferParameteri64vRobustANGLE"));
- glSamplerParameterivRobustANGLE = reinterpret_cast<PFNGLSAMPLERPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glSamplerParameterivRobustANGLE"));
- glSamplerParameterfvRobustANGLE = reinterpret_cast<PFNGLSAMPLERPARAMETERFVROBUSTANGLE>(
- eglGetProcAddress("glSamplerParameterfvRobustANGLE"));
- glGetSamplerParameterivRobustANGLE =
- reinterpret_cast<PFNGLGETSAMPLERPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetSamplerParameterivRobustANGLE"));
- glGetSamplerParameterfvRobustANGLE =
- reinterpret_cast<PFNGLGETSAMPLERPARAMETERFVROBUSTANGLE>(
- eglGetProcAddress("glGetSamplerParameterfvRobustANGLE"));
- glGetFramebufferParameterivRobustANGLE =
- reinterpret_cast<PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetFramebufferParameterivRobustANGLE"));
- glGetProgramInterfaceivRobustANGLE =
- reinterpret_cast<PFNGLGETPROGRAMINTERFACEIVROBUSTANGLE>(
- eglGetProcAddress("glGetProgramInterfaceivRobustANGLE"));
- glGetBooleani_vRobustANGLE = reinterpret_cast<PFNGLGETBOOLEANI_VROBUSTANGLE>(
- eglGetProcAddress("glGetBooleani_vRobustANGLE"));
- glGetMultisamplefvRobustANGLE = reinterpret_cast<PFNGLGETMULTISAMPLEFVROBUSTANGLE>(
- eglGetProcAddress("glGetMultisamplefvRobustANGLE"));
- glGetTexLevelParameterivRobustANGLE =
- reinterpret_cast<PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLE>(
- eglGetProcAddress("glGetTexLevelParameterivRobustANGLE"));
- glGetTexLevelParameterfvRobustANGLE =
- reinterpret_cast<PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLE>(
- eglGetProcAddress("glGetTexLevelParameterfvRobustANGLE"));
- glGetPointervRobustANGLERobustANGLE =
- reinterpret_cast<PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLE>(
- eglGetProcAddress("glGetPointervRobustANGLERobustANGLE"));
- glReadnPixelsRobustANGLE = reinterpret_cast<PFNGLREADNPIXELSROBUSTANGLE>(
- eglGetProcAddress("glReadnPixelsRobustANGLE"));
- glGetnUniformfvRobustANGLE = reinterpret_cast<PFNGLGETNUNIFORMFVROBUSTANGLE>(
- eglGetProcAddress("glGetnUniformfvRobustANGLE"));
- glGetnUniformivRobustANGLE = reinterpret_cast<PFNGLGETNUNIFORMIVROBUSTANGLE>(
- eglGetProcAddress("glGetnUniformivRobustANGLE"));
- glGetnUniformuivRobustANGLE = reinterpret_cast<PFNGLGETNUNIFORMUIVROBUSTANGLE>(
- eglGetProcAddress("glGetnUniformuivRobustANGLE"));
- glTexParameterIivRobustANGLE = reinterpret_cast<PFNGLTEXPARAMETERIIVROBUSTANGLE>(
- eglGetProcAddress("glTexParameterIivRobustANGLE"));
- glTexParameterIuivRobustANGLE = reinterpret_cast<PFNGLTEXPARAMETERIUIVROBUSTANGLE>(
- eglGetProcAddress("glTexParameterIuivRobustANGLE"));
- glGetTexParameterIivRobustANGLE = reinterpret_cast<PFNGLGETTEXPARAMETERIIVROBUSTANGLE>(
- eglGetProcAddress("glGetTexParameterIivRobustANGLE"));
- glGetTexParameterIuivRobustANGLE = reinterpret_cast<PFNGLGETTEXPARAMETERIUIVROBUSTANGLE>(
- eglGetProcAddress("glGetTexParameterIuivRobustANGLE"));
- glSamplerParameterIivRobustANGLE = reinterpret_cast<PFNGLSAMPLERPARAMETERIIVROBUSTANGLE>(
- eglGetProcAddress("glSamplerParameterIivRobustANGLE"));
- glSamplerParameterIuivRobustANGLE = reinterpret_cast<PFNGLSAMPLERPARAMETERIUIVROBUSTANGLE>(
- eglGetProcAddress("glSamplerParameterIuivRobustANGLE"));
- glGetSamplerParameterIivRobustANGLE =
- reinterpret_cast<PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLE>(
- eglGetProcAddress("glGetSamplerParameterIivRobustANGLE"));
- glGetSamplerParameterIuivRobustANGLE =
- reinterpret_cast<PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLE>(
- eglGetProcAddress("glGetSamplerParameterIuivRobustANGLE"));
- glGetQueryObjectivRobustANGLE = reinterpret_cast<PFNGLGETQUERYOBJECTIVROBUSTANGLE>(
- eglGetProcAddress("glGetQueryObjectivRobustANGLE"));
- glGetQueryObjecti64vRobustANGLE = reinterpret_cast<PFNGLGETQUERYOBJECTI64VROBUSTANGLE>(
- eglGetProcAddress("glGetQueryObjecti64vRobustANGLE"));
- glGetQueryObjectui64vRobustANGLE = reinterpret_cast<PFNGLGETQUERYOBJECTUI64VROBUSTANGLE>(
- eglGetProcAddress("glGetQueryObjectui64vRobustANGLE"));
- }
-
- void TearDown() override { ANGLETest::TearDown(); }
-
- bool extensionsPresent() const
- {
- if (!extensionEnabled("GL_ANGLE_robust_client_memory"))
- {
- std::cout << "Test skipped because GL_ANGLE_robust_client_memory is not available.";
- return false;
- }
-
- return true;
- }
-
- PFNGLGETBOOLEANVROBUSTANGLE glGetBooleanvRobustANGLE = nullptr;
- PFNGLGETBUFFERPARAMETERIVROBUSTANGLE glGetBufferParameterivRobustANGLE = nullptr;
- PFNGLGETFLOATVROBUSTANGLE glGetFloatvRobustANGLE = nullptr;
- PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLE
- glGetFramebufferAttachmentParameterivRobustANGLE = nullptr;
- PFNGLGETINTEGERVROBUSTANGLE glGetIntegervRobustANGLE = nullptr;
- PFNGLGETPROGRAMIVROBUSTANGLE glGetProgramivRobustANGLE = nullptr;
- PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLE glGetRenderbufferParameterivRobustANGLE = nullptr;
- PFNGLGETSHADERIVROBUSTANGLE glGetShaderivRobustANGLE = nullptr;
- PFNGLGETTEXPARAMETERFVROBUSTANGLE glGetTexParameterfvRobustANGLE = nullptr;
- PFNGLGETTEXPARAMETERIVROBUSTANGLE glGetTexParameterivRobustANGLE = nullptr;
- PFNGLGETUNIFORMFVROBUSTANGLE glGetUniformfvRobustANGLE = nullptr;
- PFNGLGETUNIFORMIVROBUSTANGLE glGetUniformivRobustANGLE = nullptr;
- PFNGLGETVERTEXATTRIBFVROBUSTANGLE glGetVertexAttribfvRobustANGLE = nullptr;
- PFNGLGETVERTEXATTRIBIVROBUSTANGLE glGetVertexAttribivRobustANGLE = nullptr;
- PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLE glGetVertexAttribPointervRobustANGLE = nullptr;
- PFNGLREADPIXELSROBUSTANGLE glReadPixelsRobustANGLE = nullptr;
- PFNGLTEXIMAGE2DROBUSTANGLE glTexImage2DRobustANGLE = nullptr;
- PFNGLTEXPARAMETERFVROBUSTANGLE glTexParameterfvRobustANGLE = nullptr;
- PFNGLTEXPARAMETERIVROBUSTANGLE glTexParameterivRobustANGLE = nullptr;
- PFNGLTEXSUBIMAGE2DROBUSTANGLE glTexSubImage2DRobustANGLE = nullptr;
- PFNGLTEXIMAGE3DROBUSTANGLE glTexImage3DRobustANGLE = nullptr;
- PFNGLTEXSUBIMAGE3DROBUSTANGLE glTexSubImage3DRobustANGLE = nullptr;
- PFNGLGETQUERYIVROBUSTANGLE glGetQueryivRobustANGLE = nullptr;
- PFNGLGETQUERYOBJECTUIVROBUSTANGLE glGetQueryObjectuivRobustANGLE = nullptr;
- PFNGLGETBUFFERPOINTERVROBUSTANGLE glGetBufferPointervRobustANGLE = nullptr;
- PFNGLGETINTEGERI_VROBUSTANGLE glGetIntegeri_vRobustANGLE = nullptr;
- PFNGETINTERNALFORMATIVROBUSTANGLE glGetInternalformativRobustANGLE = nullptr;
- PFNGLGETVERTEXATTRIBIIVROBUSTANGLE glGetVertexAttribIivRobustANGLE = nullptr;
- PFNGLGETVERTEXATTRIBIUIVROBUSTANGLE glGetVertexAttribIuivRobustANGLE = nullptr;
- PFNGLGETUNIFORMUIVROBUSTANGLE glGetUniformuivRobustANGLE = nullptr;
- PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLE glGetActiveUniformBlockivRobustANGLE = nullptr;
- PFNGLGETINTEGER64VROBUSTANGLE glGetInteger64vRobustANGLE = nullptr;
- PFNGLGETINTEGER64I_VROBUSTANGLE glGetInteger64i_vRobustANGLE = nullptr;
- PFNGLGETBUFFERPARAMETERI64VROBUSTANGLE glGetBufferParameteri64vRobustANGLE = nullptr;
- PFNGLSAMPLERPARAMETERIVROBUSTANGLE glSamplerParameterivRobustANGLE = nullptr;
- PFNGLSAMPLERPARAMETERFVROBUSTANGLE glSamplerParameterfvRobustANGLE = nullptr;
- PFNGLGETSAMPLERPARAMETERIVROBUSTANGLE glGetSamplerParameterivRobustANGLE = nullptr;
- PFNGLGETSAMPLERPARAMETERFVROBUSTANGLE glGetSamplerParameterfvRobustANGLE = nullptr;
- PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLE glGetFramebufferParameterivRobustANGLE = nullptr;
- PFNGLGETPROGRAMINTERFACEIVROBUSTANGLE glGetProgramInterfaceivRobustANGLE = nullptr;
- PFNGLGETBOOLEANI_VROBUSTANGLE glGetBooleani_vRobustANGLE = nullptr;
- PFNGLGETMULTISAMPLEFVROBUSTANGLE glGetMultisamplefvRobustANGLE = nullptr;
- PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLE glGetTexLevelParameterivRobustANGLE = nullptr;
- PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLE glGetTexLevelParameterfvRobustANGLE = nullptr;
- PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLE glGetPointervRobustANGLERobustANGLE = nullptr;
- PFNGLREADNPIXELSROBUSTANGLE glReadnPixelsRobustANGLE = nullptr;
- PFNGLGETNUNIFORMFVROBUSTANGLE glGetnUniformfvRobustANGLE = nullptr;
- PFNGLGETNUNIFORMIVROBUSTANGLE glGetnUniformivRobustANGLE = nullptr;
- PFNGLGETNUNIFORMUIVROBUSTANGLE glGetnUniformuivRobustANGLE = nullptr;
- PFNGLTEXPARAMETERIIVROBUSTANGLE glTexParameterIivRobustANGLE = nullptr;
- PFNGLTEXPARAMETERIUIVROBUSTANGLE glTexParameterIuivRobustANGLE = nullptr;
- PFNGLGETTEXPARAMETERIIVROBUSTANGLE glGetTexParameterIivRobustANGLE = nullptr;
- PFNGLGETTEXPARAMETERIUIVROBUSTANGLE glGetTexParameterIuivRobustANGLE = nullptr;
- PFNGLSAMPLERPARAMETERIIVROBUSTANGLE glSamplerParameterIivRobustANGLE = nullptr;
- PFNGLSAMPLERPARAMETERIUIVROBUSTANGLE glSamplerParameterIuivRobustANGLE = nullptr;
- PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLE glGetSamplerParameterIivRobustANGLE = nullptr;
- PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLE glGetSamplerParameterIuivRobustANGLE = nullptr;
- PFNGLGETQUERYOBJECTIVROBUSTANGLE glGetQueryObjectivRobustANGLE = nullptr;
- PFNGLGETQUERYOBJECTI64VROBUSTANGLE glGetQueryObjecti64vRobustANGLE = nullptr;
- PFNGLGETQUERYOBJECTUI64VROBUSTANGLE glGetQueryObjectui64vRobustANGLE = nullptr;
-};
-
-// Test basic usage and validation of glGetIntegervRobustANGLE
-TEST_P(RobustClientMemoryTest, GetInteger)
-{
- if (!extensionsPresent())
- {
- return;
- }
-
- // Verify that the robust and regular entry points return the same values
- GLint resultRobust;
- GLsizei length;
- glGetIntegervRobustANGLE(GL_MAX_VERTEX_ATTRIBS, 1, &length, &resultRobust);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(1, length);
-
- GLint resultRegular;
- glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &resultRegular);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(resultRegular, resultRobust);
-
- // Query a dynamic value
- GLint numCompressedFormats;
- glGetIntegervRobustANGLE(GL_NUM_COMPRESSED_TEXTURE_FORMATS, 1, &length, &numCompressedFormats);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, length);
-
- if (numCompressedFormats > 0)
- {
- std::vector<GLint> resultBuf(numCompressedFormats * 2, 0);
-
- // Test when the bufSize is too low
- glGetIntegervRobustANGLE(GL_COMPRESSED_TEXTURE_FORMATS, numCompressedFormats - 1, &length,
- resultBuf.data());
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
- EXPECT_TRUE(std::all_of(resultBuf.begin(), resultBuf.end(),
- [](GLint value) { return value == 0; }));
-
- // Make sure the GL doesn't touch the end of the buffer
- glGetIntegervRobustANGLE(GL_COMPRESSED_TEXTURE_FORMATS,
- static_cast<GLsizei>(resultBuf.size()), &length, resultBuf.data());
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(numCompressedFormats, length);
- EXPECT_TRUE(std::none_of(resultBuf.begin(), resultBuf.begin() + length,
- [](GLint value) { return value == 0; }));
- EXPECT_TRUE(std::all_of(resultBuf.begin() + length, resultBuf.end(),
- [](GLint value) { return value == 0; }));
- }
-
- // Test with null length
- glGetIntegervRobustANGLE(GL_MAX_VARYING_VECTORS, 1, nullptr, &resultRobust);
- EXPECT_GL_NO_ERROR();
-
- glGetIntegervRobustANGLE(GL_MAX_VIEWPORT_DIMS, 1, nullptr, &resultRobust);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- GLint maxViewportDims[2];
- glGetIntegervRobustANGLE(GL_MAX_VIEWPORT_DIMS, 2, nullptr, maxViewportDims);
- EXPECT_GL_NO_ERROR();
-}
-
-// Test basic usage and validation of glTexImage2DRobustANGLE
-TEST_P(RobustClientMemoryTest, TexImage2D)
-{
- if (!extensionsPresent())
- {
- return;
- }
- GLTexture tex;
- glBindTexture(GL_TEXTURE_2D, tex.get());
-
- GLsizei dataDimension = 1024;
- std::vector<GLubyte> rgbaData(dataDimension * dataDimension * 4);
-
- // Test the regular case
- glTexImage2DRobustANGLE(GL_TEXTURE_2D, 0, GL_RGBA, dataDimension, dataDimension, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, static_cast<GLsizei>(rgbaData.size()),
- rgbaData.data());
- EXPECT_GL_NO_ERROR();
-
- // Test with a data size that is too small
- glTexImage2DRobustANGLE(GL_TEXTURE_2D, 0, GL_RGBA, dataDimension, dataDimension, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, static_cast<GLsizei>(rgbaData.size()) / 2,
- rgbaData.data());
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- if (getClientMajorVersion() >= 3)
- {
- // Set an unpack parameter that would cause the driver to read past the end of the buffer
- glPixelStorei(GL_UNPACK_ROW_LENGTH, dataDimension + 1);
- glTexImage2DRobustANGLE(GL_TEXTURE_2D, 0, GL_RGBA, dataDimension, dataDimension, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, static_cast<GLsizei>(rgbaData.size()),
- rgbaData.data());
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
- }
-}
-
-// Test basic usage and validation of glReadPixelsRobustANGLE
-TEST_P(RobustClientMemoryTest, ReadPixels)
-{
- if (!extensionsPresent())
- {
- return;
- }
-
- GLsizei dataDimension = 16;
- std::vector<GLubyte> rgbaData(dataDimension * dataDimension * 4);
-
- // Test the regular case
- GLsizei length = 0;
- glReadPixelsRobustANGLE(0, 0, dataDimension, dataDimension, GL_RGBA, GL_UNSIGNED_BYTE,
- static_cast<GLsizei>(rgbaData.size()), &length, rgbaData.data());
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(static_cast<GLsizei>(rgbaData.size()), length);
-
- // Test with a data size that is too small
- glReadPixelsRobustANGLE(0, 0, dataDimension, dataDimension, GL_RGBA, GL_UNSIGNED_BYTE,
- static_cast<GLsizei>(rgbaData.size()) - 1, &length, rgbaData.data());
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-
- if (getClientMajorVersion() >= 3)
- {
- // Set a pack parameter that would cause the driver to write past the end of the buffer
- glPixelStorei(GL_PACK_ROW_LENGTH, dataDimension + 1);
- glReadPixelsRobustANGLE(0, 0, dataDimension, dataDimension, GL_RGBA, GL_UNSIGNED_BYTE,
- static_cast<GLsizei>(rgbaData.size()), &length, rgbaData.data());
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
- }
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(RobustClientMemoryTest,
- ES2_D3D9(),
- ES2_D3D11(),
- ES3_D3D11(),
- ES2_D3D11_FL9_3(),
- ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
-
-} // namespace
diff --git a/gfx/angle/src/tests/gl_tests/SRGBFramebufferTest.cpp b/gfx/angle/src/tests/gl_tests/SRGBFramebufferTest.cpp
deleted file mode 100644
index 47ff2f3e0..000000000
--- a/gfx/angle/src/tests/gl_tests/SRGBFramebufferTest.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Copyright 2016 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.
-//
-
-// SRGBFramebufferTest.cpp: Tests of sRGB framebuffer functionality.
-
-#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
-
-namespace angle
-{
-
-class SRGBFramebufferTest : public ANGLETest
-{
- protected:
- SRGBFramebufferTest()
- {
- setWindowWidth(128);
- setWindowHeight(128);
- setConfigRedBits(8);
- setConfigGreenBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- }
-
- void SetUp() override
- {
- ANGLETest::SetUp();
-
- const std::string vs =
- "precision highp float;\n"
- "attribute vec4 position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(position.xy, 0.0, 1.0);\n"
- "}\n";
-
- const std::string fs =
- "precision highp float;\n"
- "uniform vec4 color;\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = color;\n"
- "}\n";
-
- mProgram = CompileProgram(vs, fs);
- ASSERT_NE(0u, mProgram);
-
- mColorLocation = glGetUniformLocation(mProgram, "color");
- ASSERT_NE(-1, mColorLocation);
- }
-
- void TearDown() override
- {
- glDeleteProgram(mProgram);
-
- ANGLETest::TearDown();
- }
-
- GLuint mProgram = 0;
- GLint mColorLocation = -1;
-};
-
-// Test basic validation of GL_EXT_sRGB_write_control
-TEST_P(SRGBFramebufferTest, Validation)
-{
- GLenum expectedError =
- extensionEnabled("GL_EXT_sRGB_write_control") ? GL_NO_ERROR : GL_INVALID_ENUM;
-
- GLboolean value = GL_FALSE;
- glEnable(GL_FRAMEBUFFER_SRGB_EXT);
- EXPECT_GL_ERROR(expectedError);
-
- glGetBooleanv(GL_FRAMEBUFFER_SRGB_EXT, &value);
- EXPECT_GL_ERROR(expectedError);
- if (expectedError == GL_NO_ERROR)
- {
- EXPECT_EQ(GL_TRUE, value);
- }
-
- glDisable(GL_FRAMEBUFFER_SRGB_EXT);
- EXPECT_GL_ERROR(expectedError);
-
- glGetBooleanv(GL_FRAMEBUFFER_SRGB_EXT, &value);
- EXPECT_GL_ERROR(expectedError);
- if (expectedError == GL_NO_ERROR)
- {
- EXPECT_EQ(GL_FALSE, value);
- }
-}
-
-// Test basic functionality of GL_EXT_sRGB_write_control
-TEST_P(SRGBFramebufferTest, BasicUsage)
-{
- if (!extensionEnabled("GL_EXT_sRGB_write_control") ||
- (!extensionEnabled("GL_EXT_sRGB") && getClientMajorVersion() < 3))
- {
- std::cout
- << "Test skipped because GL_EXT_sRGB_write_control and GL_EXT_sRGB are not available."
- << std::endl;
- return;
- }
-
- GLColor linearColor(64, 127, 191, 255);
- GLColor srgbColor(13, 54, 133, 255);
-
- GLTexture texture;
- glBindTexture(GL_TEXTURE_2D, texture.get());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE,
- nullptr);
-
- GLFramebuffer framebuffer;
- glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.get());
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.get(), 0);
-
- glUseProgram(mProgram);
- glUniform4fv(mColorLocation, 1, srgbColor.toNormalizedVector().data());
-
- glEnable(GL_FRAMEBUFFER_SRGB_EXT);
- drawQuad(mProgram, "position", 0.5f);
- EXPECT_PIXEL_COLOR_NEAR(0, 0, linearColor, 1.0);
-
- glDisable(GL_FRAMEBUFFER_SRGB_EXT);
- drawQuad(mProgram, "position", 0.5f);
- EXPECT_PIXEL_COLOR_NEAR(0, 0, srgbColor, 1.0);
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(SRGBFramebufferTest,
- ES2_D3D9(),
- ES2_D3D11(),
- ES3_D3D11(),
- ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
-
-} // namespace angle
diff --git a/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp b/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
index f379f429f..5346f6de1 100755
--- a/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/SRGBTextureTest.cpp
@@ -5,9 +5,10 @@
//
#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
-namespace angle
+using namespace angle;
+
+namespace
{
class SRGBTextureTest : public ANGLETest
@@ -26,44 +27,12 @@ class SRGBTextureTest : public ANGLETest
void SetUp() override
{
ANGLETest::SetUp();
-
- const std::string vs =
- "precision highp float;\n"
- "attribute vec4 position;\n"
- "varying vec2 texcoord;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_Position = vec4(position.xy, 0.0, 1.0);\n"
- " texcoord = (position.xy * 0.5) + 0.5;\n"
- "}\n";
-
- const std::string fs =
- "precision highp float;\n"
- "uniform sampler2D tex;\n"
- "varying vec2 texcoord;\n"
- "\n"
- "void main()\n"
- "{\n"
- " gl_FragColor = texture2D(tex, texcoord);\n"
- "}\n";
-
- mProgram = CompileProgram(vs, fs);
- ASSERT_NE(0u, mProgram);
-
- mTextureLocation = glGetUniformLocation(mProgram, "tex");
- ASSERT_NE(-1, mTextureLocation);
}
void TearDown() override
{
- glDeleteProgram(mProgram);
-
ANGLETest::TearDown();
}
-
- GLuint mProgram = 0;
- GLint mTextureLocation = -1;
};
TEST_P(SRGBTextureTest, SRGBValidation)
@@ -174,95 +143,12 @@ TEST_P(SRGBTextureTest, SRGBARenderbuffer)
glDeleteRenderbuffers(1, &rbo);
}
-// Verify that if the srgb decode extension is available, srgb textures are too
-TEST_P(SRGBTextureTest, SRGBDecodeExtensionAvailability)
-{
- bool hasSRGBDecode = extensionEnabled("GL_EXT_texture_sRGB_decode");
- if (hasSRGBDecode)
- {
- bool hasSRGBTextures = extensionEnabled("GL_EXT_sRGB") || getClientMajorVersion() >= 3;
- EXPECT_TRUE(hasSRGBTextures);
- }
-}
-
-// Test basic functionality of SRGB decode using the texture parameter
-TEST_P(SRGBTextureTest, SRGBDecodeTextureParameter)
-{
- if (!extensionEnabled("GL_EXT_texture_sRGB_decode"))
- {
- std::cout << "Test skipped because GL_EXT_texture_sRGB_decode is not available."
- << std::endl;
- return;
- }
-
- GLColor linearColor(64, 127, 191, 255);
- GLColor srgbColor(13, 54, 133, 255);
-
- GLTexture tex;
- glBindTexture(GL_TEXTURE_2D, tex.get());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE,
- &linearColor);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
- ASSERT_GL_NO_ERROR();
-
- glUseProgram(mProgram);
- glUniform1i(mTextureLocation, 0);
-
- glDisable(GL_DEPTH_TEST);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, srgbColor, 1.0);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, linearColor, 1.0);
-}
-
-// Test basic functionality of SRGB decode using the sampler parameter
-TEST_P(SRGBTextureTest, SRGBDecodeSamplerParameter)
-{
- if (!extensionEnabled("GL_EXT_texture_sRGB_decode") || getClientMajorVersion() < 3)
- {
- std::cout << "Test skipped because GL_EXT_texture_sRGB_decode or ES3 is not available."
- << std::endl;
- return;
- }
-
- GLColor linearColor(64, 127, 191, 255);
- GLColor srgbColor(13, 54, 133, 255);
-
- GLTexture tex;
- glBindTexture(GL_TEXTURE_2D, tex.get());
- glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA_EXT, 1, 1, 0, GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE,
- &linearColor);
- ASSERT_GL_NO_ERROR();
-
- GLSampler sampler;
- glBindSampler(0, sampler.get());
- glSamplerParameteri(sampler.get(), GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT);
-
- glUseProgram(mProgram);
- glUniform1i(mTextureLocation, 0);
-
- glDisable(GL_DEPTH_TEST);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, srgbColor, 1.0);
-
- glSamplerParameteri(sampler.get(), GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
- drawQuad(mProgram, "position", 0.5f);
-
- EXPECT_PIXEL_COLOR_NEAR(0, 0, linearColor, 1.0);
-}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(SRGBTextureTest,
ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
+ ES2_OPENGLES());
} // namespace
diff --git a/gfx/angle/src/tests/gl_tests/SwizzleTest.cpp b/gfx/angle/src/tests/gl_tests/SwizzleTest.cpp
index b1ad13102..946dae0be 100755
--- a/gfx/angle/src/tests/gl_tests/SwizzleTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/SwizzleTest.cpp
@@ -399,37 +399,6 @@ TEST_P(SwizzleIntegerTest, RGB8UI_2D)
runTest2D();
}
-// Test that updating the texture data still generates the correct swizzles
-TEST_P(SwizzleTest, SubUpdate)
-{
- GLColor data(1, 64, 128, 200);
- init2DTexture(GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, &data);
-
- glUseProgram(mProgram);
- glBindTexture(GL_TEXTURE_2D, mTexture);
- glUniform1i(mTextureUniformLocation, 0);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_RED);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_RED);
-
- glClear(GL_COLOR_BUFFER_BIT);
- drawQuad(mProgram, "position", 0.5f);
-
- GLColor expectedData(data.R, data.R, data.R, data.R);
- EXPECT_PIXEL_COLOR_EQ(0, 0, expectedData);
-
- GLColor updateData(32, 234, 28, 232);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &updateData);
-
- glClear(GL_COLOR_BUFFER_BIT);
- drawQuad(mProgram, "position", 0.5f);
-
- GLColor expectedUpdateData(updateData.R, updateData.R, updateData.R, updateData.R);
- EXPECT_PIXEL_COLOR_EQ(0, 0, expectedUpdateData);
-}
-
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGL(3, 3), ES3_OPENGLES());
ANGLE_INSTANTIATE_TEST(SwizzleIntegerTest,
diff --git a/gfx/angle/src/tests/gl_tests/TextureTest.cpp b/gfx/angle/src/tests/gl_tests/TextureTest.cpp
index ee2fc7ca9..1242e0300 100755
--- a/gfx/angle/src/tests/gl_tests/TextureTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/TextureTest.cpp
@@ -4,7 +4,6 @@
// found in the LICENSE file.
//
-#include "common/mathutil.h"
#include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
@@ -14,24 +13,24 @@ namespace
{
// Take a pixel, and reset the components not covered by the format to default
-// values. In particular, the default value for the alpha component is 255
+// values. In particular, the default value for the alpha component is 65535
// (1.0 as unsigned normalized fixed point value).
-GLColor SliceFormatColor(GLenum format, GLColor full)
+GLColor16 SliceFormatColor16(GLenum format, GLColor16 full)
{
switch (format)
{
case GL_RED:
- return GLColor(full.R, 0, 0, 255u);
+ return GLColor16(full.R, 0, 0, 65535u);
case GL_RG:
- return GLColor(full.R, full.G, 0, 255u);
+ return GLColor16(full.R, full.G, 0, 65535u);
case GL_RGB:
- return GLColor(full.R, full.G, full.B, 255u);
+ return GLColor16(full.R, full.G, full.B, 65535u);
case GL_RGBA:
return full;
default:
UNREACHABLE();
- return GLColor::white;
}
+ return GLColor16::white;
}
class TexCoordDrawTest : public ANGLETest
@@ -1194,40 +1193,6 @@ TEST_P(Texture2DTest, NegativeAPISubImage)
const GLubyte *pixels[20] = { 0 };
glTexSubImage2D(GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
EXPECT_GL_ERROR(GL_INVALID_VALUE);
-
- if (extensionEnabled("GL_EXT_texture_storage"))
- {
- // Create a 1-level immutable texture.
- glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8, 2, 2);
-
- // Try calling sub image on the second level.
- glTexSubImage2D(GL_TEXTURE_2D, 1, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
- }
-}
-
-// Test that querying GL_TEXTURE_BINDING* doesn't cause an unexpected error.
-TEST_P(Texture2DTest, QueryBinding)
-{
- glBindTexture(GL_TEXTURE_2D, 0);
- EXPECT_GL_ERROR(GL_NO_ERROR);
-
- GLint textureBinding;
- glGetIntegerv(GL_TEXTURE_BINDING_2D, &textureBinding);
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(0, textureBinding);
-
- glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &textureBinding);
- if (extensionEnabled("GL_OES_EGL_image_external") ||
- extensionEnabled("GL_NV_EGL_stream_consumer_external"))
- {
- EXPECT_GL_NO_ERROR();
- EXPECT_EQ(0, textureBinding);
- }
- else
- {
- EXPECT_GL_ERROR(GL_INVALID_ENUM);
- }
}
TEST_P(Texture2DTest, ZeroSizedUploads)
@@ -2797,13 +2762,6 @@ TEST_P(SamplerInStructAsFunctionParameterTest, SamplerInStructAsFunctionParamete
std::cout << "Test skipped on Adreno OpenGLES on Android." << std::endl;
return;
}
-
- if (IsWindows() && IsIntel() && IsOpenGL())
- {
- std::cout << "Test skipped on Windows OpenGL on Intel." << std::endl;
- return;
- }
-
runSamplerInStructTest();
}
@@ -3282,8 +3240,8 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
void testNorm16Texture(GLint internalformat, GLenum format, GLenum type)
{
- GLushort pixelValue = (type == GL_SHORT) ? 0x7FFF : 0x6A35;
- GLushort imageData[] = {pixelValue, pixelValue, pixelValue, pixelValue};
+ GLushort pixelValue = type == GL_SHORT ? 0x7FFF : 0x6A35;
+ GLColor16 imageData(pixelValue, pixelValue, pixelValue, pixelValue);
setUpProgram();
@@ -3295,17 +3253,20 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16_EXT, 1, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT, nullptr);
glBindTexture(GL_TEXTURE_2D, mTextures[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0, format, type, imageData);
+ glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0, format, type, &imageData.R);
EXPECT_GL_NO_ERROR();
drawQuad(mProgram, "position", 0.5f);
- GLubyte expectedValue = (type == GL_SHORT) ? 0xFF : static_cast<GLubyte>(pixelValue >> 8);
+ GLColor16 expectedValue = imageData;
+ if (type == GL_SHORT)
+ {
+ // sampled as signed value; then stored as unsigned value
+ expectedValue = GLColor16::white;
+ }
- EXPECT_PIXEL_COLOR_EQ(
- 0, 0, SliceFormatColor(
- format, GLColor(expectedValue, expectedValue, expectedValue, expectedValue)));
+ EXPECT_PIXEL_COLOR16_EQ(0, 0, SliceFormatColor16(format, expectedValue));
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -3315,7 +3276,7 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
void testNorm16Render(GLint internalformat, GLenum format, GLenum type)
{
GLushort pixelValue = 0x6A35;
- GLushort imageData[] = {pixelValue, pixelValue, pixelValue, pixelValue};
+ GLColor16 imageData(pixelValue, pixelValue, pixelValue, pixelValue);
setUpProgram();
@@ -3327,16 +3288,13 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
0);
glBindTexture(GL_TEXTURE_2D, mTextures[2]);
- glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0, format, type, imageData);
+ glTexImage2D(GL_TEXTURE_2D, 0, internalformat, 1, 1, 0, format, type, &imageData.R);
EXPECT_GL_NO_ERROR();
drawQuad(mProgram, "position", 0.5f);
- GLubyte expectedValue = static_cast<GLubyte>(pixelValue >> 8);
- EXPECT_PIXEL_COLOR_EQ(
- 0, 0, SliceFormatColor(
- format, GLColor(expectedValue, expectedValue, expectedValue, expectedValue)));
+ EXPECT_PIXEL_COLOR16_EQ(0, 0, SliceFormatColor16(format, imageData));
glBindRenderbuffer(GL_RENDERBUFFER, mRenderbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, internalformat, 1, 1);
@@ -3350,7 +3308,8 @@ class Texture2DNorm16TestES3 : public Texture2DTestES3
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 1, 1);
- EXPECT_PIXEL_COLOR_EQ(0, 0, SliceFormatColor(format, GLColor::white));
+ GLColor16 expectedValue = GLColor16::white;
+ EXPECT_PIXEL_COLOR16_EQ(0, 0, SliceFormatColor16(format, expectedValue));
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -3521,169 +3480,6 @@ TEST_P(Texture2DTestES3, UnpackOverlappingRowsFromUnpackBuffer)
EXPECT_EQ(expected, actual);
}
-template <typename T>
-T UNorm(double value)
-{
- return static_cast<T>(value * static_cast<double>(std::numeric_limits<T>::max()));
-}
-
-// Test rendering a depth texture with mipmaps.
-TEST_P(Texture2DTestES3, DepthTexturesWithMipmaps)
-{
- //TODO(cwallez) this is failing on Intel Win7 OpenGL
- if (IsIntel() && IsWindows() && IsOpenGL())
- {
- std::cout << "Test skipped on Intel OpenGL." << std::endl;
- return;
- }
-
- const int size = getWindowWidth();
-
- auto dim = [size](int level) { return size >> level; };
- int levels = gl::log2(size);
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, mTexture2D);
- glTexStorage2D(GL_TEXTURE_2D, levels, GL_DEPTH_COMPONENT24, size, size);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- ASSERT_GL_NO_ERROR();
-
- glUseProgram(mProgram);
- glUniform1i(mTexture2DUniformLocation, 0);
-
- std::vector<unsigned char> expected;
-
- for (int level = 0; level < levels; ++level)
- {
- double value = (static_cast<double>(level) / static_cast<double>(levels - 1));
- expected.push_back(UNorm<unsigned char>(value));
-
- int levelDim = dim(level);
-
- ASSERT_GT(levelDim, 0);
-
- std::vector<unsigned int> initData(levelDim * levelDim, UNorm<unsigned int>(value));
- glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, levelDim, levelDim, GL_DEPTH_COMPONENT,
- GL_UNSIGNED_INT, initData.data());
- }
- ASSERT_GL_NO_ERROR();
-
- for (int level = 0; level < levels; ++level)
- {
- glViewport(0, 0, dim(level), dim(level));
- drawQuad(mProgram, "position", 0.5f);
- GLColor actual = ReadColor(0, 0);
- EXPECT_NEAR(expected[level], actual.R, 10u);
- }
-
- ASSERT_GL_NO_ERROR();
-}
-
-// Tests unpacking into the unsized GL_ALPHA format.
-TEST_P(Texture2DTestES3, UnsizedAlphaUnpackBuffer)
-{
- // TODO(jmadill): Figure out why this fails on OSX.
- ANGLE_SKIP_TEST_IF(IsOSX());
-
- // Initialize the texure.
- glBindTexture(GL_TEXTURE_2D, mTexture2D);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, getWindowWidth(), getWindowHeight(), 0, GL_ALPHA,
- GL_UNSIGNED_BYTE, nullptr);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- std::vector<GLubyte> bufferData(getWindowWidth() * getWindowHeight(), 127);
-
- // Pull in the color data from the unpack buffer.
- GLBuffer unpackBuffer;
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBuffer.get());
- glBufferData(GL_PIXEL_UNPACK_BUFFER, getWindowWidth() * getWindowHeight(), bufferData.data(),
- GL_STATIC_DRAW);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, getWindowWidth(), getWindowHeight(), GL_ALPHA,
- GL_UNSIGNED_BYTE, nullptr);
-
- // Clear to a weird color to make sure we're drawing something.
- glClearColor(0.5f, 0.8f, 1.0f, 0.2f);
- glClear(GL_COLOR_BUFFER_BIT);
-
- // Draw with the alpha texture and verify.
- drawQuad(mProgram, "position", 0.5f);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_NEAR(0, 0, 0, 0, 0, 127, 1);
-}
-
-// Ensure stale unpack data doesn't propagate in D3D11.
-TEST_P(Texture2DTestES3, StaleUnpackData)
-{
- // Init unpack buffer.
- GLsizei pixelCount = getWindowWidth() * getWindowHeight() / 2;
- std::vector<GLColor> pixels(pixelCount, GLColor::red);
-
- GLBuffer unpackBuffer;
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, unpackBuffer.get());
- GLsizei bufferSize = pixelCount * sizeof(GLColor);
- glBufferData(GL_PIXEL_UNPACK_BUFFER, bufferSize, pixels.data(), GL_STATIC_DRAW);
-
- // Create from unpack buffer.
- glBindTexture(GL_TEXTURE_2D, mTexture2D);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, getWindowWidth() / 2, getWindowHeight() / 2, 0,
- GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- drawQuad(mProgram, "position", 0.5f);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
-
- // Fill unpack with green, recreating buffer.
- pixels.assign(getWindowWidth() * getWindowHeight(), GLColor::green);
- GLsizei size2 = getWindowWidth() * getWindowHeight() * sizeof(GLColor);
- glBufferData(GL_PIXEL_UNPACK_BUFFER, size2, pixels.data(), GL_STATIC_DRAW);
-
- // Reinit texture with green.
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, getWindowWidth() / 2, getWindowHeight() / 2, GL_RGBA,
- GL_UNSIGNED_BYTE, nullptr);
-
- drawQuad(mProgram, "position", 0.5f);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
-}
-
-// This test covers a D3D format redefinition bug for 3D textures. The base level format was not
-// being properly checked, and the texture storage of the previous texture format was persisting.
-// This would result in an ASSERT in debug and incorrect rendering in release.
-// See http://anglebug.com/1609 and WebGL 2 test conformance2/misc/views-with-offsets.html.
-TEST_P(Texture3DTestES3, FormatRedefinitionBug)
-{
- GLTexture tex;
- glBindTexture(GL_TEXTURE_3D, tex.get());
- glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
-
- GLFramebuffer framebuffer;
- glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.get());
- glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex.get(), 0, 0);
-
- glCheckFramebufferStatus(GL_FRAMEBUFFER);
-
- std::vector<uint8_t> pixelData(100, 0);
-
- glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB565, 1, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, nullptr);
- glTexSubImage3D(GL_TEXTURE_3D, 0, 0, 0, 0, 1, 1, 1, GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
- pixelData.data());
-
- ASSERT_GL_NO_ERROR();
-}
-
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
// TODO(oetuaho): Enable all below tests on OpenGL. Requires a fix for ANGLE bug 1278.
ANGLE_INSTANTIATE_TEST(Texture2DTest,
@@ -3769,4 +3565,4 @@ ANGLE_INSTANTIATE_TEST(SamplerInStructAndOtherVariableTest,
ANGLE_INSTANTIATE_TEST(TextureLimitsTest, ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES());
ANGLE_INSTANTIATE_TEST(Texture2DNorm16TestES3, ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES());
-} // anonymous namespace
+} // namespace
diff --git a/gfx/angle/src/tests/gl_tests/TimerQueriesTest.cpp b/gfx/angle/src/tests/gl_tests/TimerQueriesTest.cpp
index 8f3725ec0..8c4d282ff 100755
--- a/gfx/angle/src/tests/gl_tests/TimerQueriesTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/TimerQueriesTest.cpp
@@ -311,13 +311,6 @@ TEST_P(TimerQueriesTest, TimeElapsedValidationTest)
// Tests timer queries operating under multiple EGL contexts with mid-query switching
TEST_P(TimerQueriesTest, TimeElapsedMulticontextTest)
{
- if (IsAMD() && IsOpenGL() && IsWindows() && IsDebug())
- {
- // TODO(jmadill): Figure out why this test is flaky on Win/AMD/OpenGL/Debug.
- std::cout << "Test skipped on Windows AMD OpenGL Debug." << std::endl;
- return;
- }
-
if (!extensionEnabled("GL_EXT_disjoint_timer_query"))
{
std::cout << "Test skipped because GL_EXT_disjoint_timer_query is not available."
diff --git a/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp b/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
index 73c8a20d5..3370a0888 100755
--- a/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/TransformFeedbackTest.cpp
@@ -742,20 +742,14 @@ TEST_P(TransformFeedbackTest, PackingBug)
GLint attrib1Loc = glGetAttribLocation(mProgram, "inAttrib1");
GLint attrib2Loc = glGetAttribLocation(mProgram, "inAttrib2");
- std::vector<Vector2> attrib1Data;
- std::vector<Vector2> attrib2Data;
- int counter = 0;
- for (size_t i = 0; i < 6; i++) {
- attrib1Data.push_back(Vector2(counter + 0.0f, counter + 1.0f));
- attrib2Data.push_back(Vector2(counter + 2.0f, counter + 3.0f));
- counter += 4;
- }
+ Vector2 attrib1Data[] = {Vector2(1.0, 2.0), Vector2(3.0, 4.0), Vector2(5.0, 6.0)};
+ Vector2 attrib2Data[] = {Vector2(11.0, 12.0), Vector2(13.0, 14.0), Vector2(15.0, 16.0)};
glEnableVertexAttribArray(attrib1Loc);
glEnableVertexAttribArray(attrib2Loc);
- glVertexAttribPointer(attrib1Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib1Data.data());
- glVertexAttribPointer(attrib2Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib2Data.data());
+ glVertexAttribPointer(attrib1Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib1Data);
+ glVertexAttribPointer(attrib2Loc, 2, GL_FLOAT, GL_FALSE, 0, attrib2Data);
glUseProgram(mProgram);
glBeginTransformFeedback(GL_TRIANGLES);
@@ -829,69 +823,6 @@ TEST_P(TransformFeedbackTest, OptimizedVaryings)
ASSERT_NE(0u, mProgram);
}
-// Test an edge case where two varyings are unreferenced in the frag shader.
-TEST_P(TransformFeedbackTest, TwoUnreferencedInFragShader)
-{
- // TODO(jmadill): With points and rasterizer discard?
- const std::string &vertexShaderSource =
- "#version 300 es\n"
- "in vec3 position;\n"
- "out vec3 outAttrib1;\n"
- "out vec3 outAttrib2;\n"
- "void main() {"
- " outAttrib1 = position;\n"
- " outAttrib2 = position;\n"
- " gl_Position = vec4(position, 1);\n"
- "}";
-
- const std::string &fragmentShaderSource =
- "#version 300 es\n"
- "precision mediump float;\n"
- "out vec4 color;\n"
- "in vec3 outAttrib1;\n"
- "in vec3 outAttrib2;\n"
- "void main() {\n"
- " color = vec4(0);\n"
- "}";
-
- std::vector<std::string> tfVaryings;
- tfVaryings.push_back("outAttrib1");
- tfVaryings.push_back("outAttrib2");
-
- mProgram = CompileProgramWithTransformFeedback(vertexShaderSource, fragmentShaderSource,
- tfVaryings, GL_INTERLEAVED_ATTRIBS);
- ASSERT_NE(0u, mProgram);
-
- glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, mTransformFeedbackBuffer);
- glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER, sizeof(Vector3) * 2 * 6, nullptr, GL_STREAM_DRAW);
-
- glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, mTransformFeedback);
- glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, mTransformFeedbackBuffer);
-
- glUseProgram(mProgram);
- glBeginTransformFeedback(GL_TRIANGLES);
- drawQuad(mProgram, "position", 0.5f);
- glEndTransformFeedback();
- glUseProgram(0);
- ASSERT_GL_NO_ERROR();
-
- const GLvoid *mapPointer =
- glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(Vector2) * 2 * 6, GL_MAP_READ_BIT);
- ASSERT_NE(nullptr, mapPointer);
-
- const auto &quadVertices = GetQuadVertices();
-
- const Vector3 *vecPointer = static_cast<const Vector3 *>(mapPointer);
- for (unsigned int vectorIndex = 0; vectorIndex < 3; ++vectorIndex)
- {
- unsigned int stream1Index = vectorIndex * 2;
- unsigned int stream2Index = vectorIndex * 2 + 1;
- EXPECT_EQ(quadVertices[vectorIndex], vecPointer[stream1Index]);
- EXPECT_EQ(quadVertices[vectorIndex], vecPointer[stream2Index]);
- }
-
- ASSERT_GL_NO_ERROR();
-}
class TransformFeedbackLifetimeTest : public TransformFeedbackTest
{
protected:
diff --git a/gfx/angle/src/tests/gl_tests/UniformBufferTest.cpp b/gfx/angle/src/tests/gl_tests/UniformBufferTest.cpp
index b3577bf30..0d35df177 100755
--- a/gfx/angle/src/tests/gl_tests/UniformBufferTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/UniformBufferTest.cpp
@@ -5,7 +5,6 @@
//
#include "test_utils/ANGLETest.h"
-#include "test_utils/gl_raii.h"
using namespace angle;
@@ -25,7 +24,7 @@ class UniformBufferTest : public ANGLETest
setConfigAlphaBits(8);
}
- void SetUp() override
+ virtual void SetUp()
{
ANGLETest::SetUp();
@@ -63,7 +62,7 @@ class UniformBufferTest : public ANGLETest
ASSERT_GL_NO_ERROR();
}
- void TearDown() override
+ virtual void TearDown()
{
glDeleteBuffers(1, &mUniformBuffer);
glDeleteProgram(mProgram);
@@ -78,6 +77,13 @@ class UniformBufferTest : public ANGLETest
// Basic UBO functionality.
TEST_P(UniformBufferTest, Simple)
{
+ // TODO(jmadill): Figure out why this fails on Intel.
+ if (IsIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ std::cout << "Test skipped on Intel." << std::endl;
+ return;
+ }
+
glClear(GL_COLOR_BUFFER_BIT);
float floatData[4] = {0.5f, 0.75f, 0.25f, 1.0f};
@@ -98,6 +104,13 @@ TEST_P(UniformBufferTest, Simple)
// The second step renders a color from a UBO with a non-zero offset.
TEST_P(UniformBufferTest, UniformBufferRange)
{
+ // TODO(jmadill): Figure out why this fails on Intel.
+ if (IsIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ std::cout << "Test skipped on Intel." << std::endl;
+ return;
+ }
+
int px = getWindowWidth() / 2;
int py = getWindowHeight() / 2;
@@ -169,6 +182,13 @@ TEST_P(UniformBufferTest, UniformBufferRange)
// Test uniform block bindings.
TEST_P(UniformBufferTest, UniformBufferBindings)
{
+ // TODO(jmadill): Figure out why this fails on Intel.
+ if (IsIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ std::cout << "Test skipped on Intel." << std::endl;
+ return;
+ }
+
int px = getWindowWidth() / 2;
int py = getWindowHeight() / 2;
@@ -225,10 +245,11 @@ TEST_P(UniformBufferTest, UnboundUniformBuffer)
// https://code.google.com/p/angleproject/issues/detail?id=965
TEST_P(UniformBufferTest, UniformBufferManyUpdates)
{
- // TODO(jmadill): Figure out why this fails on Intel OpenGL.
- if (IsIntel() && IsOpenGL())
+ // TODO(jmadill): Figure out why this fails on Intel.
+ if (IsIntel() && (getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE ||
+ getPlatformRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE))
{
- std::cout << "Test skipped on Intel OpenGL." << std::endl;
+ std::cout << "Test skipped on Intel." << std::endl;
return;
}
@@ -265,6 +286,13 @@ TEST_P(UniformBufferTest, UniformBufferManyUpdates)
// Use a large number of buffer ranges (compared to the actual size of the UBO)
TEST_P(UniformBufferTest, ManyUniformBufferRange)
{
+ // TODO(jmadill): Figure out why this fails on Intel.
+ if (IsIntel() && GetParam().getRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+ {
+ std::cout << "Test skipped on Intel." << std::endl;
+ return;
+ }
+
int px = getWindowWidth() / 2;
int py = getWindowHeight() / 2;
@@ -345,116 +373,12 @@ TEST_P(UniformBufferTest, ActiveUniformNames)
const std::string &vertexShaderSource =
"#version 300 es\n"
"in vec2 position;\n"
- "out vec2 v;\n"
- "uniform blockName1 {\n"
- " float f1;\n"
- "} instanceName1;\n"
- "uniform blockName2 {\n"
- " float f2;\n"
- "} instanceName2[1];\n"
- "void main() {\n"
- " v = vec2(instanceName1.f1, instanceName2[0].f2);\n"
- " gl_Position = vec4(position, 0, 1);\n"
- "}";
-
- const std::string &fragmentShaderSource =
- "#version 300 es\n"
- "precision highp float;\n"
- "in vec2 v;\n"
- "out vec4 color;\n"
- "void main() {\n"
- " color = vec4(v, 0, 1);\n"
- "}";
-
- GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
- ASSERT_NE(0u, program);
-
- GLint activeUniformBlocks;
- glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &activeUniformBlocks);
- ASSERT_EQ(2, activeUniformBlocks);
-
- GLint maxLength;
- GLsizei length;
- glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &maxLength);
- std::vector<GLchar> strBlockNameBuffer(maxLength + 1, 0);
- glGetActiveUniformBlockName(program, 0, maxLength, &length, &strBlockNameBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ("blockName1", std::string(&strBlockNameBuffer[0]));
-
- glGetActiveUniformBlockName(program, 1, maxLength, &length, &strBlockNameBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ("blockName2[0]", std::string(&strBlockNameBuffer[0]));
-
- GLint activeUniforms;
- glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &activeUniforms);
-
- ASSERT_EQ(2, activeUniforms);
-
- GLint size;
- GLenum type;
- glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
- std::vector<GLchar> strUniformNameBuffer(maxLength + 1, 0);
- glGetActiveUniform(program, 0, maxLength, &length, &size, &type, &strUniformNameBuffer[0]);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_GLENUM_EQ(GL_FLOAT, type);
- EXPECT_EQ("blockName1.f1", std::string(&strUniformNameBuffer[0]));
-
- glGetActiveUniform(program, 1, maxLength, &length, &size, &type, &strUniformNameBuffer[0]);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_GLENUM_EQ(GL_FLOAT, type);
- EXPECT_EQ("blockName2.f2", std::string(&strUniformNameBuffer[0]));
-}
-
-// Tests active uniforms and blocks when the layout is std140, shared and packed.
-TEST_P(UniformBufferTest, ActiveUniformNumberAndName)
-{
- // TODO(Jiajia): Figure out why this fails on Intel on Mac.
- // This case can pass on Intel Mac-10.11/10.12. But it fails on Intel Mac-10.10.
- if (IsIntel() && IsOSX())
- {
- std::cout << "Test skipped on Intel on Mac." << std::endl;
- return;
- }
-
- // This case fails on all AMD platforms (Mac, Linux, Win).
- // TODO(zmo): This actually passes on certain AMD cards, but we don't have
- // a way to do device specific handling yet.
- if (IsAMD())
- {
- std::cout << "Test skipped on AMD." << std::endl;
- return;
- }
-
- const std::string &vertexShaderSource =
- "#version 300 es\n"
- "in vec2 position;\n"
"out float v;\n"
- "struct S {\n"
- " highp ivec3 a;\n"
- " mediump ivec2 b[4];\n"
- "};\n"
- "layout(std140) uniform blockName0 {\n"
- " S s0;\n"
- " lowp vec2 v0;\n"
- " S s1[2];\n"
- " highp uint u0;\n"
- "};\n"
- "layout(std140) uniform blockName1 {\n"
- " float f1;\n"
- " bool b1;\n"
- "} instanceName1;\n"
- "layout(shared) uniform blockName2 {\n"
- " float f2;\n"
- "};\n"
- "layout(packed) uniform blockName3 {\n"
- " float f3;\n"
- "};\n"
+ "uniform blockName {\n"
+ " float f;\n"
+ "} instanceName;\n"
"void main() {\n"
- " v = instanceName1.f1;\n"
+ " v = instanceName.f;\n"
" gl_Position = vec4(position, 0, 1);\n"
"}";
@@ -467,99 +391,25 @@ TEST_P(UniformBufferTest, ActiveUniformNumberAndName)
" color = vec4(v, 0, 0, 1);\n"
"}";
- ANGLE_GL_PROGRAM(program, vertexShaderSource, fragmentShaderSource);
+ GLuint program = CompileProgram(vertexShaderSource, fragmentShaderSource);
+ ASSERT_NE(0u, program);
- // Note that the packed |blockName3| might (or might not) be optimized out.
GLint activeUniforms;
- glGetProgramiv(program.get(), GL_ACTIVE_UNIFORMS, &activeUniforms);
- EXPECT_GE(activeUniforms, 11);
+ glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &activeUniforms);
- GLint activeUniformBlocks;
- glGetProgramiv(program.get(), GL_ACTIVE_UNIFORM_BLOCKS, &activeUniformBlocks);
- EXPECT_GE(activeUniformBlocks, 3);
+ ASSERT_EQ(1, activeUniforms);
GLint maxLength, size;
GLenum type;
GLsizei length;
- glGetProgramiv(program.get(), GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
+ glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
std::vector<GLchar> strBuffer(maxLength + 1, 0);
+ glGetActiveUniform(program, 0, maxLength, &length, &size, &type, &strBuffer[0]);
- glGetActiveUniform(program.get(), 0, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("s0.a", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 1, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(4, size);
- EXPECT_EQ("s0.b[0]", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 2, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("v0", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 3, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("s1[0].a", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 4, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(4, size);
- EXPECT_EQ("s1[0].b[0]", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 5, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("s1[1].a", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 6, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(4, size);
- EXPECT_EQ("s1[1].b[0]", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 7, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("u0", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 8, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("blockName1.f1", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 9, maxLength, &length, &size, &type, &strBuffer[0]);
- ASSERT_GL_NO_ERROR();
- EXPECT_EQ(1, size);
- EXPECT_EQ("blockName1.b1", std::string(&strBuffer[0]));
-
- glGetActiveUniform(program.get(), 10, maxLength, &length, &size, &type, &strBuffer[0]);
ASSERT_GL_NO_ERROR();
EXPECT_EQ(1, size);
- EXPECT_EQ("f2", std::string(&strBuffer[0]));
-}
-
-// Test that using a very large buffer to back a small uniform block works OK.
-TEST_P(UniformBufferTest, VeryLarge)
-{
- glClear(GL_COLOR_BUFFER_BIT);
- float floatData[4] = {0.5f, 0.75f, 0.25f, 1.0f};
-
- GLsizei bigSize = 4096 * 64;
- std::vector<GLubyte> zero(bigSize, 0);
-
- glBindBuffer(GL_UNIFORM_BUFFER, mUniformBuffer);
- glBufferData(GL_UNIFORM_BUFFER, bigSize, zero.data(), GL_STATIC_DRAW);
- glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(float) * 4, floatData);
-
- glBindBufferBase(GL_UNIFORM_BUFFER, 0, mUniformBuffer);
-
- glUniformBlockBinding(mProgram, mUniformBufferIndex, 0);
- drawQuad(mProgram, "position", 0.5f);
-
- ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_NEAR(0, 0, 128, 191, 64, 255, 1);
+ EXPECT_GLENUM_EQ(GL_FLOAT, type);
+ EXPECT_EQ("blockName.f", std::string(&strBuffer[0]));
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
diff --git a/gfx/angle/src/tests/gl_tests/UniformTest.cpp b/gfx/angle/src/tests/gl_tests/UniformTest.cpp
index 4dd2738ef..c3ec72c5c 100755
--- a/gfx/angle/src/tests/gl_tests/UniformTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/UniformTest.cpp
@@ -459,54 +459,6 @@ TEST_P(UniformTestES3, TranposedMatrixArrayUniformStateQuery)
}
}
-// Check that trying setting too many elements of an array doesn't overflow
-TEST_P(UniformTestES3, OverflowArray)
-{
- const std::string &vertexShader =
- "#version 300 es\n"
- "void main() { gl_Position = vec4(1); }";
- const std::string &fragShader =
- "#version 300 es\n"
- "precision mediump float;\n"
- "uniform float uniF[5];\n"
- "uniform mat3x2 uniMat3x2[5];\n"
- "out vec4 color;\n"
- "void main() {\n"
- " color = vec4(uniMat3x2[0][0][0] + uniF[0]);\n"
- "}";
-
- mProgram = CompileProgram(vertexShader, fragShader);
- ASSERT_NE(mProgram, 0u);
-
- glUseProgram(mProgram);
-
- const size_t kOverflowSize = 10000;
- std::vector<GLfloat> values(10000 * 6);
-
- // Setting as a clump
- GLint floatLocation = glGetUniformLocation(mProgram, "uniF");
- ASSERT_NE(-1, floatLocation);
- GLint matLocation = glGetUniformLocation(mProgram, "uniMat3x2");
- ASSERT_NE(-1, matLocation);
-
- // Set too many float uniforms
- glUniform1fv(floatLocation, kOverflowSize, &values[0]);
-
- // Set too many matrix uniforms, transposed or not
- glUniformMatrix3x2fv(matLocation, kOverflowSize, GL_FALSE, &values[0]);
- glUniformMatrix3x2fv(matLocation, kOverflowSize, GL_TRUE, &values[0]);
-
- // Same checks but with offsets
- GLint floatLocationOffset = glGetUniformLocation(mProgram, "uniF[3]");
- ASSERT_NE(-1, floatLocationOffset);
- GLint matLocationOffset = glGetUniformLocation(mProgram, "uniMat3x2[3]");
- ASSERT_NE(-1, matLocationOffset);
-
- glUniform1fv(floatLocationOffset, kOverflowSize, &values[0]);
- glUniformMatrix3x2fv(matLocationOffset, kOverflowSize, GL_FALSE, &values[0]);
- glUniformMatrix3x2fv(matLocationOffset, kOverflowSize, GL_TRUE, &values[0]);
-}
-
// Check that sampler uniforms only show up one time in the list
TEST_P(UniformTest, SamplerUniformsAppearOnce)
{
@@ -612,7 +564,7 @@ TEST_P(UniformTestES3, ReturnsOnlyOneArrayElement)
for (const auto &array : uniformArrays)
{
uniformStream << "uniform " << array.type << " " << array.name << "["
- << ToString(kArraySize) << "];\n";
+ << std::to_string(kArraySize) << "];\n";
// We need to make use of the uniforms or they get compiled out.
for (int i = 0; i < 4; i++)
@@ -658,7 +610,7 @@ TEST_P(UniformTestES3, ReturnsOnlyOneArrayElement)
{
for (size_t index = 0; index < kArraySize; index++)
{
- std::string strIndex = "[" + ToString(index) + "]";
+ std::string strIndex = "[" + std::to_string(index) + "]";
// Check all the different glGetUniformv functions
CheckOneElement<float>(glGetUniformfv, mProgram, uniformArray.name + strIndex,
uniformArray.components, 42.4242f);
diff --git a/gfx/angle/src/tests/gl_tests/VertexAttributeTest.cpp b/gfx/angle/src/tests/gl_tests/VertexAttributeTest.cpp
index b1b9dcd1f..01b79ec61 100755
--- a/gfx/angle/src/tests/gl_tests/VertexAttributeTest.cpp
+++ b/gfx/angle/src/tests/gl_tests/VertexAttributeTest.cpp
@@ -102,7 +102,7 @@ class VertexAttributeTest : public ANGLETest
if (test.source == Source::BUFFER)
{
- GLsizei dataSize = mVertexCount * TypeStride(test.type);
+ GLsizei dataSize = mVertexCount * TypeStride(test.type) * typeSize;
glBindBuffer(GL_ARRAY_BUFFER, mBuffer);
glBufferData(GL_ARRAY_BUFFER, dataSize, test.inputData, GL_STATIC_DRAW);
glVertexAttribPointer(mTestAttrib, typeSize, test.type, test.normalized, 0,
diff --git a/gfx/angle/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/gfx/angle/src/tests/gl_tests/WebGLCompatibilityTest.cpp
deleted file mode 100644
index 48a9d2bae..000000000
--- a/gfx/angle/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// 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.
-//
-
-// WebGLCompatibilityTest.cpp : Tests of the GL_ANGLE_webgl_compatibility extension.
-
-#include "test_utils/ANGLETest.h"
-
-#include "test_utils/gl_raii.h"
-
-namespace angle
-{
-
-class WebGLCompatibilityTest : public ANGLETest
-{
- protected:
- WebGLCompatibilityTest()
- {
- setWindowWidth(128);
- setWindowHeight(128);
- setConfigRedBits(8);
- setConfigGreenBits(8);
- setConfigBlueBits(8);
- setConfigAlphaBits(8);
- setWebGLCompatibilityEnabled(true);
- }
-
- void SetUp() override
- {
- ANGLETest::SetUp();
- glEnableExtensionANGLE = reinterpret_cast<PFNGLENABLEEXTENSIONANGLEPROC>(
- eglGetProcAddress("glEnableExtensionANGLE"));
- }
-
- void TearDown() override { ANGLETest::TearDown(); }
-
- PFNGLENABLEEXTENSIONANGLEPROC glEnableExtensionANGLE = nullptr;
-};
-
-// Context creation would fail if EGL_ANGLE_create_context_webgl_compatibility was not available so
-// the GL extension should always be present
-TEST_P(WebGLCompatibilityTest, ExtensionStringExposed)
-{
- EXPECT_TRUE(extensionEnabled("GL_ANGLE_webgl_compatibility"));
-}
-
-// Verify that all extension entry points are available
-TEST_P(WebGLCompatibilityTest, EntryPoints)
-{
- if (extensionEnabled("GL_ANGLE_webgl_compatibility"))
- {
- EXPECT_NE(nullptr, eglGetProcAddress("glEnableExtensionANGLE"));
- }
-}
-
-// WebGL 1 allows GL_DEPTH_STENCIL_ATTACHMENT as a valid binding point. Make sure it is usable,
-// even in ES2 contexts.
-TEST_P(WebGLCompatibilityTest, DepthStencilBindingPoint)
-{
- GLRenderbuffer renderbuffer;
- glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer.get());
- glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 32, 32);
-
- GLFramebuffer framebuffer;
- glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.get());
- glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
- renderbuffer.get());
-
- EXPECT_GL_NO_ERROR();
-}
-
-// Test that attempting to enable an extension that doesn't exist generates GL_INVALID_OPERATION
-TEST_P(WebGLCompatibilityTest, EnableExtensionValidation)
-{
- EXPECT_EQ(GL_FALSE, glEnableExtensionANGLE("invalid_extension_string"));
- EXPECT_GL_ERROR(GL_INVALID_OPERATION);
-}
-
-// Test enabling the GL_OES_element_index_uint extension
-TEST_P(WebGLCompatibilityTest, EnableExtensionUintIndices)
-{
- if (getClientMajorVersion() != 2)
- {
- // This test only works on ES2 where uint indices are not available by default
- return;
- }
-
- EXPECT_FALSE(extensionEnabled("GL_OES_element_index_uint"));
-
- GLBuffer indexBuffer;
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer.get());
-
- GLuint data[] = {0, 1, 2, 1, 3, 2};
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(data), data, GL_STATIC_DRAW);
-
- ANGLE_GL_PROGRAM(program, "void main() { gl_Position = vec4(0, 0, 0, 1); }",
- "void main() { gl_FragColor = vec4(0, 1, 0, 1); }")
- glUseProgram(program.get());
-
- glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, nullptr);
- EXPECT_GL_ERROR(GL_INVALID_ENUM);
-
- if (glEnableExtensionANGLE("GL_OES_element_index_uint"))
- {
- EXPECT_GL_NO_ERROR();
- EXPECT_TRUE(extensionEnabled("GL_OES_element_index_uint"));
-
- glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, nullptr);
- EXPECT_GL_NO_ERROR();
- }
-}
-
-// Verify that shaders are of a compatible spec when the extension is enabled.
-TEST_P(WebGLCompatibilityTest, ExtensionCompilerSpec)
-{
- EXPECT_TRUE(extensionEnabled("GL_ANGLE_webgl_compatibility"));
-
- // Use of reserved _webgl prefix should fail when the shader specification is for WebGL.
- const std::string &vert =
- "struct Foo {\n"
- " int _webgl_bar;\n"
- "};\n"
- "void main()\n"
- "{\n"
- " Foo foo = Foo(1);\n"
- "}";
-
- // Default fragement shader.
- const std::string &frag =
- "void main()\n"
- "{\n"
- " gl_FragColor = vec4(1.0,0.0,0.0,1.0);\n"
- "}";
-
- GLuint program = CompileProgram(vert, frag);
- EXPECT_EQ(0u, program);
- glDeleteProgram(program);
-}
-
-// Use this to select which configurations (e.g. which renderer, which GLES major version) these
-// tests should be run against.
-ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,
- ES2_D3D9(),
- ES2_D3D11(),
- ES3_D3D11(),
- ES2_D3D11_FL9_3(),
- ES2_OPENGL(),
- ES3_OPENGL(),
- ES2_OPENGLES(),
- ES3_OPENGLES());
-
-} // namespace