Commit 09924221 by Ian Elliott Committed by Commit Bot

Convert the EGL end2end tests to use RAII types/macros

These tests are frequently cloned to make new tests, and so it's good to do a more-global refactor so that these and future tests will use RAII. Bug: angleproject:4947 Change-Id: I2973e70ee075629965b18c685793975537e96b6c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2372627Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Reviewed-by: 's avatarCourtney Goeltzenleuchter <courtneygo@google.com> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 027f0c38
...@@ -159,26 +159,25 @@ void main() ...@@ -159,26 +159,25 @@ void main()
// Compile a shader so it puts something in the cache // Compile a shader so it puts something in the cache
if (programBinaryAvailable()) if (programBinaryAvailable())
{ {
GLuint program = CompileProgram(kVertexShaderSrc, kFragmentShaderSrc); ANGLE_GL_PROGRAM(program, kVertexShaderSrc, kFragmentShaderSrc);
ASSERT_NE(0u, program);
EXPECT_EQ(CacheOpResult::SetSuccess, gLastCacheOpResult); EXPECT_EQ(CacheOpResult::SetSuccess, gLastCacheOpResult);
gLastCacheOpResult = CacheOpResult::ValueNotSet; gLastCacheOpResult = CacheOpResult::ValueNotSet;
// Compile the same shader again, so it would try to retrieve it from the cache // Compile the same shader again, so it would try to retrieve it from the cache
program = CompileProgram(kVertexShaderSrc, kFragmentShaderSrc); program.makeRaster(kVertexShaderSrc, kFragmentShaderSrc);
ASSERT_NE(0u, program); ASSERT_TRUE(program.valid());
EXPECT_EQ(CacheOpResult::GetSuccess, gLastCacheOpResult); EXPECT_EQ(CacheOpResult::GetSuccess, gLastCacheOpResult);
gLastCacheOpResult = CacheOpResult::ValueNotSet; gLastCacheOpResult = CacheOpResult::ValueNotSet;
// Compile another shader, which should create a new entry // Compile another shader, which should create a new entry
program = CompileProgram(kVertexShaderSrc2, kFragmentShaderSrc2); program.makeRaster(kVertexShaderSrc2, kFragmentShaderSrc2);
ASSERT_NE(0u, program); ASSERT_TRUE(program.valid());
EXPECT_EQ(CacheOpResult::SetSuccess, gLastCacheOpResult); EXPECT_EQ(CacheOpResult::SetSuccess, gLastCacheOpResult);
gLastCacheOpResult = CacheOpResult::ValueNotSet; gLastCacheOpResult = CacheOpResult::ValueNotSet;
// Compile the first shader again, which should still reside in the cache // Compile the first shader again, which should still reside in the cache
program = CompileProgram(kVertexShaderSrc, kFragmentShaderSrc); program.makeRaster(kVertexShaderSrc, kFragmentShaderSrc);
ASSERT_NE(0u, program); ASSERT_TRUE(program.valid());
EXPECT_EQ(CacheOpResult::GetSuccess, gLastCacheOpResult); EXPECT_EQ(CacheOpResult::GetSuccess, gLastCacheOpResult);
gLastCacheOpResult = CacheOpResult::ValueNotSet; gLastCacheOpResult = CacheOpResult::ValueNotSet;
} }
......
...@@ -152,15 +152,13 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing) ...@@ -152,15 +152,13 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing)
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
// Create a texture and buffer in ctx 0 // Create a texture and buffer in ctx 0
GLuint textureFromCtx0 = 0; GLTexture textureFromCtx0;
glGenTextures(1, &textureFromCtx0);
glBindTexture(GL_TEXTURE_2D, textureFromCtx0); glBindTexture(GL_TEXTURE_2D, textureFromCtx0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
ASSERT_GL_TRUE(glIsTexture(textureFromCtx0)); ASSERT_GL_TRUE(glIsTexture(textureFromCtx0));
GLuint bufferFromCtx0 = 0; GLBuffer bufferFromCtx0;
glGenBuffers(1, &bufferFromCtx0);
glBindBuffer(GL_ARRAY_BUFFER, bufferFromCtx0); glBindBuffer(GL_ARRAY_BUFFER, bufferFromCtx0);
glBufferData(GL_ARRAY_BUFFER, 1, nullptr, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, 1, nullptr, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
...@@ -178,8 +176,7 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing) ...@@ -178,8 +176,7 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Call readpixels on the texture to verify that the backend has proper support // Call readpixels on the texture to verify that the backend has proper support
GLuint fbo = 0; GLFramebuffer fbo;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureFromCtx0, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureFromCtx0, 0);
...@@ -187,19 +184,9 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing) ...@@ -187,19 +184,9 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupObjectSharing)
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glDeleteFramebuffers(1, &fbo);
glDeleteTextures(1, &textureFromCtx0);
ASSERT_GL_NO_ERROR();
ASSERT_GL_FALSE(glIsTexture(textureFromCtx0));
// Switch back to context 0 and delete the buffer // Switch back to context 0 and delete the buffer
ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[0])); ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[0]));
ASSERT_EGL_SUCCESS(); ASSERT_EGL_SUCCESS();
ASSERT_GL_TRUE(glIsBuffer(bufferFromCtx0));
glDeleteBuffers(1, &bufferFromCtx0);
ASSERT_GL_NO_ERROR();
} }
// Tests that shared textures using EGL_ANGLE_display_texture_share_group are released when the last // Tests that shared textures using EGL_ANGLE_display_texture_share_group are released when the last
...@@ -226,8 +213,7 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupReleasedWithLastContext) ...@@ -226,8 +213,7 @@ TEST_P(EGLContextSharingTest, DisplayShareGroupReleasedWithLastContext)
// Create a texture and buffer in ctx 0 // Create a texture and buffer in ctx 0
ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[0])); ASSERT_EGL_TRUE(eglMakeCurrent(display, surface, surface, mContexts[0]));
GLuint textureFromCtx0 = 0; GLTexture textureFromCtx0;
glGenTextures(1, &textureFromCtx0);
glBindTexture(GL_TEXTURE_2D, textureFromCtx0); glBindTexture(GL_TEXTURE_2D, textureFromCtx0);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
......
...@@ -198,7 +198,7 @@ class IOSurfaceClientBufferTest : public ANGLETest ...@@ -198,7 +198,7 @@ class IOSurfaceClientBufferTest : public ANGLETest
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getGLTextureTarget(), texture, glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getGLTextureTarget(), texture,
0); 0);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
EXPECT_GLENUM_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GL_FRAMEBUFFER_COMPLETE); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glClearColor(1.0f / 255.0f, 2.0f / 255.0f, 3.0f / 255.0f, 4.0f / 255.0f); glClearColor(1.0f / 255.0f, 2.0f / 255.0f, 3.0f / 255.0f, 4.0f / 255.0f);
...@@ -321,7 +321,7 @@ class IOSurfaceClientBufferTest : public ANGLETest ...@@ -321,7 +321,7 @@ class IOSurfaceClientBufferTest : public ANGLETest
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getGLTextureTarget(), texture, glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getGLTextureTarget(), texture,
0); 0);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
EXPECT_GLENUM_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GL_FRAMEBUFFER_COMPLETE); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Create another framebuffer with a regular renderbuffer. // Create another framebuffer with a regular renderbuffer.
...@@ -335,7 +335,7 @@ class IOSurfaceClientBufferTest : public ANGLETest ...@@ -335,7 +335,7 @@ class IOSurfaceClientBufferTest : public ANGLETest
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
EXPECT_GLENUM_EQ(glCheckFramebufferStatus(GL_FRAMEBUFFER), GL_FRAMEBUFFER_COMPLETE); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glBindRenderbuffer(GL_RENDERBUFFER, 0); glBindRenderbuffer(GL_RENDERBUFFER, 0);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "common/Color.h" #include "common/Color.h"
#include "common/platform.h" #include "common/platform.h"
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "util/EGLWindow.h" #include "util/EGLWindow.h"
#include "util/OSWindow.h" #include "util/OSWindow.h"
#include "util/Timer.h" #include "util/Timer.h"
...@@ -293,8 +294,7 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDraw) ...@@ -293,8 +294,7 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDraw)
" gl_FragColor = vec4(v_data, 0, 1);\n" " gl_FragColor = vec4(v_data, 0, 1);\n"
"}"; "}";
GLuint program = CompileProgram(kVS, kFS); ANGLE_GL_PROGRAM(program, kVS, kFS);
ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
GLint positionLocation = glGetAttribLocation(program, "position"); GLint positionLocation = glGetAttribLocation(program, "position");
...@@ -303,14 +303,9 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDraw) ...@@ -303,14 +303,9 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDraw)
GLint redGreenLocation = glGetAttribLocation(program, "redGreen"); GLint redGreenLocation = glGetAttribLocation(program, "redGreen");
ASSERT_NE(-1, redGreenLocation); ASSERT_NE(-1, redGreenLocation);
GLuint indexBuffer; GLBuffer indexBuffer;
glGenBuffers(1, &indexBuffer); GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
GLuint vertexArray;
glGenVertexArrays(1, &vertexArray);
std::vector<GLuint> vertexBuffers(2);
glGenBuffers(2, &vertexBuffers[0]);
glBindVertexArray(vertexArray); glBindVertexArray(vertexArray);
...@@ -388,8 +383,7 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDerivativeDraw) ...@@ -388,8 +383,7 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDerivativeDraw)
" FragColor = vec4(dFdx(v_data.x), dFdy(v_data.y), 0, 1);\n" " FragColor = vec4(dFdx(v_data.x), dFdy(v_data.y), 0, 1);\n"
"}"; "}";
GLuint program = CompileProgram(kVS, kFS); ANGLE_GL_PROGRAM(program, kVS, kFS);
ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
GLint positionLocation = glGetAttribLocation(program, "position"); GLint positionLocation = glGetAttribLocation(program, "position");
...@@ -398,14 +392,9 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDerivativeDraw) ...@@ -398,14 +392,9 @@ TEST_P(EGLPreRotationSurfaceTest, OrientedWindowWithDerivativeDraw)
GLint redGreenLocation = glGetAttribLocation(program, "redGreen"); GLint redGreenLocation = glGetAttribLocation(program, "redGreen");
ASSERT_NE(-1, redGreenLocation); ASSERT_NE(-1, redGreenLocation);
GLuint indexBuffer; GLBuffer indexBuffer;
glGenBuffers(1, &indexBuffer); GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
GLuint vertexArray;
glGenVertexArrays(1, &vertexArray);
std::vector<GLuint> vertexBuffers(2);
glGenBuffers(2, &vertexBuffers[0]);
glBindVertexArray(vertexArray); glBindVertexArray(vertexArray);
...@@ -514,8 +503,7 @@ TEST_P(EGLPreRotationSurfaceTest, ChangeRotationWithDraw) ...@@ -514,8 +503,7 @@ TEST_P(EGLPreRotationSurfaceTest, ChangeRotationWithDraw)
" gl_FragColor = vec4(v_data, 0, 1);\n" " gl_FragColor = vec4(v_data, 0, 1);\n"
"}"; "}";
GLuint program = CompileProgram(kVS, kFS); ANGLE_GL_PROGRAM(program, kVS, kFS);
ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
GLint positionLocation = glGetAttribLocation(program, "position"); GLint positionLocation = glGetAttribLocation(program, "position");
...@@ -524,14 +512,9 @@ TEST_P(EGLPreRotationSurfaceTest, ChangeRotationWithDraw) ...@@ -524,14 +512,9 @@ TEST_P(EGLPreRotationSurfaceTest, ChangeRotationWithDraw)
GLint redGreenLocation = glGetAttribLocation(program, "redGreen"); GLint redGreenLocation = glGetAttribLocation(program, "redGreen");
ASSERT_NE(-1, redGreenLocation); ASSERT_NE(-1, redGreenLocation);
GLuint indexBuffer; GLBuffer indexBuffer;
glGenBuffers(1, &indexBuffer); GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
GLuint vertexArray;
glGenVertexArrays(1, &vertexArray);
std::vector<GLuint> vertexBuffers(2);
glGenBuffers(2, &vertexBuffers[0]);
glBindVertexArray(vertexArray); glBindVertexArray(vertexArray);
...@@ -666,21 +649,15 @@ TEST_P(EGLPreRotationLargeSurfaceTest, OrientedWindowWithFragCoordDraw) ...@@ -666,21 +649,15 @@ TEST_P(EGLPreRotationLargeSurfaceTest, OrientedWindowWithFragCoordDraw)
" gl_FragColor = vec4(gl_FragCoord.x / 256.0, gl_FragCoord.y / 256.0, 0.0, 1.0);\n" " gl_FragColor = vec4(gl_FragCoord.x / 256.0, gl_FragCoord.y / 256.0, 0.0, 1.0);\n"
"}"; "}";
GLuint program = CompileProgram(kVS, kFS); ANGLE_GL_PROGRAM(program, kVS, kFS);
ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
GLint positionLocation = glGetAttribLocation(program, "position"); GLint positionLocation = glGetAttribLocation(program, "position");
ASSERT_NE(-1, positionLocation); ASSERT_NE(-1, positionLocation);
GLuint indexBuffer; GLBuffer indexBuffer;
glGenBuffers(1, &indexBuffer); GLVertexArray vertexArray;
GLBuffer vertexBuffer;
GLuint vertexArray;
glGenVertexArrays(1, &vertexArray);
GLuint vertexBuffer;
glGenBuffers(1, &vertexBuffer);
glBindVertexArray(vertexArray); glBindVertexArray(vertexArray);
...@@ -751,7 +728,10 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest ...@@ -751,7 +728,10 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest
return CompileProgram(kVS, kFS); return CompileProgram(kVS, kFS);
} }
void initializeGeometry(GLuint program) void initializeGeometry(GLuint program,
GLBuffer *indexBuffer,
GLVertexArray *vertexArray,
GLBuffer *vertexBuffers)
{ {
GLint positionLocation = glGetAttribLocation(program, "position"); GLint positionLocation = glGetAttribLocation(program, "position");
ASSERT_NE(-1, positionLocation); ASSERT_NE(-1, positionLocation);
...@@ -759,19 +739,10 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest ...@@ -759,19 +739,10 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest
GLint redGreenLocation = glGetAttribLocation(program, "redGreen"); GLint redGreenLocation = glGetAttribLocation(program, "redGreen");
ASSERT_NE(-1, redGreenLocation); ASSERT_NE(-1, redGreenLocation);
GLuint indexBuffer; glBindVertexArray(*vertexArray);
glGenBuffers(1, &indexBuffer);
GLuint vertexArray;
glGenVertexArrays(1, &vertexArray);
std::vector<GLuint> vertexBuffers(2);
glGenBuffers(2, &vertexBuffers[0]);
glBindVertexArray(vertexArray);
std::vector<GLushort> indices = {0, 1, 2, 2, 3, 0}; std::vector<GLushort> indices = {0, 1, 2, 2, 3, 0};
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *indexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLushort) * indices.size(), &indices[0], glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLushort) * indices.size(), &indices[0],
GL_STATIC_DRAW); GL_STATIC_DRAW);
...@@ -796,14 +767,9 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest ...@@ -796,14 +767,9 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest
glEnableVertexAttribArray(redGreenLocation); glEnableVertexAttribArray(redGreenLocation);
} }
GLuint createFBO() void initializeFBO(GLFramebuffer *framebuffer, GLTexture *texture)
{ {
GLuint framebuffer = 0; glBindTexture(GL_TEXTURE_2D, *texture);
GLuint texture = 0;
glGenFramebuffers(1, &framebuffer);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 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_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
...@@ -811,10 +777,8 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest ...@@ -811,10 +777,8 @@ class EGLPreRotationBlitFramebufferTest : public EGLPreRotationLargeSurfaceTest
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mSize, mSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, mSize, mSize, 0, GL_RGBA, GL_UNSIGNED_BYTE,
nullptr); nullptr);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, *framebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, *texture, 0);
return framebuffer;
} }
// Ensures that the correct colors are where they should be when the entire 256x256 pattern has // Ensures that the correct colors are where they should be when the entire 256x256 pattern has
...@@ -860,11 +824,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, BasicBlitFramebuffer) ...@@ -860,11 +824,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, BasicBlitFramebuffer)
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -947,11 +916,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, LeftAndRightBlitFramebuffer) ...@@ -947,11 +916,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, LeftAndRightBlitFramebuffer)
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1060,11 +1034,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, TopAndBottomBlitFramebuffer) ...@@ -1060,11 +1034,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, TopAndBottomBlitFramebuffer)
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1174,11 +1153,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, ScaledBlitFramebuffer) ...@@ -1174,11 +1153,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, ScaledBlitFramebuffer)
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1292,11 +1276,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestBlitFramebuffer) ...@@ -1292,11 +1276,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestBlitFramebuffer)
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1378,11 +1367,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceBlitFramebuffe ...@@ -1378,11 +1367,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceBlitFramebuffe
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1530,11 +1524,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceWithStretchBli ...@@ -1530,11 +1524,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceWithStretchBli
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
...@@ -1649,11 +1648,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceAndDestBlitFra ...@@ -1649,11 +1648,16 @@ TEST_P(EGLPreRotationBlitFramebufferTest, FboDestOutOfBoundsSourceAndDestBlitFra
ASSERT_NE(0u, program); ASSERT_NE(0u, program);
glUseProgram(program); glUseProgram(program);
initializeGeometry(program); GLBuffer indexBuffer;
GLVertexArray vertexArray;
GLBuffer vertexBuffers[2];
initializeGeometry(program, &indexBuffer, &vertexArray, vertexBuffers);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
// Create a texture-backed FBO and render the predictable pattern to it // Create a texture-backed FBO and render the predictable pattern to it
GLuint fbo = createFBO(); GLFramebuffer fbo;
GLTexture texture;
initializeFBO(&fbo, &texture);
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
glViewport(0, 0, mSize, mSize); glViewport(0, 0, mSize, mSize);
......
...@@ -177,8 +177,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureValidationTest) ...@@ -177,8 +177,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureValidationTest)
ASSERT_EGL_FALSE(result); ASSERT_EGL_FALSE(result);
ASSERT_EGL_ERROR(EGL_BAD_ACCESS); ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
GLuint tex; GLTexture tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex); glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
result = eglStreamConsumerGLTextureExternalKHR(display, stream); result = eglStreamConsumerGLTextureExternalKHR(display, stream);
ASSERT_EGL_TRUE(result); ASSERT_EGL_TRUE(result);
...@@ -286,8 +285,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureYUVValidationTest) ...@@ -286,8 +285,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureYUVValidationTest)
ASSERT_EGL_FALSE(result); ASSERT_EGL_FALSE(result);
ASSERT_EGL_ERROR(EGL_BAD_ACCESS); ASSERT_EGL_ERROR(EGL_BAD_ACCESS);
GLuint tex[2]; GLTexture tex[2];
glGenTextures(2, tex);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex[0]); glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex[0]);
glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
...@@ -342,6 +340,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureYUVDeletionTest) ...@@ -342,6 +340,7 @@ TEST_P(EGLStreamTest, StreamConsumerGLTextureYUVDeletionTest)
EGL_NONE, EGL_NONE,
}; };
// Note: The purpose of this test means that we can't use the RAII GLTexture class
GLuint tex[2]; GLuint tex[2];
glGenTextures(2, tex); glGenTextures(2, tex);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
...@@ -399,7 +398,7 @@ class D3D11TextureStreamSamplingTest : public ANGLETest ...@@ -399,7 +398,7 @@ class D3D11TextureStreamSamplingTest : public ANGLETest
glGenFramebuffers(1, &mFB); glGenFramebuffers(1, &mFB);
glBindFramebuffer(GL_FRAMEBUFFER, mFB); glBindFramebuffer(GL_FRAMEBUFFER, mFB);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mRB); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, mRB);
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
glViewport(0, 0, 2, 2); glViewport(0, 0, 2, 2);
glClearColor(1, 0, 0, 1); glClearColor(1, 0, 0, 1);
...@@ -784,8 +783,7 @@ TEST_P(EGLStreamTest, StreamProducerTextureNV12End2End) ...@@ -784,8 +783,7 @@ TEST_P(EGLStreamTest, StreamProducerTextureNV12End2End)
EGL_NONE, EGL_NONE,
}; };
GLuint tex[2]; GLTexture tex[2];
glGenTextures(2, tex);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex[0]); glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex[0]);
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "common/Color.h" #include "common/Color.h"
#include "common/platform.h" #include "common/platform.h"
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "test_utils/gl_raii.h"
#include "util/EGLWindow.h" #include "util/EGLWindow.h"
#include "util/OSWindow.h" #include "util/OSWindow.h"
#include "util/Timer.h" #include "util/Timer.h"
...@@ -997,14 +998,12 @@ TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithTextureOffset) ...@@ -997,14 +998,12 @@ TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithTextureOffset)
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
// Blit framebuffer should also blit to the same subrect despite the dstX/Y arguments. // Blit framebuffer should also blit to the same subrect despite the dstX/Y arguments.
GLuint renderBuffer = 0; GLRenderbuffer renderBuffer;
glGenRenderbuffers(1u, &renderBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer); glBindRenderbuffer(GL_RENDERBUFFER, renderBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 50, 50); glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 50, 50);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
GLuint framebuffer = 0; GLFramebuffer framebuffer;
glGenFramebuffers(1u, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderBuffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderBuffer);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
...@@ -1023,10 +1022,6 @@ TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithTextureOffset) ...@@ -1023,10 +1022,6 @@ TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithTextureOffset)
EXPECT_PIXEL_EQ(25, 25, 0, 0, 0, 255); EXPECT_PIXEL_EQ(25, 25, 0, 0, 0, 255);
EXPECT_PIXEL_EQ(75, 75, 0, 255, 0, 255); EXPECT_PIXEL_EQ(75, 75, 0, 255, 0, 255);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
glDeleteFramebuffers(1u, &framebuffer);
glDeleteRenderbuffers(1u, &renderBuffer);
EXPECT_GL_NO_ERROR();
} }
TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithMSAA) TEST_P(EGLSurfaceTestD3D11, CreateSurfaceWithMSAA)
......
...@@ -111,7 +111,7 @@ class EGLSurfacelessContextTest : public ANGLETest ...@@ -111,7 +111,7 @@ class EGLSurfacelessContextTest : public ANGLETest
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 500, 500, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 500, 500, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex->get(), 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex->get(), 0);
EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
} }
bool checkExtension(bool verbose = true) const bool checkExtension(bool verbose = true) const
...@@ -197,7 +197,7 @@ TEST_P(EGLSurfacelessContextTest, CheckFramebufferStatus) ...@@ -197,7 +197,7 @@ TEST_P(EGLSurfacelessContextTest, CheckFramebufferStatus)
GLTexture tex; GLTexture tex;
createFramebuffer(&fbo, &tex); createFramebuffer(&fbo, &tex);
glBindFramebuffer(GL_FRAMEBUFFER, fbo.get()); glBindFramebuffer(GL_FRAMEBUFFER, fbo.get());
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER)); ASSERT_GL_FRAMEBUFFER_COMPLETE(GL_FRAMEBUFFER);
} }
// Test that clearing and readpixels work when done in an FBO. // Test that clearing and readpixels work when done in an FBO.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment