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) ...@@ -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. Append to the end of Section 3.5.3.
"When <buftype> is EGL_IOSURFACE_ANGLE, <attrib_list> must contain all the "When <buftype> is EGL_IOSURFACE_ANGLE, <attrib_list> must contain all the
following attributes under the following constraints otherwise following attributes otherwise EGL_BAD_PARAMETER is generated. The
EGL_BAD_PARAMETER is generated: attributes must satisfy the following constraints otherwise
EGL_BAD_ATTRIBUTE is generated:
- EGL_TEXTURE_TYPE_ANGLE, and EGL_TEXTURE_INTERNAL_FORMAT_ANGLE followed - EGL_TEXTURE_TYPE_ANGLE, and EGL_TEXTURE_INTERNAL_FORMAT_ANGLE followed
by OpenGL enums for texture types, and texture internal format by OpenGL enums for texture types, and texture internal format
respectively. respectively.
- EGL_TEXTURE_FORMAT with a value of EGL_TEXTURE_RGBA - EGL_TEXTURE_FORMAT with a value of EGL_TEXTURE_RGBA
- EGL_WIDTH with a value between 1 and the width of <buffer>. - 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_TEXTURE_TARGET with a value of EGL_TEXTURE_RECTANGLE_ANGLE
- EGL_IOSURFACE_PLANE_ANGLE with a value between 0 and the number of - EGL_IOSURFACE_PLANE_ANGLE with a value between 0 and the number of
planes of <buffer> (exclusive). planes of <buffer> (exclusive).
...@@ -93,7 +94,7 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) ...@@ -93,7 +94,7 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
Texture Type Texture Internal Format Texture Type Texture Internal Format
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
GL_UNSIGNED_BYTE GL_RED 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_RG
GL_UNSIGNED_BYTE GL_BGRA_EXT GL_UNSIGNED_BYTE GL_BGRA_EXT
GL_HALF_FLOAT GL_RGBA GL_HALF_FLOAT GL_RGBA
......
...@@ -42,7 +42,7 @@ struct IOSurfaceFormatInfo ...@@ -42,7 +42,7 @@ struct IOSurfaceFormatInfo
// clang-format off // clang-format off
static const IOSurfaceFormatInfo kIOSurfaceFormats[] = { static const IOSurfaceFormatInfo kIOSurfaceFormats[] = {
{GL_RED, GL_UNSIGNED_BYTE, 1, GL_RED, GL_RED, GL_UNSIGNED_BYTE }, {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_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_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 }, {GL_RGBA, GL_HALF_FLOAT, 8, GL_RGBA, GL_RGBA, GL_HALF_FLOAT },
...@@ -211,7 +211,7 @@ bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer, ...@@ -211,7 +211,7 @@ bool IOSurfaceSurfaceCGL::validateAttributes(EGLClientBuffer buffer,
EGLAttrib width = attribs.get(EGL_WIDTH); EGLAttrib width = attribs.get(EGL_WIDTH);
EGLAttrib height = attribs.get(EGL_HEIGHT); EGLAttrib height = attribs.get(EGL_HEIGHT);
if (width <= 0 || static_cast<size_t>(width) > IOSurfaceGetWidthOfPlane(ioSurface, plane) || 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; return false;
} }
......
...@@ -1200,8 +1200,8 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E ...@@ -1200,8 +1200,8 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
(textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE)) (textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE))
{ {
// TODO(cwallez@chromium.org): For IOSurface pbuffers we require that EGL_TEXTURE_RGBA is // 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 // set so that eglBindTexImage works. Normally this is only allowed if the config exposes
// bindToTextureRGB/RGBA flag. This issue is that enabling this flags means that // 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. // 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. // 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 // The TODO is to find a proper solution for this, maybe by implementing eglBindTexImage on
......
...@@ -308,6 +308,11 @@ TEST_P(TextureRectangleTest, SamplingFromRectangle) ...@@ -308,6 +308,11 @@ TEST_P(TextureRectangleTest, SamplingFromRectangle)
"}\n"; "}\n";
ANGLE_GL_PROGRAM(program, vs, fs); 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); glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT); 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