GL_ARB_enhanced_layouts, part 5: uniform offset and align semantics. Numerical computations not yet done.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25092 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-01-28 21:13:59 +00:00
parent 255df5760a
commit 04b1c6ed4c
12 changed files with 243 additions and 46 deletions

View file

@ -186,17 +186,22 @@ typedef TMap<TString, TString>::tAllocator TPragmaTableAllocator;
const int GlslangMaxTokenLength = 1024;
template <class T> bool IsPow2(T powerOf2)
{
return (powerOf2 & (powerOf2 - 1)) == 0;
}
// Round number up to a multiple of the given powerOf2, which is not
// a power, just a number that must be a power of 2.
template <class T> void RoundToPow2(T& number, int powerOf2)
{
assert((powerOf2 & (powerOf2 - 1)) == 0);
assert(IsPow2(powerOf2));
number = (number + powerOf2 - 1) & ~(powerOf2 - 1);
}
template <class T> bool IsMultipleOfPow2(T number, int powerOf2)
{
assert((powerOf2 & (powerOf2 - 1)) == 0);
assert(IsPow2(powerOf2));
return ! (number & (powerOf2 - 1));
}

View file

@ -401,10 +401,26 @@ public:
bool hasUniformLayout() const
{
return layoutMatrix != ElmNone ||
layoutPacking != ElpNone ||
layoutOffset != -1 ||
layoutAlign != -1;
return hasMatrix() ||
hasPacking() ||
hasOffset() ||
hasAlign();
}
bool hasMatrix() const
{
return layoutMatrix != ElmNone;
}
bool hasPacking() const
{
return layoutPacking != ElpNone;
}
bool hasOffset() const
{
return layoutOffset != -1;
}
bool hasAlign() const
{
return layoutAlign != -1;
}
bool hasLocation() const
{
@ -904,13 +920,13 @@ public:
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);
if (qualifier.hasStream())
p += snprintf(p, end - p, "stream=%d ", qualifier.layoutStream);
if (qualifier.layoutMatrix != ElmNone)
if (qualifier.hasMatrix())
p += snprintf(p, end - p, "%s ", TQualifier::getLayoutMatrixString(qualifier.layoutMatrix));
if (qualifier.layoutPacking != ElpNone)
if (qualifier.hasPacking())
p += snprintf(p, end - p, "%s ", TQualifier::getLayoutPackingString(qualifier.layoutPacking));
if (qualifier.layoutOffset != -1)
if (qualifier.hasOffset())
p += snprintf(p, end - p, "offset=%d ", qualifier.layoutOffset);
if (qualifier.layoutAlign != -1)
if (qualifier.hasAlign())
p += snprintf(p, end - p, "align=%d ", qualifier.layoutAlign);
if (qualifier.hasXfbBuffer() && qualifier.hasXfbOffset())

View file

@ -9,5 +9,5 @@
// source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "25018"
#define GLSLANG_DATE "2014/01/26 00:56:43"
#define GLSLANG_REVISION "25043"
#define GLSLANG_DATE "2014/01/27 13:02:12"