Commit 85707f7f by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Pass in SPIR-V transform options in a struct

Clean up change in preparation for changes that add more options. Bug: angleproject:5478 Change-Id: Id35825b337dba153a5c28dfcc311b344ce257f78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2599941 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarTim Van Patten <timvp@google.com>
parent 41d78ae1
...@@ -1069,12 +1069,8 @@ class SpirvTransformerBase : angle::NonCopyable ...@@ -1069,12 +1069,8 @@ class SpirvTransformerBase : angle::NonCopyable
public: public:
SpirvTransformerBase(const std::vector<uint32_t> &spirvBlobIn, SpirvTransformerBase(const std::vector<uint32_t> &spirvBlobIn,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
gl::ShaderType shaderType,
SpirvBlob *spirvBlobOut) SpirvBlob *spirvBlobOut)
: mSpirvBlobIn(spirvBlobIn), : mSpirvBlobIn(spirvBlobIn), mVariableInfoMap(variableInfoMap), mSpirvBlobOut(spirvBlobOut)
mShaderType(shaderType),
mVariableInfoMap(variableInfoMap),
mSpirvBlobOut(spirvBlobOut)
{ {
gl::ShaderBitSet allStages; gl::ShaderBitSet allStages;
allStages.set(); allStages.set();
...@@ -1122,7 +1118,6 @@ class SpirvTransformerBase : angle::NonCopyable ...@@ -1122,7 +1118,6 @@ class SpirvTransformerBase : angle::NonCopyable
// SPIR-V to transform: // SPIR-V to transform:
const std::vector<uint32_t> &mSpirvBlobIn; const std::vector<uint32_t> &mSpirvBlobIn;
const gl::ShaderType mShaderType;
// Input shader variable info map: // Input shader variable info map:
const ShaderInterfaceVariableInfoMap &mVariableInfoMap; const ShaderInterfaceVariableInfoMap &mVariableInfoMap;
...@@ -1385,15 +1380,12 @@ class SpirvTransformer final : public SpirvTransformerBase ...@@ -1385,15 +1380,12 @@ class SpirvTransformer final : public SpirvTransformerBase
{ {
public: public:
SpirvTransformer(const std::vector<uint32_t> &spirvBlobIn, SpirvTransformer(const std::vector<uint32_t> &spirvBlobIn,
bool removeEarlyFragmentTestsOptimization, GlslangSpirvOptions options,
bool removeDebugInfo,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
gl::ShaderType shaderType,
SpirvBlob *spirvBlobOut) SpirvBlob *spirvBlobOut)
: SpirvTransformerBase(spirvBlobIn, variableInfoMap, shaderType, spirvBlobOut), : SpirvTransformerBase(spirvBlobIn, variableInfoMap, spirvBlobOut),
mOptions(options),
mHasTransformFeedbackOutput(false), mHasTransformFeedbackOutput(false),
mRemoveEarlyFragmentTestsOptimization(removeEarlyFragmentTestsOptimization),
mRemoveDebugInfo(removeDebugInfo),
mOutputPerVertex{}, mOutputPerVertex{},
mInputPerVertex{} mInputPerVertex{}
{} {}
...@@ -1436,9 +1428,8 @@ class SpirvTransformer final : public SpirvTransformerBase ...@@ -1436,9 +1428,8 @@ class SpirvTransformer final : public SpirvTransformerBase
void writeOutputPrologue(); void writeOutputPrologue();
// Special flags: // Special flags:
GlslangSpirvOptions mOptions;
bool mHasTransformFeedbackOutput; bool mHasTransformFeedbackOutput;
bool mRemoveEarlyFragmentTestsOptimization;
bool mRemoveDebugInfo;
// Traversal state: // Traversal state:
bool mInsertFunctionVariables = false; bool mInsertFunctionVariables = false;
...@@ -1587,7 +1578,7 @@ void SpirvTransformer::transformInstruction() ...@@ -1587,7 +1578,7 @@ void SpirvTransformer::transformInstruction()
// Only write function variables for the EntryPoint function for non-compute shaders // Only write function variables for the EntryPoint function for non-compute shaders
mInsertFunctionVariables = mInsertFunctionVariables =
mOpFunctionId == mEntryPointId && mShaderType != gl::ShaderType::Compute; mOpFunctionId == mEntryPointId && mOptions.shaderType != gl::ShaderType::Compute;
} }
// Only look at interesting instructions. // Only look at interesting instructions.
...@@ -1688,7 +1679,7 @@ void SpirvTransformer::writeInputPreamble() ...@@ -1688,7 +1679,7 @@ void SpirvTransformer::writeInputPreamble()
for (uint32_t id = 0; id < mVariableInfoById.size(); id++) for (uint32_t id = 0; id < mVariableInfoById.size(); id++)
{ {
const ShaderInterfaceVariableInfo *info = mVariableInfoById[id]; const ShaderInterfaceVariableInfo *info = mVariableInfoById[id];
if (info && info->useRelaxedPrecision && info->activeStages[mShaderType] && if (info && info->useRelaxedPrecision && info->activeStages[mOptions.shaderType] &&
info->varyingIsInput) info->varyingIsInput)
{ {
// This is an input varying, need to cast the mediump value that came from // This is an input varying, need to cast the mediump value that came from
...@@ -1715,7 +1706,7 @@ void SpirvTransformer::writeOutputPrologue() ...@@ -1715,7 +1706,7 @@ void SpirvTransformer::writeOutputPrologue()
for (uint32_t id = 0; id < mVariableInfoById.size(); id++) for (uint32_t id = 0; id < mVariableInfoById.size(); id++)
{ {
const ShaderInterfaceVariableInfo *info = mVariableInfoById[id]; const ShaderInterfaceVariableInfo *info = mVariableInfoById[id];
if (info && info->useRelaxedPrecision && info->activeStages[mShaderType] && if (info && info->useRelaxedPrecision && info->activeStages[mOptions.shaderType] &&
info->varyingIsOutput) info->varyingIsOutput)
{ {
ASSERT(mFixedVaryingTypeId[id] != 0); ASSERT(mFixedVaryingTypeId[id] != 0);
...@@ -1949,7 +1940,7 @@ void SpirvTransformer::visitVariable(const uint32_t *instruction) ...@@ -1949,7 +1940,7 @@ void SpirvTransformer::visitVariable(const uint32_t *instruction)
// Associate the id of this name with its info. // Associate the id of this name with its info.
mVariableInfoById[id] = info; mVariableInfoById[id] = info;
if (info && info->useRelaxedPrecision && info->activeStages[mShaderType] && if (info && info->useRelaxedPrecision && info->activeStages[mOptions.shaderType] &&
mFixedVaryingId[id] == 0) mFixedVaryingId[id] == 0)
{ {
mFixedVaryingId[id] = getNewId(); mFixedVaryingId[id] = getNewId();
...@@ -1958,8 +1949,9 @@ void SpirvTransformer::visitVariable(const uint32_t *instruction) ...@@ -1958,8 +1949,9 @@ void SpirvTransformer::visitVariable(const uint32_t *instruction)
// Note if the variable is captured by transform feedback. In that case, the TransformFeedback // Note if the variable is captured by transform feedback. In that case, the TransformFeedback
// capability needs to be added. // capability needs to be added.
if (mShaderType != gl::ShaderType::Fragment && if (mOptions.shaderType != gl::ShaderType::Fragment &&
info->xfbBuffer != ShaderInterfaceVariableInfo::kInvalid && info->activeStages[mShaderType]) info->xfbBuffer != ShaderInterfaceVariableInfo::kInvalid &&
info->activeStages[mOptions.shaderType])
{ {
mHasTransformFeedbackOutput = true; mHasTransformFeedbackOutput = true;
} }
...@@ -1986,7 +1978,7 @@ bool SpirvTransformer::transformDecorate(const uint32_t *instruction, size_t wor ...@@ -1986,7 +1978,7 @@ bool SpirvTransformer::transformDecorate(const uint32_t *instruction, size_t wor
} }
// If it's an inactive varying, remove the decoration altogether. // If it's an inactive varying, remove the decoration altogether.
if (!info->activeStages[mShaderType]) if (!info->activeStages[mOptions.shaderType])
{ {
return true; return true;
} }
...@@ -2063,7 +2055,7 @@ bool SpirvTransformer::transformDecorate(const uint32_t *instruction, size_t wor ...@@ -2063,7 +2055,7 @@ bool SpirvTransformer::transformDecorate(const uint32_t *instruction, size_t wor
} }
// Add Xfb decorations, if any. // Add Xfb decorations, if any.
if (mShaderType != gl::ShaderType::Fragment && if (mOptions.shaderType != gl::ShaderType::Fragment &&
info->xfbBuffer != ShaderInterfaceVariableInfo::kInvalid) info->xfbBuffer != ShaderInterfaceVariableInfo::kInvalid)
{ {
ASSERT(info->xfbStride != ShaderInterfaceVariableInfo::kInvalid); ASSERT(info->xfbStride != ShaderInterfaceVariableInfo::kInvalid);
...@@ -2166,7 +2158,7 @@ bool SpirvTransformer::transformCapability(const uint32_t *instruction, size_t w ...@@ -2166,7 +2158,7 @@ bool SpirvTransformer::transformCapability(const uint32_t *instruction, size_t w
bool SpirvTransformer::transformDebugInfo(const uint32_t *instruction, size_t wordCount) bool SpirvTransformer::transformDebugInfo(const uint32_t *instruction, size_t wordCount)
{ {
if (mRemoveDebugInfo) if (mOptions.removeDebugInfo)
{ {
// Strip debug info to reduce binary size. // Strip debug info to reduce binary size.
return true; return true;
...@@ -2193,7 +2185,7 @@ bool SpirvTransformer::transformDebugInfo(const uint32_t *instruction, size_t wo ...@@ -2193,7 +2185,7 @@ bool SpirvTransformer::transformDebugInfo(const uint32_t *instruction, size_t wo
bool SpirvTransformer::transformEmitVertex(const uint32_t *instruction, size_t wordCount) bool SpirvTransformer::transformEmitVertex(const uint32_t *instruction, size_t wordCount)
{ {
// This is only possible in geometry shaders. // This is only possible in geometry shaders.
ASSERT(mShaderType == gl::ShaderType::Geometry); ASSERT(mOptions.shaderType == gl::ShaderType::Geometry);
// Write the temporary variables that hold varyings data before EmitVertex(). // Write the temporary variables that hold varyings data before EmitVertex().
writeOutputPrologue(); writeOutputPrologue();
...@@ -2234,7 +2226,7 @@ bool SpirvTransformer::transformEntryPoint(const uint32_t *instruction, size_t w ...@@ -2234,7 +2226,7 @@ bool SpirvTransformer::transformEntryPoint(const uint32_t *instruction, size_t w
ASSERT(info); ASSERT(info);
if (!info->activeStages[mShaderType]) if (!info->activeStages[mOptions.shaderType])
{ {
continue; continue;
} }
...@@ -2367,7 +2359,8 @@ bool SpirvTransformer::transformReturn(const uint32_t *instruction, size_t wordC ...@@ -2367,7 +2359,8 @@ bool SpirvTransformer::transformReturn(const uint32_t *instruction, size_t wordC
// For geometry shaders, this operations is done before every EmitVertex() instead. // For geometry shaders, this operations is done before every EmitVertex() instead.
// Additionally, this transformation (which affects output varyings) doesn't apply to fragment // Additionally, this transformation (which affects output varyings) doesn't apply to fragment
// shaders. // shaders.
if (mShaderType == gl::ShaderType::Geometry || mShaderType == gl::ShaderType::Fragment) if (mOptions.shaderType == gl::ShaderType::Geometry ||
mOptions.shaderType == gl::ShaderType::Fragment)
{ {
return false; return false;
} }
...@@ -2401,7 +2394,7 @@ bool SpirvTransformer::transformVariable(const uint32_t *instruction, size_t wor ...@@ -2401,7 +2394,7 @@ bool SpirvTransformer::transformVariable(const uint32_t *instruction, size_t wor
// inactive varying inputs are already pruned by the translator. // inactive varying inputs are already pruned by the translator.
// However, input or output storage class for interface block will not be pruned when a shader // However, input or output storage class for interface block will not be pruned when a shader
// is compiled separately. // is compiled separately.
if (info->activeStages[mShaderType]) if (info->activeStages[mOptions.shaderType])
{ {
if (info->useRelaxedPrecision && if (info->useRelaxedPrecision &&
(storageClass == spv::StorageClassOutput || storageClass == spv::StorageClassInput)) (storageClass == spv::StorageClassOutput || storageClass == spv::StorageClassInput))
...@@ -2456,7 +2449,7 @@ bool SpirvTransformer::transformAccessChain(const uint32_t *instruction, size_t ...@@ -2456,7 +2449,7 @@ bool SpirvTransformer::transformAccessChain(const uint32_t *instruction, size_t
return false; return false;
} }
if (info->activeStages[mShaderType] && !info->useRelaxedPrecision) if (info->activeStages[mOptions.shaderType] && !info->useRelaxedPrecision)
{ {
return false; return false;
} }
...@@ -2479,7 +2472,7 @@ bool SpirvTransformer::transformExecutionMode(const uint32_t *instruction, size_ ...@@ -2479,7 +2472,7 @@ bool SpirvTransformer::transformExecutionMode(const uint32_t *instruction, size_
const uint32_t executionMode = instruction[kModeIndex]; const uint32_t executionMode = instruction[kModeIndex];
if (executionMode == spv::ExecutionModeEarlyFragmentTests && if (executionMode == spv::ExecutionModeEarlyFragmentTests &&
mRemoveEarlyFragmentTestsOptimization) mOptions.removeEarlyFragmentTestsOptimization)
{ {
// skip the copy // skip the copy
return true; return true;
...@@ -2525,7 +2518,7 @@ class SpirvVertexAttributeAliasingTransformer final : public SpirvTransformerBas ...@@ -2525,7 +2518,7 @@ class SpirvVertexAttributeAliasingTransformer final : public SpirvTransformerBas
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
std::vector<const ShaderInterfaceVariableInfo *> &&variableInfoById, std::vector<const ShaderInterfaceVariableInfo *> &&variableInfoById,
SpirvBlob *spirvBlobOut) SpirvBlob *spirvBlobOut)
: SpirvTransformerBase(spirvBlobIn, variableInfoMap, gl::ShaderType::Vertex, spirvBlobOut) : SpirvTransformerBase(spirvBlobIn, variableInfoMap, spirvBlobOut)
{ {
mVariableInfoById = std::move(variableInfoById); mVariableInfoById = std::move(variableInfoById);
} }
...@@ -3750,9 +3743,7 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options, ...@@ -3750,9 +3743,7 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options,
} }
angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback, angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
const gl::ShaderType shaderType, const GlslangSpirvOptions &options,
bool removeEarlyFragmentTestsOptimization,
bool removeDebugInfo,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob, const SpirvBlob &initialSpirvBlob,
SpirvBlob *spirvBlobOut) SpirvBlob *spirvBlobOut)
...@@ -3771,12 +3762,11 @@ angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback, ...@@ -3771,12 +3762,11 @@ angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
#endif // defined(ANGLE_DEBUG_SPIRV_TRANSFORMER) && ANGLE_DEBUG_SPIRV_TRANSFORMER #endif // defined(ANGLE_DEBUG_SPIRV_TRANSFORMER) && ANGLE_DEBUG_SPIRV_TRANSFORMER
// Transform the SPIR-V code by assigning location/set/binding values. // Transform the SPIR-V code by assigning location/set/binding values.
SpirvTransformer transformer(initialSpirvBlob, removeEarlyFragmentTestsOptimization, SpirvTransformer transformer(initialSpirvBlob, options, variableInfoMap, spirvBlobOut);
removeDebugInfo, variableInfoMap, shaderType, spirvBlobOut);
ANGLE_GLSLANG_CHECK(callback, transformer.transform(), GlslangError::InvalidSpirv); ANGLE_GLSLANG_CHECK(callback, transformer.transform(), GlslangError::InvalidSpirv);
// If there are aliasing vertex attributes, transform the SPIR-V again to remove them. // If there are aliasing vertex attributes, transform the SPIR-V again to remove them.
if (shaderType == gl::ShaderType::Vertex && HasAliasingAttributes(variableInfoMap)) if (options.shaderType == gl::ShaderType::Vertex && HasAliasingAttributes(variableInfoMap))
{ {
SpirvBlob preTransformBlob = std::move(*spirvBlobOut); SpirvBlob preTransformBlob = std::move(*spirvBlobOut);
SpirvVertexAttributeAliasingTransformer aliasingTransformer( SpirvVertexAttributeAliasingTransformer aliasingTransformer(
......
...@@ -53,6 +53,13 @@ struct GlslangSourceOptions ...@@ -53,6 +53,13 @@ struct GlslangSourceOptions
bool emulateBresenhamLines = false; bool emulateBresenhamLines = false;
}; };
struct GlslangSpirvOptions
{
gl::ShaderType shaderType = gl::ShaderType::InvalidEnum;
bool removeEarlyFragmentTestsOptimization = false;
bool removeDebugInfo = false;
};
using SpirvBlob = std::vector<uint32_t>; using SpirvBlob = std::vector<uint32_t>;
using GlslangErrorCallback = std::function<angle::Result(GlslangError)>; using GlslangErrorCallback = std::function<angle::Result(GlslangError)>;
...@@ -138,9 +145,7 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options, ...@@ -138,9 +145,7 @@ void GlslangGetShaderSource(const GlslangSourceOptions &options,
ShaderMapInterfaceVariableInfoMap *variableInfoMapOut); ShaderMapInterfaceVariableInfoMap *variableInfoMapOut);
angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback, angle::Result GlslangTransformSpirvCode(const GlslangErrorCallback &callback,
const gl::ShaderType shaderType, const GlslangSpirvOptions &options,
bool removeEarlyFragmentTestsOptimization,
bool removeDebugInfo,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob, const SpirvBlob &initialSpirvBlob,
SpirvBlob *spirvBlobOut); SpirvBlob *spirvBlobOut);
......
...@@ -455,13 +455,12 @@ angle::Result GlslangGetShaderSpirvCode(ErrorHandler *context, ...@@ -455,13 +455,12 @@ angle::Result GlslangGetShaderSpirvCode(ErrorHandler *context,
for (const gl::ShaderType shaderType : linkedShaderStages) for (const gl::ShaderType shaderType : linkedShaderStages)
{ {
// we pass in false here to skip modifications related to early fragment tests GlslangSpirvOptions options;
// optimizations and line rasterization. These are done in the initProgram time since they options.shaderType = shaderType;
// are related to context state. We must keep original untouched spriv blobs here because we
// do not have ability to add back in at initProgram time.
angle::Result status = GlslangTransformSpirvCode( angle::Result status = GlslangTransformSpirvCode(
[context](GlslangError error) { return HandleError(context, error); }, shaderType, [context](GlslangError error) { return HandleError(context, error); }, options,
false, false, variableInfoMap[shaderType], initialSpirvBlobs[shaderType], variableInfoMap[shaderType], initialSpirvBlobs[shaderType],
&(*shaderCodeOut)[shaderType]); &(*shaderCodeOut)[shaderType]);
if (status != angle::Result::Continue) if (status != angle::Result::Continue)
{ {
......
...@@ -84,18 +84,14 @@ angle::Result GlslangWrapperVk::GetShaderCode(vk::Context *context, ...@@ -84,18 +84,14 @@ angle::Result GlslangWrapperVk::GetShaderCode(vk::Context *context,
// static // static
angle::Result GlslangWrapperVk::TransformSpirV( angle::Result GlslangWrapperVk::TransformSpirV(
vk::Context *context, vk::Context *context,
const gl::ShaderType shaderType, const GlslangSpirvOptions &options,
bool removeEarlyFragmentTestsOptimization,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob, const SpirvBlob &initialSpirvBlob,
SpirvBlob *shaderCodeOut) SpirvBlob *shaderCodeOut)
{ {
const bool removeDebugInfo = !context->getRenderer()->getEnableValidationLayers();
return GlslangTransformSpirvCode( return GlslangTransformSpirvCode(
[context](GlslangError error) { return ErrorHandler(context, error); }, shaderType, [context](GlslangError error) { return ErrorHandler(context, error); }, options,
removeEarlyFragmentTestsOptimization, removeDebugInfo, variableInfoMap, initialSpirvBlob, variableInfoMap, initialSpirvBlob, shaderCodeOut);
shaderCodeOut);
} }
// static // static
......
...@@ -44,8 +44,7 @@ class GlslangWrapperVk ...@@ -44,8 +44,7 @@ class GlslangWrapperVk
gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut); gl::ShaderMap<std::vector<uint32_t>> *shaderCodesOut);
static angle::Result TransformSpirV(vk::Context *context, static angle::Result TransformSpirV(vk::Context *context,
const gl::ShaderType shaderType, const GlslangSpirvOptions &options,
bool removeEarlyFragmentTestsOptimization,
const ShaderInterfaceVariableInfoMap &variableInfoMap, const ShaderInterfaceVariableInfoMap &variableInfoMap,
const SpirvBlob &initialSpirvBlob, const SpirvBlob &initialSpirvBlob,
SpirvBlob *shaderCodeOut); SpirvBlob *shaderCodeOut);
......
...@@ -30,10 +30,13 @@ bool ValidateTransformedSpirV(ContextVk *contextVk, ...@@ -30,10 +30,13 @@ bool ValidateTransformedSpirV(ContextVk *contextVk,
{ {
for (gl::ShaderType shaderType : linkedShaderStages) for (gl::ShaderType shaderType : linkedShaderStages)
{ {
GlslangSpirvOptions options;
options.shaderType = shaderType;
options.removeDebugInfo = true;
SpirvBlob transformed; SpirvBlob transformed;
if (GlslangWrapperVk::TransformSpirV( if (GlslangWrapperVk::TransformSpirV(
contextVk, shaderType, false, contextVk, options, executableVk->getShaderInterfaceVariableInfoMap()[shaderType],
executableVk->getShaderInterfaceVariableInfoMap()[shaderType],
spirvBlobs[shaderType], &transformed) != angle::Result::Continue) spirvBlobs[shaderType], &transformed) != angle::Result::Continue)
{ {
return false; return false;
...@@ -121,13 +124,16 @@ angle::Result ProgramInfo::initProgram(ContextVk *contextVk, ...@@ -121,13 +124,16 @@ angle::Result ProgramInfo::initProgram(ContextVk *contextVk,
executableVk->getShaderInterfaceVariableInfoMap(); executableVk->getShaderInterfaceVariableInfoMap();
const gl::ShaderMap<SpirvBlob> &originalSpirvBlobs = shaderInfo.getSpirvBlobs(); const gl::ShaderMap<SpirvBlob> &originalSpirvBlobs = shaderInfo.getSpirvBlobs();
const SpirvBlob &originalSpirvBlob = originalSpirvBlobs[shaderType]; const SpirvBlob &originalSpirvBlob = originalSpirvBlobs[shaderType];
bool removeEarlyFragmentTestsOptimization =
(shaderType == gl::ShaderType::Fragment && optionBits.removeEarlyFragmentTestsOptimization);
gl::ShaderMap<SpirvBlob> transformedSpirvBlobs; gl::ShaderMap<SpirvBlob> transformedSpirvBlobs;
SpirvBlob &transformedSpirvBlob = transformedSpirvBlobs[shaderType]; SpirvBlob &transformedSpirvBlob = transformedSpirvBlobs[shaderType];
ANGLE_TRY(GlslangWrapperVk::TransformSpirV( GlslangSpirvOptions options;
contextVk, shaderType, removeEarlyFragmentTestsOptimization, variableInfoMap[shaderType], options.shaderType = shaderType;
options.removeEarlyFragmentTestsOptimization =
shaderType == gl::ShaderType::Fragment && optionBits.removeEarlyFragmentTestsOptimization;
options.removeDebugInfo = !contextVk->getRenderer()->getEnableValidationLayers();
ANGLE_TRY(GlslangWrapperVk::TransformSpirV(contextVk, options, variableInfoMap[shaderType],
originalSpirvBlob, &transformedSpirvBlob)); originalSpirvBlob, &transformedSpirvBlob));
ANGLE_TRY(vk::InitShaderAndSerial(contextVk, &mShaders[shaderType].get(), ANGLE_TRY(vk::InitShaderAndSerial(contextVk, &mShaders[shaderType].get(),
transformedSpirvBlob.data(), 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