From bce4b9f85777346d6c512bdb59c02a2b22c906a5 Mon Sep 17 00:00:00 2001 From: Geoff Lang Date: Wed, 19 Jun 2019 16:20:09 -0400 Subject: [PATCH] Always scalarize mat and vec constructor arguments. This workaround is always enabled in Chrome, do the same in ANGLE. BUG=882580 Change-Id: I2c01f34a589b07bd0035d7408be884f7a51b1706 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1666699 Reviewed-by: Jonah Ryan-Davis Commit-Queue: Geoff Lang --- include/platform/FrontendFeatures.h | 5 +++++ src/libANGLE/Display.cpp | 1 + src/libANGLE/Shader.cpp | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/include/platform/FrontendFeatures.h b/include/platform/FrontendFeatures.h index d9eec66bc..2c0ad3381 100644 --- a/include/platform/FrontendFeatures.h +++ b/include/platform/FrontendFeatures.h @@ -44,6 +44,11 @@ struct FrontendFeatures : angle::FeatureSetBase "On Windows Intel OpenGL drivers TexImage sometimes seems to interact " "with the Framebuffer", &members}; + + angle::Feature scalarizeVecAndMatConstructorArgs = { + "scalarize_vec_and_mat_constructor_args", angle::FeatureCategory::FrontendWorkarounds, + "Always rewrite vec/mat constructors to be consistent", &members, + "http://crbug.com/398694"}; }; inline FrontendFeatures::FrontendFeatures() = default; diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp index ccccc0740..fe7cbfd13 100644 --- a/src/libANGLE/Display.cpp +++ b/src/libANGLE/Display.cpp @@ -1350,6 +1350,7 @@ void Display::initializeFrontendFeatures() { // Enable on all Impls mFrontendFeatures.loseContextOnOutOfMemory.enabled = true; + mFrontendFeatures.scalarizeVecAndMatConstructorArgs.enabled = true; mImplementation->initializeFrontendFeatures(&mFrontendFeatures); diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp index b1007310d..29f9097bf 100644 --- a/src/libANGLE/Shader.cpp +++ b/src/libANGLE/Shader.cpp @@ -22,6 +22,7 @@ #include "libANGLE/ResourceManager.h" #include "libANGLE/renderer/GLImplFactory.h" #include "libANGLE/renderer/ShaderImpl.h" +#include "platform/FrontendFeatures.h" namespace gl { @@ -342,6 +343,11 @@ void Shader::compile(const Context *context) options |= SH_VALIDATE_LOOP_INDEXING; } + if (context->getFrontendFeatures().scalarizeVecAndMatConstructorArgs.enabled) + { + options |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; + } + mCurrentMaxComputeWorkGroupInvocations = context->getCaps().maxComputeWorkGroupInvocations; ASSERT(mBoundCompiler.get());