#include "compiler/translator/spirv/BuildSPIRV.h"
#include "common/spirv/spirv_instruction_builder_autogen.h"
#include "compiler/translator/ValidateVaryingLocations.h"
#include "compiler/translator/blocklayout.h"
#include "compiler/translator/util.h"
namespace sh
{
bool operator==(const SpirvType &a, const SpirvType &b)
{ … }
namespace
{
bool IsBlockFieldRowMajorQualified(const TType &fieldType, bool isParentBlockRowMajorQualified)
{ … }
bool IsNonSquareRowMajorArrayInBlock(const TType &type, const SpirvTypeSpec &parentTypeSpec)
{ … }
bool IsInvariant(const TType &type, TCompiler *compiler)
{ … }
TLayoutBlockStorage GetBlockStorage(const TType &type)
{ … }
ShaderVariable ToShaderVariable(const TFieldListCollection *block,
GLenum type,
const TSpan<const unsigned int> arraySizes,
bool isRowMajor)
{ … }
ShaderVariable SpirvTypeToShaderVariable(const SpirvType &type)
{ … }
uint32_t Encode(const ShaderVariable &var,
bool isStd140,
spirv::IdRef blockTypeId,
spirv::Blob *decorationsBlob)
{ … }
uint32_t GetArrayStrideInBlock(const ShaderVariable &var, bool isStd140)
{ … }
spv::ExecutionMode GetGeometryInputExecutionMode(TLayoutPrimitiveType primitiveType)
{ … }
spv::ExecutionMode GetGeometryOutputExecutionMode(TLayoutPrimitiveType primitiveType)
{ … }
spv::ExecutionMode GetTessEvalInputExecutionMode(TLayoutTessEvaluationType inputType)
{ … }
spv::ExecutionMode GetTessEvalSpacingExecutionMode(TLayoutTessEvaluationType spacing)
{ … }
spv::ExecutionMode GetTessEvalOrderingExecutionMode(TLayoutTessEvaluationType ordering)
{ … }
void WriteInterpolationDecoration(spv::Decoration decoration,
spirv::IdRef id,
uint32_t fieldIndex,
spirv::Blob *decorationsBlob)
{ … }
void ApplyDecorations(spirv::IdRef id,
const SpirvDecorations &decorations,
spirv::Blob *decorationsBlob)
{ … }
}
void SpirvTypeSpec::inferDefaults(const TType &type, TCompiler *compiler)
{ … }
void SpirvTypeSpec::onArrayElementSelection(bool isElementTypeBlock, bool isElementTypeArray)
{ … }
void SpirvTypeSpec::onBlockFieldSelection(const TType &fieldType)
{ … }
void SpirvTypeSpec::onMatrixColumnSelection()
{ … }
void SpirvTypeSpec::onVectorComponentSelection()
{ … }
SPIRVBuilder::SPIRVBuilder(TCompiler *compiler,
const ShCompileOptions &compileOptions,
const angle::HashMap<int, uint32_t> &uniqueToSpirvIdMap,
uint32_t firstUnusedSpirvId)
: … { … }
spirv::IdRef SPIRVBuilder::getNewId(const SpirvDecorations &decorations)
{ … }
spirv::IdRef SPIRVBuilder::getReservedOrNewId(TSymbolUniqueId uniqueId,
const SpirvDecorations &decorations)
{ … }
SpirvType SPIRVBuilder::getSpirvType(const TType &type, const SpirvTypeSpec &typeSpec) const
{ … }
const SpirvTypeData &SPIRVBuilder::getTypeData(const TType &type, const SpirvTypeSpec &typeSpec)
{ … }
const SpirvTypeData &SPIRVBuilder::getTypeDataOverrideTypeSpec(const TType &type,
const SpirvTypeSpec &typeSpec)
{ … }
const SpirvTypeData &SPIRVBuilder::getSpirvTypeData(const SpirvType &type, const TSymbol *block)
{ … }
spirv::IdRef SPIRVBuilder::getBasicTypeId(TBasicType basicType, size_t size)
{ … }
spirv::IdRef SPIRVBuilder::getTypePointerId(spirv::IdRef typeId, spv::StorageClass storageClass)
{ … }
spirv::IdRef SPIRVBuilder::getFunctionTypeId(spirv::IdRef returnTypeId,
const spirv::IdRefList ¶mTypeIds)
{ … }
SpirvDecorations SPIRVBuilder::getDecorations(const TType &type)
{ … }
SpirvDecorations SPIRVBuilder::getArithmeticDecorations(const TType &type,
bool isPrecise,
TOperator op)
{ … }
spirv::IdRef SPIRVBuilder::getExtInstImportIdStd()
{ … }
void SPIRVBuilder::predefineCommonTypes()
{ … }
void SPIRVBuilder::writeDebugName(spirv::IdRef id, const char *name)
{ … }
void SPIRVBuilder::writeBlockDebugNames(const TFieldListCollection *block,
spirv::IdRef typeId,
const char *name)
{ … }
SpirvTypeData SPIRVBuilder::declareType(const SpirvType &type, const TSymbol *block)
{ … }
void SPIRVBuilder::getImageTypeParameters(TBasicType type,
spirv::IdRef *sampledTypeOut,
spv::Dim *dimOut,
spirv::LiteralInteger *depthOut,
spirv::LiteralInteger *arrayedOut,
spirv::LiteralInteger *multisampledOut,
spirv::LiteralInteger *sampledOut)
{ … }
spv::ImageFormat SPIRVBuilder::getImageFormat(TLayoutImageInternalFormat imageInternalFormat)
{ … }
spirv::IdRef SPIRVBuilder::getBoolConstant(bool value)
{ … }
spirv::IdRef SPIRVBuilder::getBasicConstantHelper(uint32_t value,
TBasicType type,
angle::HashMap<uint32_t, spirv::IdRef> *constants)
{ … }
spirv::IdRef SPIRVBuilder::getUintConstant(uint32_t value)
{ … }
spirv::IdRef SPIRVBuilder::getIntConstant(int32_t value)
{ … }
spirv::IdRef SPIRVBuilder::getFloatConstant(float value)
{ … }
spirv::IdRef SPIRVBuilder::getNullConstant(spirv::IdRef typeId)
{ … }
spirv::IdRef SPIRVBuilder::getNullVectorConstantHelper(TBasicType type, int size)
{ … }
spirv::IdRef SPIRVBuilder::getVectorConstantHelper(spirv::IdRef valueId, TBasicType type, int size)
{ … }
spirv::IdRef SPIRVBuilder::getUvecConstant(uint32_t value, int size)
{ … }
spirv::IdRef SPIRVBuilder::getIvecConstant(int32_t value, int size)
{ … }
spirv::IdRef SPIRVBuilder::getVecConstant(float value, int size)
{ … }
spirv::IdRef SPIRVBuilder::getCompositeConstant(spirv::IdRef typeId, const spirv::IdRefList &values)
{ … }
void SPIRVBuilder::startNewFunction(spirv::IdRef functionId, const TFunction *func)
{ … }
void SPIRVBuilder::assembleSpirvFunctionBlocks()
{ … }
spirv::IdRef SPIRVBuilder::declareVariable(spirv::IdRef typeId,
spv::StorageClass storageClass,
const SpirvDecorations &decorations,
spirv::IdRef *initializerId,
const char *name,
const TSymbolUniqueId *uniqueId)
{ … }
spirv::IdRef SPIRVBuilder::declareSpecConst(TBasicType type, int id, const char *name)
{ … }
void SPIRVBuilder::startConditional(size_t blockCount, bool isContinuable, bool isBreakable)
{ … }
void SPIRVBuilder::nextConditionalBlock()
{ … }
void SPIRVBuilder::endConditional()
{ … }
bool SPIRVBuilder::isInLoop() const
{ … }
spirv::IdRef SPIRVBuilder::getBreakTargetId() const
{ … }
spirv::IdRef SPIRVBuilder::getContinueTargetId() const
{ … }
uint32_t SPIRVBuilder::nextUnusedBinding()
{ … }
uint32_t SPIRVBuilder::nextUnusedInputLocation(uint32_t consumedCount)
{ … }
uint32_t SPIRVBuilder::nextUnusedOutputLocation(uint32_t consumedCount)
{ … }
bool SPIRVBuilder::isInvariantOutput(const TType &type) const
{ … }
void SPIRVBuilder::addCapability(spv::Capability capability)
{ … }
void SPIRVBuilder::addExecutionMode(spv::ExecutionMode executionMode)
{ … }
void SPIRVBuilder::addExtension(SPIRVExtensions extension)
{ … }
void SPIRVBuilder::addEntryPointInterfaceVariableId(spirv::IdRef id)
{ … }
void SPIRVBuilder::writePerVertexBuiltIns(const TType &type, spirv::IdRef typeId)
{ … }
void SPIRVBuilder::writeInterfaceVariableDecorations(const TType &type, spirv::IdRef variableId)
{ … }
void SPIRVBuilder::writeBranchConditional(spirv::IdRef conditionValue,
spirv::IdRef trueBlock,
spirv::IdRef falseBlock,
spirv::IdRef mergeBlock)
{ … }
void SPIRVBuilder::writeBranchConditionalBlockEnd()
{ … }
void SPIRVBuilder::writeLoopHeader(spirv::IdRef branchToBlock,
spirv::IdRef continueBlock,
spirv::IdRef mergeBlock)
{ … }
void SPIRVBuilder::writeLoopConditionEnd(spirv::IdRef conditionValue,
spirv::IdRef branchToBlock,
spirv::IdRef mergeBlock)
{ … }
void SPIRVBuilder::writeLoopContinueEnd(spirv::IdRef headerBlock)
{ … }
void SPIRVBuilder::writeLoopBodyEnd(spirv::IdRef continueBlock)
{ … }
void SPIRVBuilder::writeSwitch(spirv::IdRef conditionValue,
spirv::IdRef defaultBlock,
const spirv::PairLiteralIntegerIdRefList &targetPairList,
spirv::IdRef mergeBlock)
{ … }
void SPIRVBuilder::writeSwitchCaseBlockEnd()
{ … }
void SPIRVBuilder::writeMemberDecorations(const SpirvType &type, spirv::IdRef typeId)
{ … }
void SPIRVBuilder::writeInterpolationDecoration(TQualifier qualifier,
spirv::IdRef id,
uint32_t fieldIndex)
{ … }
ImmutableString SPIRVBuilder::getName(const TSymbol *symbol)
{ … }
ImmutableString SPIRVBuilder::getFieldName(const TField *field)
{ … }
spirv::Blob SPIRVBuilder::getSpirv()
{ … }
void SPIRVBuilder::writeExecutionModes(spirv::Blob *blob)
{ … }
void SPIRVBuilder::writeExtensions(spirv::Blob *blob)
{ … }
void SPIRVBuilder::writeSourceExtensions(spirv::Blob *blob)
{ … }
void SPIRVBuilder::writeNonSemanticOverview(spirv::Blob *blob, spirv::IdRef id)
{ … }
void SPIRVBuilder::writeNonSemanticInstruction(vk::spirv::NonSemanticInstruction instruction)
{ … }
}