SPV: Fix #807: use --hlsl-offsets to allow hlsl-style offsets in a buffer.
Corresponds to the EShMsgHlslOffsets flag in messages. Works for both GLSL and HLSL.
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1974"
|
||||
#define GLSLANG_DATE "04-Apr-2017"
|
||||
#define GLSLANG_REVISION "Overload400-PrecQual.1978"
|
||||
#define GLSLANG_DATE "05-Apr-2017"
|
||||
|
||||
@@ -726,6 +726,8 @@ bool ProcessDeferred(
|
||||
intermediate.setSpv(spvVersion);
|
||||
if (spvVersion.vulkan >= 100)
|
||||
intermediate.setOriginUpperLeft();
|
||||
if (messages & EShMsgHlslOffsets) // source-language independent
|
||||
intermediate.setHlslOffsets();
|
||||
SetupBuiltinSymbolTable(version, profile, spvVersion, source);
|
||||
|
||||
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
|
||||
|
||||
@@ -1047,9 +1047,9 @@ unsigned int TIntermediate::computeTypeXfbSize(const TType& type, bool& contains
|
||||
|
||||
const int baseAlignmentVec4Std140 = 16;
|
||||
|
||||
// Return the size and alignment of a scalar.
|
||||
// Return the size and alignment of a component of the given type.
|
||||
// The size is returned in the 'size' parameter
|
||||
// Return value is the alignment of the type.
|
||||
// Return value is the alignment..
|
||||
int TIntermediate::getBaseAlignmentScalar(const TType& type, int& size)
|
||||
{
|
||||
switch (type.getBasicType()) {
|
||||
@@ -1219,4 +1219,14 @@ int TIntermediate::getBaseAlignment(const TType& type, int& size, int& stride, b
|
||||
return baseAlignmentVec4Std140;
|
||||
}
|
||||
|
||||
// To aid the basic HLSL rule about crossing vec4 boundaries.
|
||||
bool TIntermediate::improperStraddle(const TType& type, int size, int offset)
|
||||
{
|
||||
if (! type.isVector() || type.isArray())
|
||||
return false;
|
||||
|
||||
return size <= 16 ? offset / 16 != (offset + size - 1) / 16
|
||||
: offset % 16 != 0;
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
@@ -177,7 +177,8 @@ public:
|
||||
shiftSsboBinding(0),
|
||||
autoMapBindings(false),
|
||||
flattenUniformArrays(false),
|
||||
useUnknownFormat(false)
|
||||
useUnknownFormat(false),
|
||||
hlslOffsets(false)
|
||||
{
|
||||
localSize[0] = 1;
|
||||
localSize[1] = 1;
|
||||
@@ -216,6 +217,8 @@ public:
|
||||
bool getFlattenUniformArrays() const { return flattenUniformArrays; }
|
||||
void setNoStorageFormat(bool b) { useUnknownFormat = b; }
|
||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||
void setHlslOffsets() { hlslOffsets = true; }
|
||||
bool usingHlslOFfsets() const { return hlslOffsets; }
|
||||
|
||||
void setVersion(int v) { version = v; }
|
||||
int getVersion() const { return version; }
|
||||
@@ -413,7 +416,9 @@ public:
|
||||
}
|
||||
int addXfbBufferOffset(const TType&);
|
||||
unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const;
|
||||
static int getBaseAlignmentScalar(const TType&, int& size);
|
||||
static int getBaseAlignment(const TType&, int& size, int& stride, bool std140, bool rowMajor);
|
||||
static bool improperStraddle(const TType& type, int size, int offset);
|
||||
bool promote(TIntermOperator*);
|
||||
|
||||
#ifdef NV_EXTENSIONS
|
||||
@@ -443,7 +448,6 @@ protected:
|
||||
void inOutLocationCheck(TInfoSink&);
|
||||
TIntermSequence& findLinkerObjects() const;
|
||||
bool userOutputUsed() const;
|
||||
static int getBaseAlignmentScalar(const TType&, int& size);
|
||||
bool isSpecializationOperation(const TIntermOperator&) const;
|
||||
bool promoteUnary(TIntermUnary&);
|
||||
bool promoteBinary(TIntermBinary&);
|
||||
@@ -499,6 +503,7 @@ protected:
|
||||
bool autoMapBindings;
|
||||
bool flattenUniformArrays;
|
||||
bool useUnknownFormat;
|
||||
bool hlslOffsets;
|
||||
|
||||
typedef std::list<TCall> TGraph;
|
||||
TGraph callGraph;
|
||||
|
||||
@@ -147,6 +147,7 @@ enum EShMessages {
|
||||
EShMsgReadHlsl = (1 << 6), // use HLSL parsing rules and semantics
|
||||
EShMsgCascadingErrors = (1 << 7), // get cascading errors; risks error-recovery issues, instead of an early exit
|
||||
EShMsgKeepUncalled = (1 << 8), // for testing, don't eliminate uncalled functions
|
||||
EShMsgHlslOffsets = (1 << 9), // allow block offsets to follow HLSL rules instead of GLSL rules
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user