Commit bf6cc88a by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Remove duplicate shaderType parameter to SPIR-V transformer

The passed-in GlslangSpirvOptions already has the shaderType, so this extra parameter was not necessary. Bug: angleproject:4524 Change-Id: Ibbc7442b3173b26825f3cb9e2365789fade92cfc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611311Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent a8b962b7
......@@ -1457,14 +1457,12 @@ class SpirvTransformer final : public SpirvTransformerBase
{
public:
SpirvTransformer(const std::vector<uint32_t> &spirvBlobIn,
gl::ShaderType shaderType,
GlslangSpirvOptions options,
const ShaderInterfaceVariableInfoMap &variableInfoMap,
SpirvBlob *spirvBlobOut)
: SpirvTransformerBase(spirvBlobIn, variableInfoMap, spirvBlobOut),
mOptions(options),
mHasTransformFeedbackOutput(false),
mShaderType(shaderType),
mOutputPerVertex{},
mInputPerVertex{}
{}
......@@ -1510,8 +1508,6 @@ class SpirvTransformer final : public SpirvTransformerBase
GlslangSpirvOptions mOptions;
bool mHasTransformFeedbackOutput;
gl::ShaderType mShaderType;
// Traversal state:
bool mInsertFunctionVariables = false;
uint32_t mEntryPointId = 0;
......@@ -1823,7 +1819,7 @@ void SpirvTransformer::visitDecorate(const uint32_t *instruction)
const char *name = mNamesById[id];
ASSERT(name != nullptr);
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mShaderType, name);
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mOptions.shaderType, name);
mVariableInfoById[id] = &info;
}
}
......@@ -1871,12 +1867,12 @@ void SpirvTransformer::visitMemberName(const uint32_t *instruction)
return;
}
if (!mVariableInfoMap.contains(mShaderType, name))
if (!mVariableInfoMap.contains(mOptions.shaderType, name))
{
return;
}
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mShaderType, name);
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mOptions.shaderType, name);
// Assume output gl_PerVertex is encountered first. When the storage class of these types are
// determined, the variables can be swapped if this assumption was incorrect.
......@@ -2020,7 +2016,7 @@ void SpirvTransformer::visitVariable(const uint32_t *instruction)
}
// Every shader interface variable should have an associated data.
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mShaderType, name);
const ShaderInterfaceVariableInfo &info = mVariableInfoMap.get(mOptions.shaderType, name);
// Associate the id of this name with its info.
mVariableInfoById[id] = &info;
......@@ -3923,7 +3919,6 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options,
angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
const GlslangSpirvOptions &options,
gl::ShaderType shaderType,
const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob,
SpirvBlob *spirvBlobOut)
......@@ -3942,8 +3937,7 @@ angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
#endif // defined(ANGLE_DEBUG_SPIRV_TRANSFORMER) && ANGLE_DEBUG_SPIRV_TRANSFORMER
// Transform the SPIR-V code by assigning location/set/binding values.
SpirvTransformer transformer(initialSpirvBlob, shaderType, options, variableInfoMap,
spirvBlobOut);
SpirvTransformer transformer(initialSpirvBlob, options, variableInfoMap, spirvBlobOut);
ANGLE_GLSLANG_CHECK(callback, transformer.transform(), GlslangError::InvalidSpirv);
// If there are aliasing vertex attributes, transform the SPIR-V again to remove them.
......
......@@ -191,7 +191,6 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options,
angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
const GlslangSpirvOptions &options,
gl::ShaderType shaderType,
const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob,
SpirvBlob *spirvBlobOut);
......
......@@ -458,8 +458,7 @@ angle::Result GlslangGetShaderSpirvCode(ErrorHandler *context,
angle::Result status = GlslangTransformSpirvCode(
[context](GlslangError error) { return HandleError(context, error); }, options,
shaderType, variableInfoMap, initialSpirvBlobs[shaderType],
&(*shaderCodeOut)[shaderType]);
variableInfoMap, initialSpirvBlobs[shaderType], &(*shaderCodeOut)[shaderType]);
if (status != angle::Result::Continue)
{
return status;
......
......@@ -85,13 +85,12 @@ angle::Result GlslangWrapperVk::GetShaderCode(vk::Context *context,
angle::Result GlslangWrapperVk::TransformSpirV(
vk::Context *context,
const GlslangSpirvOptions &options,
gl::ShaderType shaderType,
const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob,
SpirvBlob *shaderCodeOut)
{
return GlslangTransformSpirvCode(
[context](GlslangError error) { return ErrorHandler(context, error); }, options, shaderType,
[context](GlslangError error) { return ErrorHandler(context, error); }, options,
variableInfoMap, initialSpirvBlob, shaderCodeOut);
}
......
......@@ -45,7 +45,6 @@ class GlslangWrapperVk
static angle::Result TransformSpirV(vk::Context *context,
const GlslangSpirvOptions &options,
gl::ShaderType shaderType,
const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob,
SpirvBlob *shaderCodeOut);
......
......@@ -36,7 +36,7 @@ bool ValidateTransformedSpirV(ContextVk *contextVk,
options.isTransformFeedbackStage = shaderType == gl::ShaderType::Vertex;
SpirvBlob transformed;
if (GlslangWrapperVk::TransformSpirV(contextVk, options, shaderType, variableInfoMap,
if (GlslangWrapperVk::TransformSpirV(contextVk, options, variableInfoMap,
spirvBlobs[shaderType],
&transformed) != angle::Result::Continue)
{
......@@ -133,7 +133,7 @@ angle::Result ProgramInfo::initProgram(ContextVk *contextVk,
options.removeDebugInfo = !contextVk->getRenderer()->getEnableValidationLayers();
options.isTransformFeedbackStage = shaderType == gl::ShaderType::Vertex;
ANGLE_TRY(GlslangWrapperVk::TransformSpirV(contextVk, options, shaderType, variableInfoMap,
ANGLE_TRY(GlslangWrapperVk::TransformSpirV(contextVk, options, variableInfoMap,
originalSpirvBlob, &transformedSpirvBlob));
ANGLE_TRY(vk::InitShaderAndSerial(contextVk, &mShaders[shaderType].get(),
transformedSpirvBlob.data(),
......
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