Commit 3f4b87b4 by Corentin Wallez Committed by Commit Bot

Expand the EGLIOSurfaceClientBufferTests

This expands the test to check for validation errors and that multiple formats of IOSurfaces can be read from / rendered to. It fixes a couple issues in the implementation of the extension too. Minor fixes in the EGL_ANGLE_iosurface_client_buffer extension text. Fix a fragile test that was not setting the texture unit a shader is to sample from. BUG=angleproject:1649 Change-Id: Ied2a9bfff95cb3a9a7a59008260899eb2fc55575 Reviewed-on: https://chromium-review.googlesource.com/924477Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 029e8ca7
......@@ -71,14 +71,15 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
Append to the end of Section 3.5.3.
"When <buftype> is EGL_IOSURFACE_ANGLE, <attrib_list> must contain all the
following attributes under the following constraints otherwise
EGL_BAD_PARAMETER is generated:
following attributes otherwise EGL_BAD_PARAMETER is generated. The
attributes must satisfy the following constraints otherwise
EGL_BAD_ATTRIBUTE is generated:
- EGL_TEXTURE_TYPE_ANGLE, and EGL_TEXTURE_INTERNAL_FORMAT_ANGLE followed
by OpenGL enums for texture types, and texture internal format
respectively.
- EGL_TEXTURE_FORMAT with a value of EGL_TEXTURE_RGBA
- EGL_WIDTH with a value between 1 and the width of <buffer>.
- EGL_HEIGHT with a value between 1 and the width of <buffer>.
- EGL_HEIGHT with a value between 1 and the height of <buffer>.
- EGL_TEXTURE_TARGET with a value of EGL_TEXTURE_RECTANGLE_ANGLE
- EGL_IOSURFACE_PLANE_ANGLE with a value between 0 and the number of
planes of <buffer> (exclusive).
......@@ -93,7 +94,7 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
Texture Type Texture Internal Format
---------------------------------------------------------------------------
GL_UNSIGNED_BYTE GL_RED
GL_UNSIGNED_SHORT GL_RED_INTEGER
GL_UNSIGNED_SHORT GL_R16UI
GL_UNSIGNED_BYTE GL_RG
GL_UNSIGNED_BYTE GL_BGRA_EXT
GL_HALF_FLOAT GL_RGBA
......
......@@ -42,7 +42,7 @@ struct IOSurfaceFormatInfo
// clang-format off
static const IOSurfaceFormatInfo kIOSurfaceFormats[] = {
{GL_RED, GL_UNSIGNED_BYTE, 1, GL_RED, GL_RED, GL_UNSIGNED_BYTE },
{GL_R8UI, GL_UNSIGNED_SHORT, 2, GL_RED, GL_RED, GL_UNSIGNED_SHORT },
{GL_R16UI, GL_UNSIGNED_SHORT, 2, GL_RED, GL_RED, GL_UNSIGNED_SHORT },
{GL_RG, GL_UNSIGNED_BYTE, 2, GL_RG, GL_RG, GL_UNSIGNED_BYTE },
{GL_BGRA_EXT, GL_UNSIGNED_BYTE, 4, GL_BGRA, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV},
{GL_RGBA, GL_HALF_FLOAT, 8, GL_RGBA, GL_RGBA, GL_HALF_FLOAT },
......@@ -211,7 +211,7 @@ bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer,
EGLAttrib width = attribs.get(EGL_WIDTH);
EGLAttrib height = attribs.get(EGL_HEIGHT);
if (width <= 0 || static_cast<size_t>(width) > IOSurfaceGetWidthOfPlane(ioSurface, plane) ||
height < 0 || static_cast<size_t>(height) > IOSurfaceGetHeightOfPlane(ioSurface, plane))
height <= 0 || static_cast<size_t>(height) > IOSurfaceGetHeightOfPlane(ioSurface, plane))
{
return false;
}
......
......@@ -1200,8 +1200,8 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
(textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE))
{
// TODO(cwallez@chromium.org): For IOSurface pbuffers we require that EGL_TEXTURE_RGBA is
// set so that eglBinTexImage works. Normally this is only allowed if the config exposes the
// bindToTextureRGB/RGBA flag. This issue is that enabling this flags means that
// set so that eglBindTexImage works. Normally this is only allowed if the config exposes
// the bindToTextureRGB/RGBA flag. This issue is that enabling this flags means that
// eglBindTexImage should also work for regular pbuffers which isn't implemented on macOS.
// Instead of adding the flag we special case the check here to be ignored for IOSurfaces.
// The TODO is to find a proper solution for this, maybe by implementing eglBindTexImage on
......
......@@ -308,6 +308,11 @@ TEST_P(TextureRectangleTest, SamplingFromRectangle)
"}\n";
ANGLE_GL_PROGRAM(program, vs, fs);
glUseProgram(program);
GLint location = glGetUniformLocation(program, "tex");
ASSERT_NE(-1, location);
glUniform1i(location, 0);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
......
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