[glslang] Refine implicit array size interfaces. (#3074)
* [glslang] Refine implicit array size interfaces. Help to check builtin and other variables if across stages.
This commit is contained in:
parent
c6b3f279a7
commit
f9b760e6c7
14 changed files with 528 additions and 7 deletions
|
|
@ -222,7 +222,7 @@ protected:
|
|||
struct TArraySizes {
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
||||
TArraySizes() : implicitArraySize(1), variablyIndexed(false) { }
|
||||
TArraySizes() : implicitArraySize(0), implicitlySized(true), variablyIndexed(false){ }
|
||||
|
||||
// For breaking into two non-shared copies, independently modifiable.
|
||||
TArraySizes& operator=(const TArraySizes& from)
|
||||
|
|
@ -230,6 +230,7 @@ struct TArraySizes {
|
|||
implicitArraySize = from.implicitArraySize;
|
||||
variablyIndexed = from.variablyIndexed;
|
||||
sizes = from.sizes;
|
||||
implicitlySized = from.implicitlySized;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -256,11 +257,17 @@ struct TArraySizes {
|
|||
void addInnerSize(int s, TIntermTyped* n) { sizes.push_back((unsigned)s, n); }
|
||||
void addInnerSize(TArraySize pair) {
|
||||
sizes.push_back(pair.size, pair.node);
|
||||
implicitlySized = false;
|
||||
}
|
||||
void addInnerSizes(const TArraySizes& s) { sizes.push_back(s.sizes); }
|
||||
void changeOuterSize(int s) { sizes.changeFront((unsigned)s); }
|
||||
int getImplicitSize() const { return implicitArraySize; }
|
||||
void updateImplicitSize(int s) { implicitArraySize = std::max(implicitArraySize, s); }
|
||||
void changeOuterSize(int s) {
|
||||
sizes.changeFront((unsigned)s);
|
||||
implicitlySized = false;
|
||||
}
|
||||
int getImplicitSize() const { return implicitArraySize > 0 ? implicitArraySize : 1; }
|
||||
void updateImplicitSize(int s) {
|
||||
implicitArraySize = (std::max)(implicitArraySize, s);
|
||||
}
|
||||
bool isInnerUnsized() const
|
||||
{
|
||||
for (int d = 1; d < sizes.size(); ++d) {
|
||||
|
|
@ -295,6 +302,9 @@ struct TArraySizes {
|
|||
|
||||
bool hasUnsized() const { return getOuterSize() == UnsizedArraySize || isInnerUnsized(); }
|
||||
bool isSized() const { return getOuterSize() != UnsizedArraySize; }
|
||||
bool isImplicitlySized() const { return implicitlySized; }
|
||||
bool isDefaultImplicitlySized() const { return implicitlySized && implicitArraySize == 0; }
|
||||
void setImplicitlySized(bool isImplicitSizing) { implicitlySized = isImplicitSizing; }
|
||||
void dereference() { sizes.pop_front(); }
|
||||
void copyDereferenced(const TArraySizes& rhs)
|
||||
{
|
||||
|
|
@ -333,6 +343,7 @@ protected:
|
|||
// the implicit size of the array, if not variably indexed and
|
||||
// otherwise legal.
|
||||
int implicitArraySize;
|
||||
bool implicitlySized;
|
||||
bool variablyIndexed; // true if array is indexed with a non compile-time constant
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue