Commit ebe13bb1 by Olli Etuaho Committed by Commit Bot

Remove SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM

Instanced multiview is fully implemented and performs much better than broadcasting draw calls on the CPU. There's no need to maintain translating ViewID_OVR to a uniform. BUG=angleproject:2267 TEST=angle_unittests Change-Id: If3a8fa573f37b7926c052aecfcd4271f266751dc Reviewed-on: https://chromium-review.googlesource.com/819417Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent e30edd6f
...@@ -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 191 #define ANGLE_SH_VERSION 192
enum ShShaderSpec enum ShShaderSpec
{ {
...@@ -214,13 +214,9 @@ const ShCompileOptions SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR = UINT64_C(1) << 29 ...@@ -214,13 +214,9 @@ const ShCompileOptions SH_REWRITE_FLOAT_UNARY_MINUS_OPERATOR = UINT64_C(1) << 29
// It works by using an expression to emulate this function. // It works by using an expression to emulate this function.
const ShCompileOptions SH_EMULATE_ATAN2_FLOAT_FUNCTION = UINT64_C(1) << 30; const ShCompileOptions SH_EMULATE_ATAN2_FLOAT_FUNCTION = UINT64_C(1) << 30;
// Set to 1 to translate gl_ViewID_OVR to an uniform so that the extension can be emulated.
// "uniform highp uint ViewID_OVR".
const ShCompileOptions SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM = UINT64_C(1) << 31;
// Set to initialize uninitialized local and global temporary variables. Should only be used with // Set to initialize uninitialized local and global temporary variables. Should only be used with
// GLSL output. In HLSL output variables are initialized regardless of if this flag is set. // GLSL output. In HLSL output variables are initialized regardless of if this flag is set.
const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 32; const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 31;
// The flag modifies the shader in the following way: // The flag modifies the shader in the following way:
// Every occurrence of gl_InstanceID is replaced by the global temporary variable InstanceID. // Every occurrence of gl_InstanceID is replaced by the global temporary variable InstanceID.
...@@ -229,7 +225,7 @@ const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 32; ...@@ -229,7 +225,7 @@ const ShCompileOptions SH_INITIALIZE_UNINITIALIZED_LOCALS = UINT64_C(1) << 32;
// ViewID_OVR = uint(gl_InstanceID) % num_views; // ViewID_OVR = uint(gl_InstanceID) % num_views;
// InstanceID = gl_InstanceID / num_views; // InstanceID = gl_InstanceID / num_views;
// ViewID_OVR is added as a varying variable to both the vertex and fragment shaders. // ViewID_OVR is added as a varying variable to both the vertex and fragment shaders.
const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C(1) << 33; const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C(1) << 32;
// With the flag enabled the GLSL/ESSL vertex shader is modified to include code for viewport // With the flag enabled the GLSL/ESSL vertex shader is modified to include code for viewport
// selection in the following way: // selection in the following way:
...@@ -239,11 +235,11 @@ const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C ...@@ -239,11 +235,11 @@ const ShCompileOptions SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW = UINT64_C
// - A declaration of the uniform multiviewBaseViewLayerIndex. // - A declaration of the uniform multiviewBaseViewLayerIndex.
// Note: The SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW flag also has to be enabled to have the // Note: The SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW flag also has to be enabled to have the
// temporary variable ViewID_OVR declared and initialized. // temporary variable ViewID_OVR declared and initialized.
const ShCompileOptions SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER = UINT64_C(1) << 34; const ShCompileOptions SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER = UINT64_C(1) << 33;
// If the flag is enabled, gl_PointSize is clamped to the maximum point size specified in // If the flag is enabled, gl_PointSize is clamped to the maximum point size specified in
// ShBuiltInResources in vertex shaders. // ShBuiltInResources in vertex shaders.
const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35; const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 34;
// Turn some arithmetic operations that operate on a float vector-scalar pair into vector-vector // Turn some arithmetic operations that operate on a float vector-scalar pair into vector-vector
// operations. This is done recursively. Some scalar binary operations inside vector constructors // operations. This is done recursively. Some scalar binary operations inside vector constructors
...@@ -251,11 +247,11 @@ const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35; ...@@ -251,11 +247,11 @@ const ShCompileOptions SH_CLAMP_POINT_SIZE = UINT64_C(1) << 35;
// //
// This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA // This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA
// 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) << 35;
// Don't use loops to initialize uninitialized variables. Only has an effect if some kind of // Don't use loops to initialize uninitialized variables. Only has an effect if some kind of
// variable initialization is turned on. // variable initialization is turned on.
const ShCompileOptions SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES = UINT64_C(1) << 37; const ShCompileOptions SH_DONT_USE_LOOPS_TO_INITIALIZE_VARIABLES = UINT64_C(1) << 36;
// Defines alternate strategies for implementing array index clamping. // Defines alternate strategies for implementing array index clamping.
enum ShArrayIndexClampingStrategy enum ShArrayIndexClampingStrategy
......
...@@ -1136,13 +1136,6 @@ TString TOutputGLSLBase::hashVariableName(const TName &name) ...@@ -1136,13 +1136,6 @@ TString TOutputGLSLBase::hashVariableName(const TName &name)
if (mSymbolTable->findBuiltIn(name.getString(), mShaderVersion) != nullptr || if (mSymbolTable->findBuiltIn(name.getString(), mShaderVersion) != nullptr ||
name.getString().substr(0, 3) == "gl_") name.getString().substr(0, 3) == "gl_")
{ {
if (mCompileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM &&
name.getString() == "gl_ViewID_OVR")
{
TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true);
return hashName(uniformName);
}
return name.getString(); return name.getString();
} }
return hashName(name); return hashName(name);
......
...@@ -104,13 +104,6 @@ void TranslatorESSL::translate(TIntermBlock *root, ...@@ -104,13 +104,6 @@ void TranslatorESSL::translate(TIntermBlock *root,
&getSymbolTable(), getShaderType(), shaderVer, precisionEmulation, &getSymbolTable(), getShaderType(), shaderVer, precisionEmulation,
compileOptions); compileOptions);
if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
{
TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true);
sink << "highp uniform int " << outputESSL.hashName(uniformName) << ";\n";
}
root->traverse(&outputESSL); root->traverse(&outputESSL);
} }
...@@ -125,9 +118,8 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions) ...@@ -125,9 +118,8 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions)
TInfoSinkBase &sink = getInfoSink().obj; TInfoSinkBase &sink = getInfoSink().obj;
const TExtensionBehavior &extBehavior = getExtensionBehavior(); const TExtensionBehavior &extBehavior = getExtensionBehavior();
const bool isMultiviewExtEmulated = const bool isMultiviewExtEmulated =
(compileOptions & (compileOptions & (SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW |
(SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM | SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW | SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER)) != 0u;
SH_SELECT_VIEW_IN_NV_GLSL_VERTEX_SHADER)) != 0u;
for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); iter != extBehavior.end(); for (TExtensionBehavior::const_iterator iter = extBehavior.begin(); iter != extBehavior.end();
++iter) ++iter)
{ {
......
...@@ -214,13 +214,6 @@ void TranslatorGLSL::translate(TIntermBlock *root, ...@@ -214,13 +214,6 @@ void TranslatorGLSL::translate(TIntermBlock *root,
&getSymbolTable(), getShaderType(), getShaderVersion(), getOutputType(), &getSymbolTable(), getShaderType(), getShaderVersion(), getOutputType(),
compileOptions); compileOptions);
if (compileOptions & SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM)
{
TName uniformName(TString("ViewID_OVR"));
uniformName.setInternal(true);
sink << "uniform int " << outputGLSL.hashName(uniformName) << ";\n";
}
root->traverse(&outputGLSL); root->traverse(&outputGLSL);
} }
......
...@@ -575,10 +575,6 @@ TEST_F(WEBGLMultiviewVertexShaderOutputCodeTest, StrippedOVRMultiviewDirective) ...@@ -575,10 +575,6 @@ TEST_F(WEBGLMultiviewVertexShaderOutputCodeTest, StrippedOVRMultiviewDirective)
EXPECT_FALSE(foundInESSLCode("GL_OVR_multiview")); EXPECT_FALSE(foundInESSLCode("GL_OVR_multiview"));
EXPECT_FALSE(foundInGLSLCode("GL_OVR_multiview")); EXPECT_FALSE(foundInGLSLCode("GL_OVR_multiview"));
compile(shaderString, SH_TRANSLATE_VIEWID_OVR_TO_UNIFORM);
EXPECT_FALSE(foundInESSLCode("GL_OVR_multiview"));
EXPECT_FALSE(foundInGLSLCode("GL_OVR_multiview"));
// The directive should be outputted from the ESSL translator with none of the options being // The directive should be outputted from the ESSL translator with none of the options being
// set. // set.
compile(shaderString); compile(shaderString);
......
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