Updated glslang.
This commit is contained in:
parent
38f97c28cf
commit
7d149d9105
2
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
Normal file → Executable file
2
3rdparty/glslang/SPIRV/GlslangToSpv.cpp
vendored
Normal file → Executable file
@ -3232,7 +3232,7 @@ spv::Id TGlslangToSpvTraverser::convertGlslangStructToSpvType(const glslang::TTy
|
||||
// Decorate it
|
||||
decorateStructType(type, glslangMembers, explicitLayout, qualifier, spvType);
|
||||
|
||||
for (int i = 0; i < deferredForwardPointers.size(); ++i) {
|
||||
for (int i = 0; i < (int)deferredForwardPointers.size(); ++i) {
|
||||
auto it = deferredForwardPointers[i];
|
||||
convertGlslangToSpvType(*it.first, explicitLayout, it.second, false);
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ Linked vertex stage:
|
||||
ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
|
||||
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
|
||||
ERROR: xfb_buffer 0, xfb_stride 92, minimum stride needed: 96
|
||||
ERROR: Linking vertex stage: xfb_stride must be multiple of 8 for buffer holding a double:
|
||||
ERROR: Linking vertex stage: xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:
|
||||
ERROR: xfb_buffer 0, xfb_stride 92
|
||||
ERROR: Linking vertex stage: xfb_stride must be multiple of 4:
|
||||
ERROR: xfb_buffer 5, xfb_stride 6
|
||||
|
3
3rdparty/glslang/glslang/Include/Common.h
vendored
3
3rdparty/glslang/glslang/Include/Common.h
vendored
@ -250,7 +250,8 @@ struct TSourceLoc {
|
||||
return nullptr;
|
||||
return name->c_str();
|
||||
}
|
||||
TString* name; // descriptive name for this string
|
||||
const char* getFilenameStr() const { return name == nullptr ? "" : name->c_str(); }
|
||||
TString* name; // descriptive name for this string, when a textual name is available, otherwise nullptr
|
||||
int string;
|
||||
int line;
|
||||
int column;
|
||||
|
@ -5062,7 +5062,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
||||
if (! IsPow2(value))
|
||||
error(loc, "must be a power of 2", "buffer_reference_align", "");
|
||||
else
|
||||
publicType.qualifier.layoutBufferReferenceAlign = std::log2(value);
|
||||
publicType.qualifier.layoutBufferReferenceAlign = (unsigned int)std::log2(value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7270,12 +7270,12 @@ void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
|
||||
int nextOffset = qualifier.layoutXfbOffset;
|
||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
||||
bool containsDouble = false;
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, containsDouble);
|
||||
bool contains64BitType = false;
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType);
|
||||
// see if we need to auto-assign an offset to this member
|
||||
if (! memberQualifier.hasXfbOffset()) {
|
||||
// "if applied to an aggregate containing a double, the offset must also be a multiple of 8"
|
||||
if (containsDouble)
|
||||
// "if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8"
|
||||
if (contains64BitType)
|
||||
RoundToPow2(nextOffset, 8);
|
||||
memberQualifier.layoutXfbOffset = nextOffset;
|
||||
} else
|
||||
|
@ -222,8 +222,8 @@ void TIntermediate::mergeModes(TInfoSink& infoSink, TIntermediate& unit)
|
||||
else if (xfbBuffers[b].stride != unit.xfbBuffers[b].stride)
|
||||
error(infoSink, "Contradictory xfb_stride");
|
||||
xfbBuffers[b].implicitStride = std::max(xfbBuffers[b].implicitStride, unit.xfbBuffers[b].implicitStride);
|
||||
if (unit.xfbBuffers[b].containsDouble)
|
||||
xfbBuffers[b].containsDouble = true;
|
||||
if (unit.xfbBuffers[b].contains64BitType)
|
||||
xfbBuffers[b].contains64BitType = true;
|
||||
// TODO: 4.4 link: enhanced layouts: compare ranges
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||
error(infoSink, "Cannot use both gl_FragColor and gl_FragData");
|
||||
|
||||
for (size_t b = 0; b < xfbBuffers.size(); ++b) {
|
||||
if (xfbBuffers[b].containsDouble)
|
||||
if (xfbBuffers[b].contains64BitType)
|
||||
RoundToPow2(xfbBuffers[b].implicitStride, 8);
|
||||
|
||||
// "It is a compile-time or link-time error to have
|
||||
@ -650,10 +650,10 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||
xfbBuffers[b].stride = xfbBuffers[b].implicitStride;
|
||||
|
||||
// "If the buffer is capturing any
|
||||
// outputs with double-precision components, the stride must be a multiple of 8, otherwise it must be a
|
||||
// outputs with double-precision or 64-bit integer components, the stride must be a multiple of 8, otherwise it must be a
|
||||
// multiple of 4, or a compile-time or link-time error results."
|
||||
if (xfbBuffers[b].containsDouble && ! IsMultipleOfPow2(xfbBuffers[b].stride, 8)) {
|
||||
error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double:");
|
||||
if (xfbBuffers[b].contains64BitType && ! IsMultipleOfPow2(xfbBuffers[b].stride, 8)) {
|
||||
error(infoSink, "xfb_stride must be multiple of 8 for buffer holding a double or 64-bit integer:");
|
||||
infoSink.info.prefix(EPrefixError);
|
||||
infoSink.info << " xfb_buffer " << (unsigned int)b << ", xfb_stride " << xfbBuffers[b].stride << "\n";
|
||||
} else if (! IsMultipleOfPow2(xfbBuffers[b].stride, 4)) {
|
||||
@ -1260,7 +1260,7 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
|
||||
TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer];
|
||||
|
||||
// compute the range
|
||||
unsigned int size = computeTypeXfbSize(type, buffer.containsDouble);
|
||||
unsigned int size = computeTypeXfbSize(type, buffer.contains64BitType);
|
||||
buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size);
|
||||
TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1);
|
||||
|
||||
@ -1279,11 +1279,11 @@ int TIntermediate::addXfbBufferOffset(const TType& type)
|
||||
|
||||
// Recursively figure out how many bytes of xfb buffer are used by the given type.
|
||||
// Return the size of type, in bytes.
|
||||
// Sets containsDouble to true if the type contains a double.
|
||||
// N.B. Caller must set containsDouble to false before calling.
|
||||
unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& containsDouble) const
|
||||
// Sets contains64BitType to true if the type contains a double.
|
||||
// N.B. Caller must set contains64BitType to false before calling.
|
||||
unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains64BitType) const
|
||||
{
|
||||
// "...if applied to an aggregate containing a double, the offset must also be a multiple of 8,
|
||||
// "...if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
|
||||
// and the space taken in the buffer will be a multiple of 8.
|
||||
// ...within the qualified entity, subsequent components are each
|
||||
// assigned, in order, to the next available offset aligned to a multiple of
|
||||
@ -1294,28 +1294,28 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
||||
// TODO: perf: this can be flattened by using getCumulativeArraySize(), and a deref that discards all arrayness
|
||||
assert(type.isSizedArray());
|
||||
TType elementType(type, 0);
|
||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, containsDouble);
|
||||
return type.getOuterArraySize() * computeTypeXfbSize(elementType, contains64BitType);
|
||||
}
|
||||
|
||||
if (type.isStruct()) {
|
||||
unsigned int size = 0;
|
||||
bool structContainsDouble = false;
|
||||
bool structContains64BitType = false;
|
||||
for (int member = 0; member < (int)type.getStruct()->size(); ++member) {
|
||||
TType memberType(type, member);
|
||||
// "... if applied to
|
||||
// an aggregate containing a double, the offset must also be a multiple of 8,
|
||||
// an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8,
|
||||
// and the space taken in the buffer will be a multiple of 8."
|
||||
bool memberContainsDouble = false;
|
||||
int memberSize = computeTypeXfbSize(memberType, memberContainsDouble);
|
||||
if (memberContainsDouble) {
|
||||
structContainsDouble = true;
|
||||
bool memberContains64BitType = false;
|
||||
int memberSize = computeTypeXfbSize(memberType, memberContains64BitType);
|
||||
if (memberContains64BitType) {
|
||||
structContains64BitType = true;
|
||||
RoundToPow2(size, 8);
|
||||
}
|
||||
size += memberSize;
|
||||
}
|
||||
|
||||
if (structContainsDouble) {
|
||||
containsDouble = true;
|
||||
if (structContains64BitType) {
|
||||
contains64BitType = true;
|
||||
RoundToPow2(size, 8);
|
||||
}
|
||||
return size;
|
||||
@ -1333,8 +1333,8 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
||||
numComponents = 1;
|
||||
}
|
||||
|
||||
if (type.getBasicType() == EbtDouble) {
|
||||
containsDouble = true;
|
||||
if (type.getBasicType() == EbtDouble || type.getBasicType() == EbtInt64 || type.getBasicType() == EbtUint64) {
|
||||
contains64BitType = true;
|
||||
return 8 * numComponents;
|
||||
} else
|
||||
return 4 * numComponents;
|
||||
|
@ -149,11 +149,11 @@ struct TOffsetRange {
|
||||
|
||||
// Things that need to be tracked per xfb buffer.
|
||||
struct TXfbBuffer {
|
||||
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), containsDouble(false) { }
|
||||
TXfbBuffer() : stride(TQualifier::layoutXfbStrideEnd), implicitStride(0), contains64BitType(false) { }
|
||||
std::vector<TRange> ranges; // byte offsets that have already been assigned
|
||||
unsigned int stride;
|
||||
unsigned int implicitStride;
|
||||
bool containsDouble;
|
||||
bool contains64BitType;
|
||||
};
|
||||
|
||||
// Track a set of strings describing how the module was processed.
|
||||
@ -640,7 +640,7 @@ public:
|
||||
}
|
||||
unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; }
|
||||
int addXfbBufferOffset(const TType&);
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const;
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& contains64BitType) const;
|
||||
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);
|
||||
|
6
3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h
vendored
Executable file → Normal file
6
3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h
vendored
Executable file → Normal file
@ -549,9 +549,9 @@ protected:
|
||||
scanner.setLine(startLoc.line);
|
||||
scanner.setString(startLoc.string);
|
||||
|
||||
scanner.setFile(startLoc.name->c_str(), 0);
|
||||
scanner.setFile(startLoc.name->c_str(), 1);
|
||||
scanner.setFile(startLoc.name->c_str(), 2);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 0);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 1);
|
||||
scanner.setFile(startLoc.getFilenameStr(), 2);
|
||||
}
|
||||
|
||||
// tInput methods:
|
||||
|
15
3rdparty/glslang/hlsl/hlslParseHelper.cpp
vendored
Executable file → Normal file
15
3rdparty/glslang/hlsl/hlslParseHelper.cpp
vendored
Executable file → Normal file
@ -39,6 +39,7 @@
|
||||
#include "hlslGrammar.h"
|
||||
#include "hlslAttributes.h"
|
||||
|
||||
#include "../glslang/Include/Common.h"
|
||||
#include "../glslang/MachineIndependent/Scan.h"
|
||||
#include "../glslang/MachineIndependent/preprocessor/PpContext.h"
|
||||
|
||||
@ -133,7 +134,7 @@ bool HlslParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner&
|
||||
// Print a message formated such that if you click on the message it will take you right to
|
||||
// the line through most UIs.
|
||||
const glslang::TSourceLoc& sourceLoc = input.getSourceLoc();
|
||||
infoSink.info << sourceLoc.name->c_str() << "(" << sourceLoc.line << "): error at column " << sourceLoc.column
|
||||
infoSink.info << sourceLoc.getFilenameStr() << "(" << sourceLoc.line << "): error at column " << sourceLoc.column
|
||||
<< ", HLSL parsing failed.\n";
|
||||
++numErrors;
|
||||
return false;
|
||||
@ -3129,7 +3130,7 @@ TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc
|
||||
if (textureShadowEntry != textureShadowVariant.end())
|
||||
newId = textureShadowEntry->second->get(shadowMode);
|
||||
else
|
||||
textureShadowVariant[texSymbol->getId()] = new tShadowTextureSymbols;
|
||||
textureShadowVariant[texSymbol->getId()] = NewPoolObject(tShadowTextureSymbols(), 1);
|
||||
|
||||
// Sometimes we have to create another symbol (if this texture has been seen before,
|
||||
// and we haven't created the form for this shadow mode).
|
||||
@ -3208,7 +3209,7 @@ void HlslParseContext::declareStructBufferCounter(const TSourceLoc& loc, const T
|
||||
TType blockType;
|
||||
counterBufferType(loc, blockType);
|
||||
|
||||
TString* blockName = new TString(intermediate.addCounterBufferName(name));
|
||||
TString* blockName = NewPoolTString(intermediate.addCounterBufferName(name).c_str());
|
||||
|
||||
// Counter buffer is not yet in use
|
||||
structBufferCounter[*blockName] = false;
|
||||
@ -8697,12 +8698,12 @@ void HlslParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
|
||||
int nextOffset = qualifier.layoutXfbOffset;
|
||||
for (unsigned int member = 0; member < typeList.size(); ++member) {
|
||||
TQualifier& memberQualifier = typeList[member].type->getQualifier();
|
||||
bool containsDouble = false;
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, containsDouble);
|
||||
bool contains64BitType = false;
|
||||
int memberSize = intermediate.computeTypeXfbSize(*typeList[member].type, contains64BitType);
|
||||
// see if we need to auto-assign an offset to this member
|
||||
if (! memberQualifier.hasXfbOffset()) {
|
||||
// "if applied to an aggregate containing a double, the offset must also be a multiple of 8"
|
||||
if (containsDouble)
|
||||
// "if applied to an aggregate containing a double or 64-bit integer, the offset must also be a multiple of 8"
|
||||
if (contains64BitType)
|
||||
RoundToPow2(nextOffset, 8);
|
||||
memberQualifier.layoutXfbOffset = nextOffset;
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user