HLSL: Fix #1976: Don't let ENABLE_HLSL change struct/class layout.
This commit is contained in:
parent
37dcb89457
commit
3c0d2e5b67
12 changed files with 34 additions and 40 deletions
|
|
@ -80,27 +80,13 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
bool image : 1; // image, combined should be false
|
||||
bool combined : 1; // true means texture is combined with a sampler, false means texture with no sampler
|
||||
bool sampler : 1; // true means a pure sampler, other fields should be clear()
|
||||
#ifdef ENABLE_HLSL
|
||||
unsigned int vectorSize : 3; // vector return type size.
|
||||
unsigned int getVectorSize() const { return vectorSize; }
|
||||
void clearReturnStruct() { structReturnIndex = noReturnStruct; }
|
||||
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
|
||||
unsigned getStructReturnIndex() const { return structReturnIndex; }
|
||||
|
||||
static const unsigned structReturnIndexBits = 4; // number of index bits to use.
|
||||
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
|
||||
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
|
||||
|
||||
// Index into a language specific table of texture return structures.
|
||||
unsigned int structReturnIndex : structReturnIndexBits;
|
||||
#else
|
||||
#ifdef GLSLANG_WEB
|
||||
unsigned int getVectorSize() const { return 4; }
|
||||
void clearReturnStruct() const { }
|
||||
bool hasReturnStruct() const { return false; }
|
||||
unsigned getStructReturnIndex() const { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef GLSLANG_WEB
|
||||
bool is1D() const { return false; }
|
||||
bool isBuffer() const { return false; }
|
||||
bool isRect() const { return false; }
|
||||
|
|
@ -113,10 +99,22 @@ struct TSampler { // misnomer now; includes images, textures without sampler,
|
|||
void setExternal(bool e) { }
|
||||
bool isYuv() const { return false; }
|
||||
#else
|
||||
bool external : 1; // GL_OES_EGL_image_external
|
||||
bool yuv : 1; // GL_EXT_YUV_target
|
||||
unsigned int vectorSize : 3; // vector return type size.
|
||||
// Some languages support structures as sample results. Storing the whole structure in the
|
||||
// TSampler is too large, so there is an index to a separate table.
|
||||
static const unsigned structReturnIndexBits = 4; // number of index bits to use.
|
||||
static const unsigned structReturnSlots = (1<<structReturnIndexBits)-1; // number of valid values
|
||||
static const unsigned noReturnStruct = structReturnSlots; // value if no return struct type.
|
||||
// Index into a language specific table of texture return structures.
|
||||
unsigned int structReturnIndex : structReturnIndexBits;
|
||||
|
||||
bool external : 1; // GL_OES_EGL_image_external
|
||||
bool yuv : 1; // GL_EXT_YUV_target
|
||||
|
||||
unsigned int getVectorSize() const { return vectorSize; }
|
||||
void clearReturnStruct() { structReturnIndex = noReturnStruct; }
|
||||
bool hasReturnStruct() const { return structReturnIndex != noReturnStruct; }
|
||||
unsigned getStructReturnIndex() const { return structReturnIndex; }
|
||||
|
||||
bool is1D() const { return dim == Esd1D; }
|
||||
bool isBuffer() const { return dim == EsdBuffer; }
|
||||
|
|
|
|||
|
|
@ -1223,7 +1223,7 @@ public:
|
|||
// it is essential to use "symbol = sym" to assign to symbol
|
||||
TIntermSymbol(int i, const TString& n, const TType& t)
|
||||
: TIntermTyped(t), id(i),
|
||||
#ifdef ENABLE_HLSL
|
||||
#ifndef GLSLANG_WEB
|
||||
flattenSubset(-1),
|
||||
#endif
|
||||
constSubtree(nullptr)
|
||||
|
|
@ -1238,7 +1238,7 @@ public:
|
|||
const TConstUnionArray& getConstArray() const { return constArray; }
|
||||
void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; }
|
||||
TIntermTyped* getConstSubtree() const { return constSubtree; }
|
||||
#ifdef ENABLE_HLSL
|
||||
#ifndef GLSLANG_WEB
|
||||
void setFlattenSubset(int subset) { flattenSubset = subset; }
|
||||
int getFlattenSubset() const { return flattenSubset; } // -1 means full object
|
||||
#endif
|
||||
|
|
@ -1249,7 +1249,7 @@ public:
|
|||
|
||||
protected:
|
||||
int id; // the unique id of the symbol this node represents
|
||||
#ifdef ENABLE_HLSL
|
||||
#ifndef GLSLANG_WEB
|
||||
int flattenSubset; // how deeply the flattened object rooted at id has been dereferenced
|
||||
#endif
|
||||
TString name; // the name of the symbol this node represents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue