Implicitly enable PLS dependency extensions

The ANGLE_shader_pixel_local_storage implementation makes internal use
of various other extensions. These extensions must be implicitly enabled
when ANGLE_shader_pixel_local_storage is in use. In this CL:

* Convert ANGLE_shader_pixel_local_storage and
  ANGLE_shader_pixel_local_storage_coherent to requestable extensions.

* Implicitly enable the dependency extensions, including each other, at
  the time either of these extensions is enabled.

Bug: angleproject:7279
Bug: chromium:1421437
Change-Id: I26acbda776fe7045ea99d4f1e3df445e7a5cfd7f
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4306526
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Chris Dalton <chris@rive.app>
This commit is contained in:
Chris Dalton
2023-03-03 01:57:43 -07:00
committed by Angle LUCI CQ
parent 84fec4c72e
commit f2e13539b5
11 changed files with 324 additions and 81 deletions

View File

@@ -50,7 +50,9 @@ Dependencies
This extension is written against the OpenGL ES 3.0 specification and the This extension is written against the OpenGL ES 3.0 specification and the
OpenGL ES Shading Language 3.00 specification. OpenGL ES Shading Language 3.00 specification.
This extension interacts with GL_OES_sample_variables. This extension interacts with ANGLE_request_extension.
This extension interacts with OES_sample_variables.
This extension interacts with OpenGL ES 3.1. This extension interacts with OpenGL ES 3.1.
@@ -836,6 +838,20 @@ Additions to the OpenGL ES Specification, Version 3.0.6
Table 6.Y: Pixel Local Storage State Table 6.Y: Pixel Local Storage State
Interactions with the ANGLE_request_extension specification
When either ANGLE_shader_pixel_local_storage or
ANGLE_shader_pixel_local_storage_coherent is enabled, the following
extensions are all implicitly enabled, if supported:
* OES_draw_buffers_indexed
* EXT_draw_buffers_indexed
* EXT_color_buffer_float
* EXT_color_buffer_half_float
* ANGLE_shader_pixel_local_storage_coherent
* ANGLE_shader_pixel_local_storage
Interactions with OpenGL ES 3.1 Interactions with OpenGL ES 3.1
Modify Section 8.22 "Texture Image Loads and Stores" Modify Section 8.22 "Texture Image Loads and Stores"

View File

@@ -22,11 +22,11 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"src/libANGLE/gen_extensions.py": "src/libANGLE/gen_extensions.py":
"6ea1cb1733c4df98b527bbf2752e118b", "6ea1cb1733c4df98b527bbf2752e118b",
"src/libANGLE/gles_extensions_autogen.cpp": "src/libANGLE/gles_extensions_autogen.cpp":
"559434294d5b5dfc3f99c3d071fedccd", "533966f41f2f2fee23fe76ffdc2f00e5",
"src/libANGLE/gles_extensions_autogen.h": "src/libANGLE/gles_extensions_autogen.h":
"e0b24986c8d346e8b1f94d6259f51d87", "e0b24986c8d346e8b1f94d6259f51d87",
"third_party/EGL-Registry/src/api/egl.xml": "third_party/EGL-Registry/src/api/egl.xml":

View File

@@ -6,7 +6,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"src/libEGL/egl_loader_autogen.cpp": "src/libEGL/egl_loader_autogen.cpp":
"8a743c210f7dbe7e306849203dff7889", "8a743c210f7dbe7e306849203dff7889",
"src/libEGL/egl_loader_autogen.h": "src/libEGL/egl_loader_autogen.h":

View File

@@ -10,7 +10,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"src/common/entry_points_enum_autogen.cpp": "src/common/entry_points_enum_autogen.cpp":
"a60e991004c77e81390a1f75b0471a92", "a60e991004c77e81390a1f75b0471a92",
"src/common/entry_points_enum_autogen.h": "src/common/entry_points_enum_autogen.h":

View File

@@ -4,7 +4,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"src/common/gl_enum_utils_autogen.cpp": "src/common/gl_enum_utils_autogen.cpp":
"2791550a6939fe3a1fee174236521b98", "2791550a6939fe3a1fee174236521b98",
"src/common/gl_enum_utils_autogen.h": "src/common/gl_enum_utils_autogen.h":

View File

@@ -6,7 +6,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"third_party/EGL-Registry/src/api/egl.xml": "third_party/EGL-Registry/src/api/egl.xml":
"2056d54ea07156f1988ca1366bdee21a", "2056d54ea07156f1988ca1366bdee21a",
"third_party/OpenCL-Docs/src/xml/cl.xml": "third_party/OpenCL-Docs/src/xml/cl.xml":

View File

@@ -6,7 +6,7 @@
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
"70e689b84f9aab978bfa12e661007d5a", "70e689b84f9aab978bfa12e661007d5a",
"scripts/registry_xml.py": "scripts/registry_xml.py":
"606445c6b5076e875e1101bcc44d62c6", "8dc1bcf2e8324094c19c41613897b212",
"src/libGLESv2/proc_table_cl_autogen.cpp": "src/libGLESv2/proc_table_cl_autogen.cpp":
"ed003b0f041aaaa35b67d3fe07e61f91", "ed003b0f041aaaa35b67d3fe07e61f91",
"src/libGLESv2/proc_table_egl_autogen.cpp": "src/libGLESv2/proc_table_egl_autogen.cpp":

View File

@@ -64,6 +64,8 @@ angle_requestable_extensions = [
"GL_ANGLE_read_only_depth_stencil_feedback_loops", "GL_ANGLE_read_only_depth_stencil_feedback_loops",
"GL_ANGLE_robust_fragment_shader_output", "GL_ANGLE_robust_fragment_shader_output",
"GL_ANGLE_semaphore_fuchsia", "GL_ANGLE_semaphore_fuchsia",
"GL_ANGLE_shader_pixel_local_storage",
"GL_ANGLE_shader_pixel_local_storage_coherent",
"GL_ANGLE_stencil_texturing", "GL_ANGLE_stencil_texturing",
"GL_ANGLE_texture_compression_dxt3", "GL_ANGLE_texture_compression_dxt3",
"GL_ANGLE_texture_compression_dxt5", "GL_ANGLE_texture_compression_dxt5",
@@ -234,8 +236,6 @@ angle_es_only_extensions = [
"GL_ANGLE_robust_client_memory", "GL_ANGLE_robust_client_memory",
"GL_ANGLE_robust_resource_initialization", "GL_ANGLE_robust_resource_initialization",
"GL_ANGLE_shader_binary", "GL_ANGLE_shader_binary",
"GL_ANGLE_shader_pixel_local_storage",
"GL_ANGLE_shader_pixel_local_storage_coherent",
"GL_ANGLE_webgl_compatibility", "GL_ANGLE_webgl_compatibility",
"GL_CHROMIUM_bind_generates_resource", "GL_CHROMIUM_bind_generates_resource",
"GL_CHROMIUM_bind_uniform_location", "GL_CHROMIUM_bind_uniform_location",

View File

@@ -3549,11 +3549,6 @@ void Context::disableExtension(const char *name)
void Context::setExtensionEnabled(const char *name, bool enabled) void Context::setExtensionEnabled(const char *name, bool enabled)
{ {
// OVR_multiview is implicitly enabled when OVR_multiview2 is enabled
if (strcmp(name, "GL_OVR_multiview2") == 0)
{
setExtensionEnabled("GL_OVR_multiview", enabled);
}
const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap(); const ExtensionInfoMap &extensionInfos = GetExtensionInfoMap();
ASSERT(extensionInfos.find(name) != extensionInfos.end()); ASSERT(extensionInfos.find(name) != extensionInfos.end());
const auto &extension = extensionInfos.at(name); const auto &extension = extensionInfos.at(name);
@@ -3568,6 +3563,37 @@ void Context::setExtensionEnabled(const char *name, bool enabled)
mState.mExtensions.*(extension.ExtensionsMember) = enabled; mState.mExtensions.*(extension.ExtensionsMember) = enabled;
if (enabled)
{
if (strcmp(name, "GL_OVR_multiview2") == 0)
{
// OVR_multiview is implicitly enabled when OVR_multiview2 is enabled
requestExtension("GL_OVR_multiview");
}
else if (strcmp(name, "GL_ANGLE_shader_pixel_local_storage") == 0 ||
strcmp(name, "GL_ANGLE_shader_pixel_local_storage_coherent") == 0)
{
// ANGLE_shader_pixel_local_storage/ANGLE_shader_pixel_local_storage_coherent have
// various dependency extensions, including each other.
const auto enableIfRequestable = [this](const char *extensionName) {
for (const char *requestableExtension : mRequestableExtensionStrings)
{
if (strcmp(extensionName, requestableExtension) == 0)
{
requestExtension(extensionName);
return;
}
}
};
enableIfRequestable("GL_OES_draw_buffers_indexed");
enableIfRequestable("GL_EXT_draw_buffers_indexed");
enableIfRequestable("GL_EXT_color_buffer_float");
enableIfRequestable("GL_EXT_color_buffer_half_float");
enableIfRequestable("GL_ANGLE_shader_pixel_local_storage_coherent");
enableIfRequestable("GL_ANGLE_shader_pixel_local_storage");
}
}
reinitializeAfterExtensionsChanged(); reinitializeAfterExtensionsChanged();
} }

View File

@@ -247,8 +247,8 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_ANGLE_robust_resource_initialization"] = esOnlyExtension(&Extensions::robustResourceInitializationANGLE); map["GL_ANGLE_robust_resource_initialization"] = esOnlyExtension(&Extensions::robustResourceInitializationANGLE);
map["GL_ANGLE_semaphore_fuchsia"] = enableableExtension(&Extensions::semaphoreFuchsiaANGLE); map["GL_ANGLE_semaphore_fuchsia"] = enableableExtension(&Extensions::semaphoreFuchsiaANGLE);
map["GL_ANGLE_shader_binary"] = esOnlyExtension(&Extensions::shaderBinaryANGLE); map["GL_ANGLE_shader_binary"] = esOnlyExtension(&Extensions::shaderBinaryANGLE);
map["GL_ANGLE_shader_pixel_local_storage"] = esOnlyExtension(&Extensions::shaderPixelLocalStorageANGLE); map["GL_ANGLE_shader_pixel_local_storage"] = enableableExtension(&Extensions::shaderPixelLocalStorageANGLE);
map["GL_ANGLE_shader_pixel_local_storage_coherent"] = esOnlyExtension(&Extensions::shaderPixelLocalStorageCoherentANGLE); map["GL_ANGLE_shader_pixel_local_storage_coherent"] = enableableExtension(&Extensions::shaderPixelLocalStorageCoherentANGLE);
map["GL_ANGLE_stencil_texturing"] = enableableExtension(&Extensions::stencilTexturingANGLE); map["GL_ANGLE_stencil_texturing"] = enableableExtension(&Extensions::stencilTexturingANGLE);
map["GL_CHROMIUM_sync_query"] = enableableExtension(&Extensions::syncQueryCHROMIUM); map["GL_CHROMIUM_sync_query"] = enableableExtension(&Extensions::syncQueryCHROMIUM);
map["GL_ANGLE_texture_compression_dxt3"] = enableableExtension(&Extensions::textureCompressionDxt3ANGLE); map["GL_ANGLE_texture_compression_dxt3"] = enableableExtension(&Extensions::textureCompressionDxt3ANGLE);

View File

@@ -354,6 +354,7 @@ class PixelLocalStorageTest : public ANGLETest<>
setConfigGreenBits(8); setConfigGreenBits(8);
setConfigBlueBits(8); setConfigBlueBits(8);
setConfigAlphaBits(8); setConfigAlphaBits(8);
setExtensionsEnabled(false);
} }
void testTearDown() override void testTearDown() override
@@ -368,7 +369,7 @@ class PixelLocalStorageTest : public ANGLETest<>
void testSetUp() override void testSetUp() override
{ {
if (IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")) if (EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"))
{ {
glGetIntegerv(GL_MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE, &MAX_PIXEL_LOCAL_STORAGE_PLANES); glGetIntegerv(GL_MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE, &MAX_PIXEL_LOCAL_STORAGE_PLANES);
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE, glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE,
@@ -467,7 +468,7 @@ class PixelLocalStorageTest : public ANGLETest<>
// Verify conformant implementation-dependent PLS limits. // Verify conformant implementation-dependent PLS limits.
TEST_P(PixelLocalStorageTest, ImplementationDependentLimits) TEST_P(PixelLocalStorageTest, ImplementationDependentLimits)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
// Table 6.X: Impementation Dependent Pixel Local Storage Limits. // Table 6.X: Impementation Dependent Pixel Local Storage Limits.
EXPECT_TRUE(MAX_PIXEL_LOCAL_STORAGE_PLANES >= 4); EXPECT_TRUE(MAX_PIXEL_LOCAL_STORAGE_PLANES >= 4);
@@ -488,7 +489,7 @@ TEST_P(PixelLocalStorageTest, ImplementationDependentLimits)
// Verify that rgba8, rgba8i, and rgba8ui pixel local storage behaves as specified. // Verify that rgba8, rgba8i, and rgba8ui pixel local storage behaves as specified.
TEST_P(PixelLocalStorageTest, RGBA8) TEST_P(PixelLocalStorageTest, RGBA8)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(binding=0, rgba8) uniform lowp pixelLocalANGLE plane1; layout(binding=0, rgba8) uniform lowp pixelLocalANGLE plane1;
@@ -541,7 +542,7 @@ TEST_P(PixelLocalStorageTest, RGBA8)
// Verify that r32f and r32ui pixel local storage behaves as specified. // Verify that r32f and r32ui pixel local storage behaves as specified.
TEST_P(PixelLocalStorageTest, R32) TEST_P(PixelLocalStorageTest, R32)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(r32f, binding=0) uniform highp pixelLocalANGLE plane1; layout(r32f, binding=0) uniform highp pixelLocalANGLE plane1;
@@ -630,7 +631,7 @@ TEST_P(PixelLocalStorageTest, R32)
// Check proper functioning of the clear value state. // Check proper functioning of the clear value state.
TEST_P(PixelLocalStorageTest, ClearValues_rgba8) TEST_P(PixelLocalStorageTest, ClearValues_rgba8)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex8f(GL_RGBA8, 1, 1); PLSTestTexture tex8f(GL_RGBA8, 1, 1);
PLSTestTexture tex8i(GL_RGBA8I, 1, 1); PLSTestTexture tex8i(GL_RGBA8I, 1, 1);
@@ -799,7 +800,7 @@ TEST_P(PixelLocalStorageTest, ClearValues_rgba8)
// Check clear values for r32f and r32ui PLS format. // Check clear values for r32f and r32ui PLS format.
TEST_P(PixelLocalStorageTest, ClearValues_r32) TEST_P(PixelLocalStorageTest, ClearValues_r32)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
GLFramebuffer fbo; GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -828,7 +829,7 @@ TEST_P(PixelLocalStorageTest, ClearValues_r32)
// GL_MAX_LOCAL_STORAGE_PLANES_ANGLE planes. // GL_MAX_LOCAL_STORAGE_PLANES_ANGLE planes.
TEST_P(PixelLocalStorageTest, LoadOps) TEST_P(PixelLocalStorageTest, LoadOps)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
std::stringstream fs; std::stringstream fs;
for (int i = 0; i < MAX_PIXEL_LOCAL_STORAGE_PLANES; ++i) for (int i = 0; i < MAX_PIXEL_LOCAL_STORAGE_PLANES; ++i)
@@ -974,7 +975,7 @@ constexpr static Box FRAG_REJECT_TEST_BOX(FULLSCREEN,
// Check that the stencil test prevents stores to PLS. // Check that the stencil test prevents stores to PLS.
TEST_P(PixelLocalStorageTest, FragmentReject_stencil) TEST_P(PixelLocalStorageTest, FragmentReject_stencil)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex(GL_RGBA8); PLSTestTexture tex(GL_RGBA8);
FragmentRejectTestFBO fbo(tex); FragmentRejectTestFBO fbo(tex);
@@ -1028,7 +1029,7 @@ TEST_P(PixelLocalStorageTest, FragmentReject_stencil)
// Check that the depth test prevents stores to PLS. // Check that the depth test prevents stores to PLS.
TEST_P(PixelLocalStorageTest, FragmentReject_depth) TEST_P(PixelLocalStorageTest, FragmentReject_depth)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex(GL_RGBA8); PLSTestTexture tex(GL_RGBA8);
FragmentRejectTestFBO fbo(tex); FragmentRejectTestFBO fbo(tex);
@@ -1070,7 +1071,7 @@ TEST_P(PixelLocalStorageTest, FragmentReject_depth)
// Check that restricting the viewport also restricts stores to PLS. // Check that restricting the viewport also restricts stores to PLS.
TEST_P(PixelLocalStorageTest, FragmentReject_viewport) TEST_P(PixelLocalStorageTest, FragmentReject_viewport)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex(GL_RGBA8); PLSTestTexture tex(GL_RGBA8);
FragmentRejectTestFBO fbo(tex); FragmentRejectTestFBO fbo(tex);
@@ -1101,7 +1102,7 @@ TEST_P(PixelLocalStorageTest, FragmentReject_viewport)
// random or leaked from other contexts when we forget to insert a barrier. // random or leaked from other contexts when we forget to insert a barrier.
TEST_P(PixelLocalStorageTest, ForgetBarrier) TEST_P(PixelLocalStorageTest, ForgetBarrier)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(binding=0, r32f) uniform highp pixelLocalANGLE framebuffer; layout(binding=0, r32f) uniform highp pixelLocalANGLE framebuffer;
@@ -1210,7 +1211,7 @@ TEST_P(PixelLocalStorageTest, ForgetBarrier)
// Check loading and storing from memoryless local storage planes. // Check loading and storing from memoryless local storage planes.
TEST_P(PixelLocalStorageTest, MemorylessStorage) TEST_P(PixelLocalStorageTest, MemorylessStorage)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
// Bind the texture, but don't call glTexStorage until after creating the memoryless plane. // Bind the texture, but don't call glTexStorage until after creating the memoryless plane.
GLTexture tex; GLTexture tex;
@@ -1281,7 +1282,7 @@ TEST_P(PixelLocalStorageTest, MemorylessStorage)
// //
TEST_P(PixelLocalStorageTest, MaxCombinedDrawBuffersAndPLSPlanes) TEST_P(PixelLocalStorageTest, MaxCombinedDrawBuffersAndPLSPlanes)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
for (int numDrawBuffers : {0, 1, MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES - 1}) for (int numDrawBuffers : {0, 1, MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES - 1})
{ {
@@ -1375,7 +1376,7 @@ TEST_P(PixelLocalStorageTest, MaxCombinedDrawBuffersAndPLSPlanes)
// Verifies that program caching works for programs that use pixel local storage. // Verifies that program caching works for programs that use pixel local storage.
TEST_P(PixelLocalStorageTest, ProgramCache) TEST_P(PixelLocalStorageTest, ProgramCache)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
GLFramebuffer fbo; GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -1442,7 +1443,7 @@ TEST_P(PixelLocalStorageTest, ProgramCache)
// Also check that a pixelLocalLoadANGLE() of an r32f texture returns (r, 0, 0, 1). // Also check that a pixelLocalLoadANGLE() of an r32f texture returns (r, 0, 0, 1).
TEST_P(PixelLocalStorageTest, LoadOnly) TEST_P(PixelLocalStorageTest, LoadOnly)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex(GL_RGBA8); PLSTestTexture tex(GL_RGBA8);
@@ -1580,7 +1581,7 @@ TEST_P(PixelLocalStorageTest, LoadOnly)
// Check that stores and loads in a single shader invocation are coherent. // Check that stores and loads in a single shader invocation are coherent.
TEST_P(PixelLocalStorageTest, LoadAfterStore) TEST_P(PixelLocalStorageTest, LoadAfterStore)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
// Run a fibonacci loop that stores and loads the same PLS multiple times. // Run a fibonacci loop that stores and loads the same PLS multiple times.
mProgram.compile(R"( mProgram.compile(R"(
@@ -1690,7 +1691,7 @@ TEST_P(PixelLocalStorageTest, LoadAfterStore)
// Check that PLS handles can be passed as function arguments. // Check that PLS handles can be passed as function arguments.
TEST_P(PixelLocalStorageTest, FunctionArguments) TEST_P(PixelLocalStorageTest, FunctionArguments)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(binding=0, rgba8) uniform lowp pixelLocalANGLE dst; layout(binding=0, rgba8) uniform lowp pixelLocalANGLE dst;
@@ -1755,7 +1756,7 @@ TEST_P(PixelLocalStorageTest, FunctionArguments)
// Check that if the "_coherent" extension is advertised, PLS operations are ordered and coherent. // Check that if the "_coherent" extension is advertised, PLS operations are ordered and coherent.
TEST_P(PixelLocalStorageTest, Coherency) TEST_P(PixelLocalStorageTest, Coherency)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(binding=0, rgba8ui) uniform lowp upixelLocalANGLE framebuffer; layout(binding=0, rgba8ui) uniform lowp upixelLocalANGLE framebuffer;
@@ -1863,7 +1864,7 @@ TEST_P(PixelLocalStorageTest, Coherency)
// Check that binding mipmap levels to PLS is supported. // Check that binding mipmap levels to PLS is supported.
TEST_P(PixelLocalStorageTest, MipMapLevels) TEST_P(PixelLocalStorageTest, MipMapLevels)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
mProgram.compile(R"( mProgram.compile(R"(
layout(binding=0, rgba8) uniform lowp pixelLocalANGLE pls; layout(binding=0, rgba8) uniform lowp pixelLocalANGLE pls;
@@ -1924,7 +1925,7 @@ TEST_P(PixelLocalStorageTest, MipMapLevels)
void PixelLocalStorageTest::doStateRestorationTest() void PixelLocalStorageTest::doStateRestorationTest()
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
// Setup state. // Setup state.
PLSTestTexture plsTex(GL_RGBA8UI, 32, 33); PLSTestTexture plsTex(GL_RGBA8UI, 32, 33);
@@ -2092,14 +2093,14 @@ void PixelLocalStorageTest::doStateRestorationTest()
// Check that application-facing ES3 state is not perturbed by pixel local storage. // Check that application-facing ES3 state is not perturbed by pixel local storage.
TEST_P(PixelLocalStorageTest, StateRestoration) TEST_P(PixelLocalStorageTest, StateRestoration)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
doStateRestorationTest(); doStateRestorationTest();
} }
void PixelLocalStorageTest::doDrawStateTest() void PixelLocalStorageTest::doDrawStateTest()
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_ONE); glBlendFunc(GL_ZERO, GL_ONE);
@@ -2176,7 +2177,7 @@ void PixelLocalStorageTest::doDrawStateTest()
// EXT_shader_pixel_local_storage, where they are implemented as fullscreen draws. // EXT_shader_pixel_local_storage, where they are implemented as fullscreen draws.
TEST_P(PixelLocalStorageTest, DrawStateReset) TEST_P(PixelLocalStorageTest, DrawStateReset)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
doDrawStateTest(); doDrawStateTest();
} }
@@ -2185,7 +2186,7 @@ TEST_P(PixelLocalStorageTest, DrawStateReset)
// affect blend or color mask on the application's draw buffers. // affect blend or color mask on the application's draw buffers.
TEST_P(PixelLocalStorageTest, BlendAndColorMask) TEST_P(PixelLocalStorageTest, BlendAndColorMask)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex1(GL_RGBA8); PLSTestTexture tex1(GL_RGBA8);
PLSTestTexture tex2(GL_RGBA8); PLSTestTexture tex2(GL_RGBA8);
@@ -2302,8 +2303,8 @@ TEST_P(PixelLocalStorageTest, BlendAndColorMask)
// Check that PLS and EXT_shader_framebuffer_fetch can be used together. // Check that PLS and EXT_shader_framebuffer_fetch can be used together.
TEST_P(PixelLocalStorageTest, ParallelFramebufferFetch) TEST_P(PixelLocalStorageTest, ParallelFramebufferFetch)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_shader_framebuffer_fetch")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_shader_framebuffer_fetch"));
ANGLE_SKIP_TEST_IF(MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE == 0); ANGLE_SKIP_TEST_IF(MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE == 0);
mProgram.compile("#extension GL_EXT_shader_framebuffer_fetch : require", R"( mProgram.compile("#extension GL_EXT_shader_framebuffer_fetch : require", R"(
@@ -2344,7 +2345,7 @@ TEST_P(PixelLocalStorageTest, ParallelFramebufferFetch)
// Check that PLS gets properly cleaned up when its framebuffer and textures are never deleted. // Check that PLS gets properly cleaned up when its framebuffer and textures are never deleted.
TEST_P(PixelLocalStorageTest, LeakFramebufferAndTexture) TEST_P(PixelLocalStorageTest, LeakFramebufferAndTexture)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
GLuint fbo; GLuint fbo;
glGenFramebuffers(1, &fbo); glGenFramebuffers(1, &fbo);
@@ -2372,7 +2373,7 @@ TEST_P(PixelLocalStorageTest, LeakFramebufferAndTexture)
// Check that sampler, texture, and PLS bindings all work when they are used in the same shader. // Check that sampler, texture, and PLS bindings all work when they are used in the same shader.
TEST_P(PixelLocalStorageTest, PLSWithSamplers) TEST_P(PixelLocalStorageTest, PLSWithSamplers)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
GLFramebuffer fbo; GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -2505,27 +2506,29 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PixelLocalStorageTest);
.enable(Feature::DisableDrawBuffersIndexed), \ .enable(Feature::DisableDrawBuffersIndexed), \
__VA_ARGS__) __VA_ARGS__)
#define PLS_INSTANTIATE_RENDERING_TEST(TEST, API) PLS_INSTANTIATE_RENDERING_TEST_AND(TEST, API) #define PLS_INSTANTIATE_RENDERING_TEST_ES3(TEST) \
PLS_INSTANTIATE_RENDERING_TEST_AND( \
TEST, ES3, /* Metal, coherent (in tiled memory on Apple Silicon).*/ \
ES3_METAL().enable(Feature::EmulatePixelLocalStorage), /* Metal, coherent via raster order \
groups + read_write textures.*/ \
ES3_METAL() \
.enable(Feature::EmulatePixelLocalStorage) \
.enable(Feature::DisableProgrammableBlending), /* Metal, coherent, r32 packed \
read_write texture formats.*/ \
ES3_METAL() \
.enable(Feature::EmulatePixelLocalStorage) \
.enable(Feature::DisableProgrammableBlending) \
.enable(Feature::DisableRWTextureTier2Support), /* Metal, noncoherent if not on Apple \
Silicon. (Apple GPUs don't support \
fragment-to-fragment memory \
barriers.)*/ \
ES3_METAL() \
.enable(Feature::EmulatePixelLocalStorage) \
.enable(Feature::DisableRasterOrderGroups))
PLS_INSTANTIATE_RENDERING_TEST_AND( #define PLS_INSTANTIATE_RENDERING_TEST_ES31(TEST) PLS_INSTANTIATE_RENDERING_TEST_AND(TEST, ES31)
PixelLocalStorageTest,
ES3, PLS_INSTANTIATE_RENDERING_TEST_ES3(PixelLocalStorageTest);
// Metal, coherent (in tiled memory on Apple Silicon).
ES3_METAL().enable(Feature::EmulatePixelLocalStorage),
// Metal, coherent via raster order groups + read_write textures.
ES3_METAL()
.enable(Feature::EmulatePixelLocalStorage)
.enable(Feature::DisableProgrammableBlending),
// Metal, coherent, r32 packed read_write texture formats.
ES3_METAL()
.enable(Feature::EmulatePixelLocalStorage)
.enable(Feature::DisableProgrammableBlending)
.enable(Feature::DisableRWTextureTier2Support),
// Metal, noncoherent if not on Apple Silicon.
// (Apple GPUs don't support fragment-to-fragment memory barriers.)
ES3_METAL()
.enable(Feature::EmulatePixelLocalStorage)
.enable(Feature::DisableRasterOrderGroups));
class PixelLocalStorageTestES31 : public PixelLocalStorageTest class PixelLocalStorageTestES31 : public PixelLocalStorageTest
{}; {};
@@ -2533,7 +2536,7 @@ class PixelLocalStorageTestES31 : public PixelLocalStorageTest
// Check that early_fragment_tests are not triggered when PLS uniforms are not declared. // Check that early_fragment_tests are not triggered when PLS uniforms are not declared.
TEST_P(PixelLocalStorageTestES31, EarlyFragmentTests) TEST_P(PixelLocalStorageTestES31, EarlyFragmentTests)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
PLSTestTexture tex(GL_RGBA8); PLSTestTexture tex(GL_RGBA8);
GLFramebuffer fbo; GLFramebuffer fbo;
@@ -2626,7 +2629,7 @@ TEST_P(PixelLocalStorageTestES31, EarlyFragmentTests)
// Check that application-facing ES31 state is not perturbed by pixel local storage. // Check that application-facing ES31 state is not perturbed by pixel local storage.
TEST_P(PixelLocalStorageTestES31, StateRestoration) TEST_P(PixelLocalStorageTestES31, StateRestoration)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
doStateRestorationTest(); doStateRestorationTest();
} }
@@ -2635,20 +2638,212 @@ TEST_P(PixelLocalStorageTestES31, StateRestoration)
// EXT_shader_pixel_local_storage, where they are implemented as fullscreen draws. // EXT_shader_pixel_local_storage, where they are implemented as fullscreen draws.
TEST_P(PixelLocalStorageTestES31, DrawStateReset) TEST_P(PixelLocalStorageTestES31, DrawStateReset)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
doDrawStateTest(); doDrawStateTest();
} }
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PixelLocalStorageTestES31); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(PixelLocalStorageTestES31);
PLS_INSTANTIATE_RENDERING_TEST(PixelLocalStorageTestES31, ES31); PLS_INSTANTIATE_RENDERING_TEST_ES31(PixelLocalStorageTestES31);
class PixelLocalStorageRequestableExtensionTest : public ANGLETest<>
{
protected:
PixelLocalStorageRequestableExtensionTest() { setExtensionsEnabled(false); }
};
static void do_implicitly_enabled_extensions_test(const char *plsExtensionToRequest)
{
bool hasDrawBuffersIndexedOES = IsGLExtensionRequestable("GL_OES_draw_buffers_indexed");
bool hasDrawBuffersIndexedEXT = IsGLExtensionRequestable("GL_EXT_draw_buffers_indexed");
bool hasColorBufferFloat = IsGLExtensionRequestable("GL_EXT_color_buffer_float");
bool hasColorBufferHalfFloat = IsGLExtensionRequestable("GL_EXT_color_buffer_half_float");
bool hasCoherent = IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage_coherent");
EXPECT_TRUE(!IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_draw_buffers_indexed"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_color_buffer_float"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_color_buffer_half_float"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
glRequestExtensionANGLE(plsExtensionToRequest);
EXPECT_GL_NO_ERROR();
if (hasDrawBuffersIndexedOES)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
}
if (hasDrawBuffersIndexedEXT)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_draw_buffers_indexed"));
}
if (hasColorBufferFloat)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_float"));
}
if (hasColorBufferHalfFloat)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_half_float"));
}
if (hasCoherent)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
}
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
if (hasDrawBuffersIndexedOES)
{
// If OES_draw_buffers_indexed ever becomes disablable, it will have to implicitly disable
// ANGLE_shader_pixel_local_storage.
glDisableExtensionANGLE("GL_OES_draw_buffers_indexed");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
}
if (hasDrawBuffersIndexedEXT)
{
// If EXT_draw_buffers_indexed ever becomes disablable, it will have to implicitly disable
// ANGLE_shader_pixel_local_storage.
glDisableExtensionANGLE("GL_EXT_draw_buffers_indexed");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_draw_buffers_indexed"));
}
if (hasColorBufferFloat)
{
// If EXT_color_buffer_float ever becomes disablable, it will have to implicitly disable
// ANGLE_shader_pixel_local_storage.
glDisableExtensionANGLE("GL_EXT_color_buffer_float");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_float"));
}
if (hasColorBufferHalfFloat)
{
// If EXT_color_buffer_half_float ever becomes disablable, it will have to implicitly
// disable ANGLE_shader_pixel_local_storage.
glDisableExtensionANGLE("GL_EXT_color_buffer_half_float");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_half_float"));
}
if (hasCoherent)
{
// ANGLE_shader_pixel_local_storage_coherent is not disablable.
glDisableExtensionANGLE("GL_ANGLE_shader_pixel_local_storage_coherent");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
}
// ANGLE_shader_pixel_local_storage is not disablable.
glDisableExtensionANGLE("GL_ANGLE_shader_pixel_local_storage");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
// All dependency extensions should have remained enabled.
if (hasDrawBuffersIndexedOES)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
}
if (hasDrawBuffersIndexedEXT)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_draw_buffers_indexed"));
}
if (hasColorBufferFloat)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_float"));
}
if (hasColorBufferHalfFloat)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_EXT_color_buffer_half_float"));
}
if (hasCoherent)
{
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
}
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
}
// Check that ANGLE_shader_pixel_local_storage implicitly enables its dependency extensions.
TEST_P(PixelLocalStorageRequestableExtensionTest, ImplicitlyEnabledExtensions)
{
EXPECT_TRUE(IsEGLDisplayExtensionEnabled(getEGLWindow()->getDisplay(),
"EGL_ANGLE_create_context_extensions_enabled"));
ANGLE_SKIP_TEST_IF(!IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage"));
do_implicitly_enabled_extensions_test("GL_ANGLE_shader_pixel_local_storage");
}
// Check that ANGLE_shader_pixel_local_storage_coherent implicitly enables its
// dependency extensions.
TEST_P(PixelLocalStorageRequestableExtensionTest, ImplicitlyEnabledExtensionsCoherent)
{
EXPECT_TRUE(IsEGLDisplayExtensionEnabled(getEGLWindow()->getDisplay(),
"EGL_ANGLE_create_context_extensions_enabled"));
ANGLE_SKIP_TEST_IF(!IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage"));
if (!IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage_coherent"))
{
// Requesting GL_ANGLE_shader_pixel_local_storage_coherent should not implicitly enable any
// other extensions if the extension itself is not supported.
glRequestExtensionANGLE("GL_ANGLE_shader_pixel_local_storage_coherent");
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
EXPECT_TRUE(!IsGLExtensionEnabled("GL_OES_draw_buffers_indexed"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_draw_buffers_indexed"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_color_buffer_float"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_EXT_color_buffer_half_float"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
}
else
{
do_implicitly_enabled_extensions_test("GL_ANGLE_shader_pixel_local_storage_coherent");
}
}
// Check that the dependency extensions of ANGLE_shader_pixel_local_storage do not enable it.
TEST_P(PixelLocalStorageRequestableExtensionTest, ANGLEShaderPixelLocalStorageNotImplicitlyEnabled)
{
EXPECT_TRUE(IsEGLDisplayExtensionEnabled(getEGLWindow()->getDisplay(),
"EGL_ANGLE_create_context_extensions_enabled"));
ANGLE_SKIP_TEST_IF(!IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage"));
EnsureGLExtensionEnabled("GL_OES_draw_buffers_indexed");
EnsureGLExtensionEnabled("GL_EXT_draw_buffers_indexed");
EnsureGLExtensionEnabled("GL_EXT_color_buffer_float");
EnsureGLExtensionEnabled("GL_EXT_color_buffer_half_float");
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
EXPECT_TRUE(!IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
if (IsGLExtensionRequestable("GL_ANGLE_shader_pixel_local_storage_coherent"))
{
glRequestExtensionANGLE("GL_ANGLE_shader_pixel_local_storage_coherent");
EXPECT_GL_NO_ERROR();
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
}
else
{
glRequestExtensionANGLE("GL_ANGLE_shader_pixel_local_storage");
EXPECT_GL_NO_ERROR();
EXPECT_TRUE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
}
}
PLS_INSTANTIATE_RENDERING_TEST_ES3(PixelLocalStorageRequestableExtensionTest);
class PixelLocalStorageValidationTest : public ANGLETest<> class PixelLocalStorageValidationTest : public ANGLETest<>
{ {
public:
PixelLocalStorageValidationTest() { setExtensionsEnabled(false); }
protected: protected:
void testSetUp() override void testSetUp() override
{ {
ASSERT(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ASSERT(EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
glGetIntegerv(GL_MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE, &MAX_PIXEL_LOCAL_STORAGE_PLANES); glGetIntegerv(GL_MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE, &MAX_PIXEL_LOCAL_STORAGE_PLANES);
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE, glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE,
&MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE); &MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE);
@@ -3926,25 +4121,25 @@ TEST_P(PixelLocalStorageValidationTest, BannedCommands)
{ {
EXPECT_BANNED_CAP(GL_SAMPLE_MASK); EXPECT_BANNED_CAP(GL_SAMPLE_MASK);
} }
if (IsGLExtensionEnabled("GL_EXT_multisample_compatibility")) if (EnsureGLExtensionEnabled("GL_EXT_multisample_compatibility"))
{ {
EXPECT_BANNED_CAP(GL_MULTISAMPLE_EXT); EXPECT_BANNED_CAP(GL_MULTISAMPLE_EXT);
EXPECT_BANNED_CAP(GL_SAMPLE_ALPHA_TO_ONE_EXT); EXPECT_BANNED_CAP(GL_SAMPLE_ALPHA_TO_ONE_EXT);
} }
if (IsGLExtensionEnabled("GL_KHR_debug")) if (EnsureGLExtensionEnabled("GL_KHR_debug"))
{ {
EXPECT_BANNED_CAP(GL_DEBUG_OUTPUT_SYNCHRONOUS); EXPECT_BANNED_CAP(GL_DEBUG_OUTPUT_SYNCHRONOUS);
EXPECT_BANNED_CAP(GL_DEBUG_OUTPUT); EXPECT_BANNED_CAP(GL_DEBUG_OUTPUT);
} }
if (IsGLExtensionEnabled("GL_OES_sample_shading")) if (EnsureGLExtensionEnabled("GL_OES_sample_shading"))
{ {
EXPECT_BANNED_CAP(GL_SAMPLE_SHADING); EXPECT_BANNED_CAP(GL_SAMPLE_SHADING);
} }
if (IsGLExtensionEnabled("GL_QCOM_shading_rate")) if (EnsureGLExtensionEnabled("GL_QCOM_shading_rate"))
{ {
EXPECT_BANNED_CAP(GL_SHADING_RATE_PRESERVE_ASPECT_RATIO_QCOM); EXPECT_BANNED_CAP(GL_SHADING_RATE_PRESERVE_ASPECT_RATIO_QCOM);
} }
if (IsGLExtensionEnabled("GL_ANGLE_logic_op")) if (EnsureGLExtensionEnabled("GL_ANGLE_logic_op"))
{ {
EXPECT_BANNED_CAP(GL_COLOR_LOGIC_OP); EXPECT_BANNED_CAP(GL_COLOR_LOGIC_OP);
} }
@@ -3995,7 +4190,7 @@ TEST_P(PixelLocalStorageValidationTest, BannedCommands)
glClearBufferiv(GL_STENCIL, 0, cleari); glClearBufferiv(GL_STENCIL, 0, cleari);
EXPECT_GL_NO_ERROR(); EXPECT_GL_NO_ERROR();
if (IsGLExtensionEnabled("GL_OES_draw_buffers_indexed")) if (EnsureGLExtensionEnabled("GL_OES_draw_buffers_indexed"))
{ {
// INVALID_OPERATION is generated by Enablei*(), Disablei*() if and any // INVALID_OPERATION is generated by Enablei*(), Disablei*() if and any
// of the following are true: // of the following are true:
@@ -4183,10 +4378,13 @@ ANGLE_INSTANTIATE_TEST(PixelLocalStorageValidationTest,
class PixelLocalStorageCompilerTest : public ANGLETest<> class PixelLocalStorageCompilerTest : public ANGLETest<>
{ {
public:
PixelLocalStorageCompilerTest() { setExtensionsEnabled(false); }
protected: protected:
void testSetUp() override void testSetUp() override
{ {
ASSERT(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); ASSERT(EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
// INVALID_OPERATION is generated if DITHER is enabled. // INVALID_OPERATION is generated if DITHER is enabled.
glDisable(GL_DITHER); glDisable(GL_DITHER);
@@ -4787,7 +4985,7 @@ TEST_P(PixelLocalStorageCompilerTest, FragmentTestVariables)
})"; })";
EXPECT_TRUE(log.compileFragmentShader(kReadFragDepth)); EXPECT_TRUE(log.compileFragmentShader(kReadFragDepth));
if (IsGLExtensionEnabled("GL_OES_sample_variables")) if (EnsureGLExtensionEnabled("GL_OES_sample_variables"))
{ {
// gl_SampleMask is not assignable when pixel local storage has been declared. The shader // gl_SampleMask is not assignable when pixel local storage has been declared. The shader
// image polyfill requires early_fragment_tests, which causes gl_SampleMask to be ignored. // image polyfill requires early_fragment_tests, which causes gl_SampleMask to be ignored.
@@ -4915,7 +5113,10 @@ ANGLE_INSTANTIATE_TEST(PixelLocalStorageCompilerTest,
.enable(Feature::DisableDrawBuffersIndexed)); .enable(Feature::DisableDrawBuffersIndexed));
class PixelLocalStorageTestPreES3 : public ANGLETest<> class PixelLocalStorageTestPreES3 : public ANGLETest<>
{}; {
public:
PixelLocalStorageTestPreES3() { setExtensionsEnabled(false); }
};
// Check that GL_ANGLE_shader_pixel_local_storage is not advertised before ES 3.1. // Check that GL_ANGLE_shader_pixel_local_storage is not advertised before ES 3.1.
// //
@@ -4923,8 +5124,8 @@ class PixelLocalStorageTestPreES3 : public ANGLETest<>
// are inside ANGLE. // are inside ANGLE.
TEST_P(PixelLocalStorageTestPreES3, UnsupportedClientVersion) TEST_P(PixelLocalStorageTestPreES3, UnsupportedClientVersion)
{ {
EXPECT_FALSE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage")); EXPECT_FALSE(EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage"));
EXPECT_FALSE(IsGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent")); EXPECT_FALSE(EnsureGLExtensionEnabled("GL_ANGLE_shader_pixel_local_storage_coherent"));
ShaderInfoLog log; ShaderInfoLog log;