Commit b1deba2f by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Don't emit spec const declaration in compute shaders

Bug: angleproject:5070 Change-Id: I74becfeac88b4a8ff66dd36670792082d0b941cd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2658882Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent a5ab7974
......@@ -185,7 +185,7 @@ bool TranslatorMetal::translate(TIntermBlock *root,
getNameMap(), &getSymbolTable(), getShaderType(),
getShaderVersion(), getOutputType(), false, true, compileOptions);
SpecConstMetal specConst(&getSymbolTable(), compileOptions);
SpecConstMetal specConst(&getSymbolTable(), compileOptions, getShaderType());
DriverUniformMetal driverUniforms;
if (!TranslatorVulkan::translateImpl(root, compileOptions, perfDiagnostics, &specConst,
&driverUniforms, &outputGLSL))
......
......@@ -27,8 +27,8 @@ namespace sh
class SpecConstMetal : public SpecConst
{
public:
SpecConstMetal(TSymbolTable *symbolTable, ShCompileOptions compileOptions)
: SpecConst(symbolTable, compileOptions)
SpecConstMetal(TSymbolTable *symbolTable, ShCompileOptions compileOptions, GLenum shaderType)
: SpecConst(symbolTable, compileOptions, shaderType)
{}
~SpecConstMetal() override {}
......
......@@ -1222,7 +1222,7 @@ bool TranslatorVulkan::translate(TIntermBlock *root,
getShaderVersion(), getOutputType(), precisionEmulation,
enablePrecision, compileOptions);
SpecConst specConst(&getSymbolTable(), compileOptions);
SpecConst specConst(&getSymbolTable(), compileOptions, getShaderType());
if ((compileOptions & SH_USE_SPECIALIZATION_CONSTANT) != 0)
{
......
......@@ -223,9 +223,14 @@ TIntermTyped *CreateFloatArrayWithRotationIndex(const Vec2EnumMap &valuesEnumMap
}
} // anonymous namespace
SpecConst::SpecConst(TSymbolTable *symbolTable, ShCompileOptions compileOptions)
SpecConst::SpecConst(TSymbolTable *symbolTable, ShCompileOptions compileOptions, GLenum shaderType)
: mSymbolTable(symbolTable), mCompileOptions(compileOptions)
{
if (shaderType == GL_FRAGMENT_SHADER || shaderType == GL_COMPUTE_SHADER)
{
return;
}
// Mark SpecConstUsage::Rotation unconditionally. gl_Position is always rotated.
if ((mCompileOptions & SH_USE_SPECIALIZATION_CONSTANT) != 0 &&
(mCompileOptions & SH_ADD_PRE_ROTATION) != 0)
......
......@@ -23,7 +23,7 @@ namespace sh
class SpecConst
{
public:
SpecConst(TSymbolTable *symbolTable, ShCompileOptions compileOptions);
SpecConst(TSymbolTable *symbolTable, ShCompileOptions compileOptions, GLenum shaderType);
virtual ~SpecConst();
// Line rasterizaton emulation
......
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