Commit bb0775da by Olli Etuaho Committed by Commit Bot

Add flag for turning off initializing variables with loops

This flag is needed to toggle upcoming variable initialization mode which uses for loops to optimize the compilation process. Initializing variables using for loops will be turned on by default, but it needs to be turned off in Chromium in certain cases. Chromium will use the flag added in this patch and that code will need to go into Chromium before finishing the implementation in ANGLE. BUG=chromium:735497 Change-Id: I3a0e7b7c6cebe60afa72964fbd0caf3b1eafccbc Reviewed-on: https://chromium-review.googlesource.com/763451 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 48590358
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// Version number for shader translation API. // Version number for shader translation API.
// It is incremented every time the API changes. // It is incremented every time the API changes.
#define ANGLE_SH_VERSION 187 #define ANGLE_SH_VERSION 188
enum ShShaderSpec enum ShShaderSpec
{ {
...@@ -253,6 +253,10 @@ const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35; ...@@ -253,6 +253,10 @@ const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35;
// driver version 387.92. It works around the most common occurrences of the bug. // driver version 387.92. It works around the most common occurrences of the bug.
const ShCompileOptions SH_REWRITE_VECTOR_SCALAR_ARITHMETIC = UINT64_C(1) << 36; const ShCompileOptions SH_REWRITE_VECTOR_SCALAR_ARITHMETIC = UINT64_C(1) << 36;
// Don't use loops to initialize uninitialized variables. Only has an effect if some kind of
// variable initialization is turned on.
const ShCompileOptions SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES = UINT64_C(1) << 37;
// Defines alternate strategies for implementing array index clamping. // Defines alternate strategies for implementing array index clamping.
enum ShArrayIndexClampingStrategy enum ShArrayIndexClampingStrategy
{ {
......
...@@ -122,6 +122,11 @@ ShCompileOptions ShaderGL::prepareSourceAndReturnOptions(std::stringstream *sour ...@@ -122,6 +122,11 @@ ShCompileOptions ShaderGL::prepareSourceAndReturnOptions(std::stringstream *sour
options |= SH_REWRITE_VECTOR_SCALAR_ARITHMETIC; options |= SH_REWRITE_VECTOR_SCALAR_ARITHMETIC;
} }
if (mWorkarounds.dontUseLoopsToInitializeVariables)
{
options |= SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES;
}
if (mMultiviewImplementationType == MultiviewImplementationTypeGL::NV_VIEWPORT_ARRAY2) if (mMultiviewImplementationType == MultiviewImplementationTypeGL::NV_VIEWPORT_ARRAY2)
{ {
options |= SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW; options |= SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW;
......
...@@ -138,6 +138,9 @@ struct WorkaroundsGL ...@@ -138,6 +138,9 @@ struct WorkaroundsGL
// executed incorrectly. Change them in the shader translator. Tracking bug: // executed incorrectly. Change them in the shader translator. Tracking bug:
// http://crbug.com/772651 // http://crbug.com/772651
bool rewriteVectorScalarArithmetic = false; bool rewriteVectorScalarArithmetic = false;
// On some Android devices for loops used to initialize variables hit native GLSL compiler bugs.
bool dontUseLoopsToInitializeVariables = false;
}; };
} // namespace rx } // namespace rx
......
...@@ -1114,6 +1114,8 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround ...@@ -1114,6 +1114,8 @@ void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workaround
workarounds->reapplyUBOBindingsAfterUsingBinaryProgram = true; workarounds->reapplyUBOBindingsAfterUsingBinaryProgram = true;
workarounds->clampPointSize = true; workarounds->clampPointSize = true;
workarounds->dontUseLoopsToInitializeVariables = !IsNvidia(vendor);
#endif #endif
} }
......
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