Metal: Remove driver API workaround from compiler interface
Bug: angleproject:42266263
Change-Id: I5905c4c08566f7dfcb360d970cb0715bd4958c8b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/7486431
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
index fd5a6cc..cc43511 100644
--- a/include/GLSLANG/ShaderLang.h
+++ b/include/GLSLANG/ShaderLang.h
@@ -26,7 +26,7 @@
// Version number for shader translation API.
// It is incremented every time the API changes.
-#define ANGLE_SH_VERSION 395
+#define ANGLE_SH_VERSION 396
enum ShShaderSpec
{
@@ -147,11 +147,6 @@
// ShPixelLocalStorageType::ImageLoadStore only: Can we use rgba8/rgba8i/rgba8ui image formats?
// Or do we need to manually pack and unpack from r32i/r32ui?
bool supportsNativeRGBA8ImageFormats = false;
-
- // anglebug.com/42266263 -- Metal [[raster_order_group()]] does not work for read_write textures
- // on AMD when the render pass doesn't have a color attachment on slot 0. To work around this we
- // attach one of the PLS textures to GL_COLOR_ATTACHMENT0, if there isn't one already.
- bool renderPassNeedsAMDRasterOrderGroupsWorkaround = false;
};
struct ShCompileOptions
diff --git a/src/libANGLE/Caps.h b/src/libANGLE/Caps.h
index 590182c..af19f52 100644
--- a/src/libANGLE/Caps.h
+++ b/src/libANGLE/Caps.h
@@ -142,6 +142,11 @@
// TODO(http://anglebug.com/42263785): add validation code to front-end.
bool noShadowSamplerCompareModeNone = false;
+ // Metal [[raster_order_group()]] does not work for read_write textures on AMD when the render
+ // pass doesn't have a color attachment on slot 0.
+ // http://anglebug.com/42266263
+ bool noRasterOrderGroupWithoutAttachmentZero = false;
+
// PVRTC1 textures must be squares.
bool squarePvrtc1 = false;
diff --git a/src/libANGLE/PixelLocalStorage.cpp b/src/libANGLE/PixelLocalStorage.cpp
index 7578eb2..114dd0b 100644
--- a/src/libANGLE/PixelLocalStorage.cpp
+++ b/src/libANGLE/PixelLocalStorage.cpp
@@ -691,7 +691,7 @@
}
Framebuffer *framebuffer = state.getDrawFramebuffer();
- if (mPLSOptions.renderPassNeedsAMDRasterOrderGroupsWorkaround)
+ if (context->getLimitations().noRasterOrderGroupWithoutAttachmentZero)
{
// anglebug.com/42266263 -- Metal [[raster_order_group()]] does not work for read_write
// textures on AMD when the render pass doesn't have a color attachment on slot 0. To
@@ -838,7 +838,7 @@
}
mSavedImageBindings.clear();
- if (mPLSOptions.renderPassNeedsAMDRasterOrderGroupsWorkaround)
+ if (context->getLimitations().noRasterOrderGroupWithoutAttachmentZero)
{
if (!mHadColorAttachment0)
{
diff --git a/src/libANGLE/renderer/metal/DisplayMtl.mm b/src/libANGLE/renderer/metal/DisplayMtl.mm
index 122534d..41bc271 100644
--- a/src/libANGLE/renderer/metal/DisplayMtl.mm
+++ b/src/libANGLE/renderer/metal/DisplayMtl.mm
@@ -904,6 +904,21 @@
// Apple platforms require PVRTC1 textures to be squares.
mNativeLimitations.squarePvrtc1 = true;
+
+ if (mFeatures.disableProgrammableBlending.enabled || !supportsAppleGPUFamily(1))
+ {
+ const MTLReadWriteTextureTier readWriteTextureTier = [mMetalDevice readWriteTextureSupport];
+ if (readWriteTextureTier != MTLReadWriteTextureTierNone)
+ {
+ const bool rasterOrderGroupsSupported = !mFeatures.disableRasterOrderGroups.enabled &&
+ [mMetalDevice areRasterOrderGroupsSupported];
+
+ if (rasterOrderGroupsSupported && isAMD())
+ {
+ mNativeLimitations.noRasterOrderGroupWithoutAttachmentZero = true;
+ }
+ }
+ }
}
void DisplayMtl::initializeExtensions() const
@@ -1102,15 +1117,6 @@
!mFeatures.disableRWTextureTier2Support.enabled &&
readWriteTextureTier == MTLReadWriteTextureTier2;
- if (rasterOrderGroupsSupported && isAMD())
- {
- // anglebug.com/42266263 -- [[raster_order_group()]] does not work for read_write
- // textures on AMD when the render pass doesn't have a color attachment on slot 0.
- // To work around this we attach one of the PLS textures to GL_COLOR_ATTACHMENT0, if
- // there isn't one already.
- mNativePLSOptions.renderPassNeedsAMDRasterOrderGroupsWorkaround = true;
- }
-
mNativeExtensions.shaderPixelLocalStorageANGLE = true;
mNativeExtensions.shaderPixelLocalStorageCoherentANGLE = rasterOrderGroupsSupported;