Web: Remove unused stage functionality, SPIR-V logger, and hex_utils
Saves another 20K.
This commit is contained in:
parent
39697cdb9d
commit
155d351f86
20 changed files with 450 additions and 390 deletions
|
|
@ -226,45 +226,48 @@ enum ComputeDerivativeMode {
|
|||
class TIntermediate {
|
||||
public:
|
||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
|
||||
implicitThisName("@this"), implicitCounterName("@count"),
|
||||
language(l),
|
||||
#ifdef ENABLE_HLSL
|
||||
implicitThisName("@this"), implicitCounterName("@count"),
|
||||
source(EShSourceNone),
|
||||
#endif
|
||||
profile(p), version(v), treeRoot(0),
|
||||
numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
|
||||
invertY(false),
|
||||
useStorageBuffer(false),
|
||||
nanMinMaxClamp(false),
|
||||
depthReplacing(false)
|
||||
#ifndef GLSLANG_WEB
|
||||
,
|
||||
useVulkanMemoryModel(false),
|
||||
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet),
|
||||
inputPrimitive(ElgNone), outputPrimitive(ElgNone),
|
||||
pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), interlockOrdering(EioNone), pointMode(false), earlyFragmentTests(false),
|
||||
postDepthCoverage(false), depthLayout(EldNone), depthReplacing(false),
|
||||
postDepthCoverage(false), depthLayout(EldNone),
|
||||
hlslFunctionality1(false),
|
||||
blendEquations(0), xfbMode(false), multiStream(false),
|
||||
#ifndef GLSLANG_WEB
|
||||
layoutOverrideCoverage(false),
|
||||
geoPassthroughEXT(false),
|
||||
numShaderRecordNVBlocks(0),
|
||||
computeDerivativeMode(LayoutDerivativeNone),
|
||||
primitives(TQualifier::layoutNotSet),
|
||||
numTaskNVBlocks(0),
|
||||
#endif
|
||||
autoMapBindings(false),
|
||||
autoMapLocations(false),
|
||||
invertY(false),
|
||||
flattenUniformArrays(false),
|
||||
useUnknownFormat(false),
|
||||
hlslOffsets(false),
|
||||
useStorageBuffer(false),
|
||||
useVulkanMemoryModel(false),
|
||||
hlslIoMapping(false),
|
||||
useVariablePointers(false),
|
||||
textureSamplerTransformMode(EShTexSampTransKeep),
|
||||
needToLegalize(false),
|
||||
binaryDoubleOutput(false),
|
||||
usePhysicalStorageBuffer(false),
|
||||
uniformLocationBase(0),
|
||||
nanMinMaxClamp(false)
|
||||
uniformLocationBase(0)
|
||||
#endif
|
||||
{
|
||||
#ifndef GLSLANG_WEB
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
localSize[2] = 1;
|
||||
|
|
@ -272,147 +275,9 @@ public:
|
|||
localSizeSpecId[1] = TQualifier::layoutNotSet;
|
||||
localSizeSpecId[2] = TQualifier::layoutNotSet;
|
||||
xfbBuffers.resize(TQualifier::layoutXfbBufferEnd);
|
||||
|
||||
shiftBinding.fill(0);
|
||||
}
|
||||
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||
|
||||
bool postProcess(TIntermNode*, EShLanguage);
|
||||
#ifdef GLSLANG_WEB
|
||||
void output(TInfoSink&, bool tree) { }
|
||||
#else
|
||||
void output(TInfoSink&, bool tree);
|
||||
#endif
|
||||
void removeTree();
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
#else
|
||||
void setSource(EShSource s) { assert(s == EShSourceGlsl); }
|
||||
EShSource getSource() const { return EShSourceGlsl; }
|
||||
#endif
|
||||
void setEntryPointName(const char* ep)
|
||||
{
|
||||
entryPointName = ep;
|
||||
processes.addProcess("entry-point");
|
||||
processes.addArgument(entryPointName);
|
||||
}
|
||||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setShiftBinding(TResourceType res, unsigned int shift)
|
||||
{
|
||||
shiftBinding[res] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr)
|
||||
processes.addIfNonZero(name, shift);
|
||||
}
|
||||
|
||||
unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
|
||||
|
||||
void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
|
||||
{
|
||||
if (shift == 0) // ignore if there's no shift: it's a no-op.
|
||||
return;
|
||||
|
||||
shiftBindingForSet[res][set] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr) {
|
||||
processes.addProcess(name);
|
||||
processes.addArgument(shift);
|
||||
processes.addArgument(set);
|
||||
}
|
||||
}
|
||||
|
||||
int getShiftBindingForSet(TResourceType res, unsigned int set) const
|
||||
{
|
||||
const auto shift = shiftBindingForSet[res].find(set);
|
||||
return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
|
||||
}
|
||||
bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
|
||||
|
||||
void setResourceSetBinding(const std::vector<std::string>& shift)
|
||||
{
|
||||
resourceSetBinding = shift;
|
||||
if (shift.size() > 0) {
|
||||
processes.addProcess("resource-set-binding");
|
||||
for (int s = 0; s < (int)shift.size(); ++s)
|
||||
processes.addArgument(shift[s]);
|
||||
}
|
||||
}
|
||||
const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
|
||||
void setAutoMapBindings(bool map)
|
||||
{
|
||||
autoMapBindings = map;
|
||||
if (autoMapBindings)
|
||||
processes.addProcess("auto-map-bindings");
|
||||
}
|
||||
bool getAutoMapBindings() const { return autoMapBindings; }
|
||||
void setAutoMapLocations(bool map)
|
||||
{
|
||||
autoMapLocations = map;
|
||||
if (autoMapLocations)
|
||||
processes.addProcess("auto-map-locations");
|
||||
}
|
||||
bool getAutoMapLocations() const { return autoMapLocations; }
|
||||
void setInvertY(bool invert)
|
||||
{
|
||||
invertY = invert;
|
||||
if (invertY)
|
||||
processes.addProcess("invert-y");
|
||||
}
|
||||
bool getInvertY() const { return invertY; }
|
||||
|
||||
void setFlattenUniformArrays(bool flatten)
|
||||
{
|
||||
flattenUniformArrays = flatten;
|
||||
if (flattenUniformArrays)
|
||||
processes.addProcess("flatten-uniform-arrays");
|
||||
}
|
||||
bool getFlattenUniformArrays() const { return flattenUniformArrays; }
|
||||
void setNoStorageFormat(bool b)
|
||||
{
|
||||
useUnknownFormat = b;
|
||||
if (useUnknownFormat)
|
||||
processes.addProcess("no-storage-format");
|
||||
}
|
||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||
void setUseStorageBuffer()
|
||||
{
|
||||
useStorageBuffer = true;
|
||||
processes.addProcess("use-storage-buffer");
|
||||
}
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setUseVulkanMemoryModel()
|
||||
{
|
||||
useVulkanMemoryModel = true;
|
||||
processes.addProcess("use-vulkan-memory-model");
|
||||
}
|
||||
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
|
||||
void setUsePhysicalStorageBuffer()
|
||||
{
|
||||
usePhysicalStorageBuffer = true;
|
||||
}
|
||||
bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
|
||||
void setUseVariablePointers()
|
||||
{
|
||||
useVariablePointers = true;
|
||||
processes.addProcess("use-variable-pointers");
|
||||
}
|
||||
bool usingVariablePointers() const { return useVariablePointers; }
|
||||
|
||||
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
|
||||
bool hasCounterBufferName(const TString& name) const {
|
||||
size_t len = strlen(implicitCounterName);
|
||||
return name.size() > len &&
|
||||
name.compare(name.size() - len, len, implicitCounterName) == 0;
|
||||
}
|
||||
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
|
||||
|
||||
void setVersion(int v) { version = v; }
|
||||
int getVersion() const { return version; }
|
||||
|
|
@ -476,14 +341,35 @@ public:
|
|||
int getNumEntryPoints() const { return numEntryPoints; }
|
||||
int getNumErrors() const { return numErrors; }
|
||||
void addPushConstantCount() { ++numPushConstants; }
|
||||
#ifdef GLSLANG_WEB
|
||||
int getNumPushConstants() const { return 0; }
|
||||
void addShaderRecordNVCount() { }
|
||||
void addTaskNVCount() { }
|
||||
void setLimits(const TBuiltInResource& r) { resources = r; }
|
||||
|
||||
bool postProcess(TIntermNode*, EShLanguage);
|
||||
void removeTree();
|
||||
|
||||
void setEntryPointName(const char* ep)
|
||||
{
|
||||
entryPointName = ep;
|
||||
processes.addProcess("entry-point");
|
||||
processes.addArgument(entryPointName);
|
||||
}
|
||||
void setEntryPointMangledName(const char* ep) { entryPointMangledName = ep; }
|
||||
const std::string& getEntryPointName() const { return entryPointName; }
|
||||
const std::string& getEntryPointMangledName() const { return entryPointMangledName; }
|
||||
|
||||
void setInvertY(bool invert)
|
||||
{
|
||||
invertY = invert;
|
||||
if (invertY)
|
||||
processes.addProcess("invert-y");
|
||||
}
|
||||
bool getInvertY() const { return invertY; }
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setSource(EShSource s) { source = s; }
|
||||
EShSource getSource() const { return source; }
|
||||
#else
|
||||
int getNumPushConstants() const { return numPushConstants; }
|
||||
void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
void setSource(EShSource s) { assert(s == EShSourceGlsl); }
|
||||
EShSource getSource() const { return EShSourceGlsl; }
|
||||
#endif
|
||||
|
||||
bool isRecursive() const { return recursive; }
|
||||
|
|
@ -562,6 +448,143 @@ public:
|
|||
void addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage, TSymbolTable&);
|
||||
void addSymbolLinkageNode(TIntermAggregate*& linkage, const TSymbol&);
|
||||
|
||||
void setUseStorageBuffer()
|
||||
{
|
||||
useStorageBuffer = true;
|
||||
processes.addProcess("use-storage-buffer");
|
||||
}
|
||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
void output(TInfoSink&, bool tree) { }
|
||||
|
||||
bool getXfbMode() const { return false; }
|
||||
bool isMultiStream() const { return false; }
|
||||
TLayoutGeometry getOutputPrimitive() const { return ElgNone; }
|
||||
bool getPostDepthCoverage() const { return false; }
|
||||
bool getEarlyFragmentTests() const { return false; }
|
||||
TLayoutDepth getDepth() const { return EldNone; }
|
||||
bool getPixelCenterInteger() const { return false; }
|
||||
void setOriginUpperLeft() { }
|
||||
bool getOriginUpperLeft() const { return true; }
|
||||
TInterlockOrdering getInterlockOrdering() const { return EioNone; }
|
||||
|
||||
bool getAutoMapBindings() const { return false; }
|
||||
bool getAutoMapLocations() const { return false; }
|
||||
int getNumPushConstants() const { return 0; }
|
||||
void addShaderRecordNVCount() { }
|
||||
void addTaskNVCount() { }
|
||||
void setUseVulkanMemoryModel() { }
|
||||
bool usingVulkanMemoryModel() const { return false; }
|
||||
bool usingPhysicalStorageBuffer() const { return false; }
|
||||
bool usingVariablePointers() const { return false; }
|
||||
#else
|
||||
void output(TInfoSink&, bool tree);
|
||||
|
||||
void setShiftBinding(TResourceType res, unsigned int shift)
|
||||
{
|
||||
shiftBinding[res] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr)
|
||||
processes.addIfNonZero(name, shift);
|
||||
}
|
||||
|
||||
unsigned int getShiftBinding(TResourceType res) const { return shiftBinding[res]; }
|
||||
|
||||
void setShiftBindingForSet(TResourceType res, unsigned int shift, unsigned int set)
|
||||
{
|
||||
if (shift == 0) // ignore if there's no shift: it's a no-op.
|
||||
return;
|
||||
|
||||
shiftBindingForSet[res][set] = shift;
|
||||
|
||||
const char* name = getResourceName(res);
|
||||
if (name != nullptr) {
|
||||
processes.addProcess(name);
|
||||
processes.addArgument(shift);
|
||||
processes.addArgument(set);
|
||||
}
|
||||
}
|
||||
|
||||
int getShiftBindingForSet(TResourceType res, unsigned int set) const
|
||||
{
|
||||
const auto shift = shiftBindingForSet[res].find(set);
|
||||
return shift == shiftBindingForSet[res].end() ? -1 : shift->second;
|
||||
}
|
||||
bool hasShiftBindingForSet(TResourceType res) const { return !shiftBindingForSet[res].empty(); }
|
||||
|
||||
void setResourceSetBinding(const std::vector<std::string>& shift)
|
||||
{
|
||||
resourceSetBinding = shift;
|
||||
if (shift.size() > 0) {
|
||||
processes.addProcess("resource-set-binding");
|
||||
for (int s = 0; s < (int)shift.size(); ++s)
|
||||
processes.addArgument(shift[s]);
|
||||
}
|
||||
}
|
||||
const std::vector<std::string>& getResourceSetBinding() const { return resourceSetBinding; }
|
||||
void setAutoMapBindings(bool map)
|
||||
{
|
||||
autoMapBindings = map;
|
||||
if (autoMapBindings)
|
||||
processes.addProcess("auto-map-bindings");
|
||||
}
|
||||
bool getAutoMapBindings() const { return autoMapBindings; }
|
||||
void setAutoMapLocations(bool map)
|
||||
{
|
||||
autoMapLocations = map;
|
||||
if (autoMapLocations)
|
||||
processes.addProcess("auto-map-locations");
|
||||
}
|
||||
bool getAutoMapLocations() const { return autoMapLocations; }
|
||||
|
||||
void setFlattenUniformArrays(bool flatten)
|
||||
{
|
||||
flattenUniformArrays = flatten;
|
||||
if (flattenUniformArrays)
|
||||
processes.addProcess("flatten-uniform-arrays");
|
||||
}
|
||||
bool getFlattenUniformArrays() const { return flattenUniformArrays; }
|
||||
void setNoStorageFormat(bool b)
|
||||
{
|
||||
useUnknownFormat = b;
|
||||
if (useUnknownFormat)
|
||||
processes.addProcess("no-storage-format");
|
||||
}
|
||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||
void setUseVulkanMemoryModel()
|
||||
{
|
||||
useVulkanMemoryModel = true;
|
||||
processes.addProcess("use-vulkan-memory-model");
|
||||
}
|
||||
bool usingVulkanMemoryModel() const { return useVulkanMemoryModel; }
|
||||
void setUsePhysicalStorageBuffer()
|
||||
{
|
||||
usePhysicalStorageBuffer = true;
|
||||
}
|
||||
bool usingPhysicalStorageBuffer() const { return usePhysicalStorageBuffer; }
|
||||
void setUseVariablePointers()
|
||||
{
|
||||
useVariablePointers = true;
|
||||
processes.addProcess("use-variable-pointers");
|
||||
}
|
||||
bool usingVariablePointers() const { return useVariablePointers; }
|
||||
|
||||
template<class T> T addCounterBufferName(const T& name) const { return name + implicitCounterName; }
|
||||
bool hasCounterBufferName(const TString& name) const {
|
||||
size_t len = strlen(implicitCounterName);
|
||||
return name.size() > len &&
|
||||
name.compare(name.size() - len, len, implicitCounterName) == 0;
|
||||
}
|
||||
|
||||
void setTextureSamplerTransformMode(EShTextureSamplerTransformMode mode) { textureSamplerTransformMode = mode; }
|
||||
int getNumPushConstants() const { return numPushConstants; }
|
||||
void addShaderRecordNVCount() { ++numShaderRecordNVBlocks; }
|
||||
void addTaskNVCount() { ++numTaskNVBlocks; }
|
||||
|
||||
bool setInvocations(int i)
|
||||
{
|
||||
if (invocations != TQualifier::layoutNotSet)
|
||||
|
|
@ -631,7 +654,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; }
|
||||
|
||||
void setXfbMode() { xfbMode = true; }
|
||||
bool getXfbMode() const { return xfbMode; }
|
||||
void setMultiStream() { multiStream = true; }
|
||||
|
|
@ -644,14 +666,10 @@ public:
|
|||
return true;
|
||||
}
|
||||
TLayoutGeometry getOutputPrimitive() const { return outputPrimitive; }
|
||||
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||
void setPostDepthCoverage() { postDepthCoverage = true; }
|
||||
bool getPostDepthCoverage() const { return postDepthCoverage; }
|
||||
void setEarlyFragmentTests() { earlyFragmentTests = true; }
|
||||
bool getEarlyFragmentTests() const { return earlyFragmentTests; }
|
||||
bool setDepth(TLayoutDepth d)
|
||||
{
|
||||
if (depthLayout != EldNone)
|
||||
|
|
@ -660,8 +678,66 @@ public:
|
|||
return true;
|
||||
}
|
||||
TLayoutDepth getDepth() const { return depthLayout; }
|
||||
void setDepthReplacing() { depthReplacing = true; }
|
||||
bool isDepthReplacing() const { return depthReplacing; }
|
||||
void setOriginUpperLeft() { originUpperLeft = true; }
|
||||
bool getOriginUpperLeft() const { return originUpperLeft; }
|
||||
void setPixelCenterInteger() { pixelCenterInteger = true; }
|
||||
bool getPixelCenterInteger() const { return pixelCenterInteger; }
|
||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||
unsigned int getBlendEquations() const { return blendEquations; }
|
||||
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||
{
|
||||
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
|
||||
return xfbBuffers[buffer].stride == stride;
|
||||
xfbBuffers[buffer].stride = stride;
|
||||
return true;
|
||||
}
|
||||
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
||||
int addXfbBufferOffset(const TType&);
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
|
||||
void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; }
|
||||
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
|
||||
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
|
||||
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
||||
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
||||
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
||||
bool setPrimitives(int m)
|
||||
{
|
||||
if (primitives != TQualifier::layoutNotSet)
|
||||
return primitives == m;
|
||||
primitives = m;
|
||||
return true;
|
||||
}
|
||||
int getPrimitives() const { return primitives; }
|
||||
const char* addSemanticName(const TString& name)
|
||||
{
|
||||
return semanticNameSet.insert(name).first->c_str();
|
||||
}
|
||||
void addUniformLocationOverride(const char* nameStr, int location)
|
||||
{
|
||||
std::string name = nameStr;
|
||||
uniformLocationOverrides[name] = location;
|
||||
}
|
||||
|
||||
int getUniformLocationOverride(const char* nameStr) const
|
||||
{
|
||||
std::string name = nameStr;
|
||||
auto pos = uniformLocationOverrides.find(name);
|
||||
if (pos == uniformLocationOverrides.end())
|
||||
return -1;
|
||||
else
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
void setUniformLocationBase(int base) { uniformLocationBase = base; }
|
||||
int getUniformLocationBase() const { return uniformLocationBase; }
|
||||
|
||||
void setNeedsLegalization() { needToLegalize = true; }
|
||||
bool needsLegalization() const { return needToLegalize; }
|
||||
|
||||
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
||||
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_HLSL
|
||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
||||
|
|
@ -686,9 +762,6 @@ public:
|
|||
bool usingHlslIoMapping() { return false; }
|
||||
#endif
|
||||
|
||||
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||
unsigned int getBlendEquations() const { return blendEquations; }
|
||||
|
||||
void addToCallGraph(TInfoSink&, const TString& caller, const TString& callee);
|
||||
void merge(TInfoSink&, TIntermediate&);
|
||||
void finalCheck(TInfoSink&, bool keepUncalled);
|
||||
|
|
@ -703,19 +776,6 @@ public:
|
|||
static int computeTypeLocationSize(const TType&, EShLanguage);
|
||||
static int computeTypeUniformLocationSize(const TType&);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
bool setXfbBufferStride(int buffer, unsigned stride)
|
||||
{
|
||||
if (xfbBuffers[buffer].stride != TQualifier::layoutXfbStrideEnd)
|
||||
return xfbBuffers[buffer].stride == stride;
|
||||
xfbBuffers[buffer].stride = stride;
|
||||
return true;
|
||||
}
|
||||
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
||||
int addXfbBufferOffset(const TType&);
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType, bool& contains32BitType, bool& contains16BitType) const;
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
|
||||
#endif
|
||||
static int getBaseAlignmentScalar(const TType&, int& size);
|
||||
static int getBaseAlignment(const TType&, int& size, int& stride, TLayoutPacking layoutPacking, bool rowMajor);
|
||||
static int getScalarAlignment(const TType&, int& size, int& stride, bool rowMajor);
|
||||
|
|
@ -726,28 +786,8 @@ public:
|
|||
static int getBlockSize(const TType& blockType);
|
||||
static int computeBufferReferenceTypeSize(const TType&);
|
||||
bool promote(TIntermOperator*);
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
void setLayoutOverrideCoverage() { layoutOverrideCoverage = true; }
|
||||
bool getLayoutOverrideCoverage() const { return layoutOverrideCoverage; }
|
||||
void setGeoPassthroughEXT() { geoPassthroughEXT = true; }
|
||||
bool getGeoPassthroughEXT() const { return geoPassthroughEXT; }
|
||||
void setLayoutDerivativeMode(ComputeDerivativeMode mode) { computeDerivativeMode = mode; }
|
||||
ComputeDerivativeMode getLayoutDerivativeModeNone() const { return computeDerivativeMode; }
|
||||
bool setPrimitives(int m)
|
||||
{
|
||||
if (primitives != TQualifier::layoutNotSet)
|
||||
return primitives == m;
|
||||
primitives = m;
|
||||
return true;
|
||||
}
|
||||
int getPrimitives() const { return primitives; }
|
||||
#endif
|
||||
|
||||
const char* addSemanticName(const TString& name)
|
||||
{
|
||||
return semanticNameSet.insert(name).first->c_str();
|
||||
}
|
||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
||||
|
||||
void setSourceFile(const char* file) { if (file != nullptr) sourceFile = file; }
|
||||
const std::string& getSourceFile() const { return sourceFile; }
|
||||
|
|
@ -764,37 +804,6 @@ public:
|
|||
void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
|
||||
const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
|
||||
|
||||
void addUniformLocationOverride(const char* nameStr, int location)
|
||||
{
|
||||
std::string name = nameStr;
|
||||
uniformLocationOverrides[name] = location;
|
||||
}
|
||||
|
||||
int getUniformLocationOverride(const char* nameStr) const
|
||||
{
|
||||
std::string name = nameStr;
|
||||
auto pos = uniformLocationOverrides.find(name);
|
||||
if (pos == uniformLocationOverrides.end())
|
||||
return -1;
|
||||
else
|
||||
return pos->second;
|
||||
}
|
||||
|
||||
void setUniformLocationBase(int base) { uniformLocationBase = base; }
|
||||
int getUniformLocationBase() const { return uniformLocationBase; }
|
||||
|
||||
void setNanMinMaxClamp(bool setting) { nanMinMaxClamp = setting; }
|
||||
bool getNanMinMaxClamp() const { return nanMinMaxClamp; }
|
||||
|
||||
void setNeedsLegalization() { needToLegalize = true; }
|
||||
bool needsLegalization() const { return needToLegalize; }
|
||||
|
||||
void setBinaryDoubleOutput() { binaryDoubleOutput = true; }
|
||||
bool getBinaryDoubleOutput() { return binaryDoubleOutput; }
|
||||
|
||||
const char* const implicitThisName;
|
||||
const char* const implicitCounterName;
|
||||
|
||||
// Certain explicit conversions are allowed conditionally
|
||||
#ifdef GLSLANG_WEB
|
||||
bool getArithemeticInt8Enabled() const { return false; }
|
||||
|
|
@ -849,19 +858,25 @@ protected:
|
|||
bool isConversionAllowed(TOperator op, TIntermTyped* node) const;
|
||||
TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const;
|
||||
std::tuple<TBasicType, TBasicType> getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const;
|
||||
#ifdef GLSLANG_WEB
|
||||
bool extensionRequested(const char *extension) const { return false; }
|
||||
#else
|
||||
// I think this function should go away.
|
||||
|
||||
// JohnK: I think this function should go away.
|
||||
// This data structure is just a log to pass on to back ends.
|
||||
// Versioning and extensions are handled in Version.cpp, with a rich
|
||||
// set of functions for querying stages, versions, extension enable/disabled, etc.
|
||||
#ifdef GLSLANG_WEB
|
||||
bool extensionRequested(const char *extension) const { return false; }
|
||||
#else
|
||||
bool extensionRequested(const char *extension) const {return requestedExtensions.find(extension) != requestedExtensions.end();}
|
||||
#endif
|
||||
|
||||
static const char* getResourceName(TResourceType);
|
||||
|
||||
const EShLanguage language; // stage, known at construction time
|
||||
#ifdef ENABLE_HLSL
|
||||
public:
|
||||
const char* const implicitThisName;
|
||||
const char* const implicitCounterName;
|
||||
protected:
|
||||
EShSource source; // source language, known a bit later
|
||||
#endif
|
||||
std::string entryPointName;
|
||||
|
|
@ -879,6 +894,12 @@ protected:
|
|||
int numErrors;
|
||||
int numPushConstants;
|
||||
bool recursive;
|
||||
bool invertY;
|
||||
bool useStorageBuffer;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
bool depthReplacing;
|
||||
#ifndef GLSLANG_WEB
|
||||
bool useVulkanMemoryModel;
|
||||
int invocations;
|
||||
int vertices;
|
||||
TLayoutGeometry inputPrimitive;
|
||||
|
|
@ -894,21 +915,17 @@ protected:
|
|||
bool earlyFragmentTests;
|
||||
bool postDepthCoverage;
|
||||
TLayoutDepth depthLayout;
|
||||
bool depthReplacing;
|
||||
bool hlslFunctionality1;
|
||||
int blendEquations; // an 'or'ing of masks of shifts of TBlendEquationShift
|
||||
bool xfbMode;
|
||||
std::vector<TXfbBuffer> xfbBuffers; // all the data we need to track per xfb buffer
|
||||
bool multiStream;
|
||||
|
||||
#ifndef GLSLANG_WEB
|
||||
bool layoutOverrideCoverage;
|
||||
bool geoPassthroughEXT;
|
||||
int numShaderRecordNVBlocks;
|
||||
ComputeDerivativeMode computeDerivativeMode;
|
||||
int primitives;
|
||||
int numTaskNVBlocks;
|
||||
#endif
|
||||
|
||||
// Base shift values
|
||||
std::array<unsigned int, EResCount> shiftBinding;
|
||||
|
|
@ -919,23 +936,29 @@ protected:
|
|||
std::vector<std::string> resourceSetBinding;
|
||||
bool autoMapBindings;
|
||||
bool autoMapLocations;
|
||||
bool invertY;
|
||||
bool flattenUniformArrays;
|
||||
bool useUnknownFormat;
|
||||
bool hlslOffsets;
|
||||
bool useStorageBuffer;
|
||||
bool useVulkanMemoryModel;
|
||||
bool hlslIoMapping;
|
||||
bool useVariablePointers;
|
||||
|
||||
std::set<TString> ioAccessed; // set of names of statically read/written I/O that might need extra checking
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::set<TString> semanticNameSet;
|
||||
|
||||
EShTextureSamplerTransformMode textureSamplerTransformMode;
|
||||
|
||||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||
int uniformLocationBase;
|
||||
#endif
|
||||
|
||||
std::unordered_set<int> usedConstantId; // specialization constant ids used
|
||||
std::vector<TOffsetRange> usedAtomics; // sets of bindings used by atomic counters
|
||||
std::vector<TIoRange> usedIo[4]; // sets of used locations, one for each of in, out, uniform, and buffers
|
||||
// set of names of statically read/written I/O that might need extra checking
|
||||
std::set<TString> ioAccessed;
|
||||
// source code of shader, useful as part of debug information
|
||||
std::string sourceFile;
|
||||
std::string sourceText;
|
||||
|
|
@ -946,14 +969,6 @@ protected:
|
|||
// for OpModuleProcessed, or equivalent
|
||||
TProcesses processes;
|
||||
|
||||
bool needToLegalize;
|
||||
bool binaryDoubleOutput;
|
||||
bool usePhysicalStorageBuffer;
|
||||
|
||||
std::unordered_map<std::string, int> uniformLocationOverrides;
|
||||
int uniformLocationBase;
|
||||
bool nanMinMaxClamp; // true if desiring min/max/clamp to favor non-NaN over NaN
|
||||
|
||||
private:
|
||||
void operator=(TIntermediate&); // prevent assignments
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue