Implement 'index' layout qualifier for fragment outputs. Based partly on a submission.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27759 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-08-19 02:12:44 +00:00
parent d1888f83f6
commit aa657c117e
18 changed files with 135 additions and 58 deletions

View file

@ -483,6 +483,8 @@ public:
layoutLocation = layoutLocationEnd;
layoutComponent = layoutComponentEnd;
layoutBinding = layoutBindingEnd;
layoutIndex = layoutIndexEnd;
layoutStream = layoutStreamEnd;
layoutXfbBuffer = layoutXfbBufferEnd;
@ -494,7 +496,7 @@ public:
bool hasLayout() const
{
return hasUniformLayout() ||
hasLocation() ||
hasAnyLocation() ||
hasBinding() ||
hasStream() ||
hasXfb() ||
@ -514,6 +516,9 @@ public:
unsigned int layoutBinding : 8;
static const unsigned int layoutBindingEnd = 0xFF;
unsigned int layoutIndex : 8;
static const unsigned int layoutIndexEnd = 0xFF;
unsigned int layoutStream : 8;
static const unsigned int layoutStreamEnd = 0xFF;
@ -552,15 +557,24 @@ public:
{
return layoutAlign != -1;
}
bool hasAnyLocation() const
{
return hasLocation() ||
hasComponent() ||
hasIndex();
}
bool hasLocation() const
{
return layoutLocation != layoutLocationEnd ||
layoutComponent != layoutComponentEnd;
return layoutLocation != layoutLocationEnd;
}
bool hasComponent() const
{
return layoutComponent != layoutComponentEnd;
}
bool hasIndex() const
{
return layoutIndex != layoutIndexEnd;
}
bool hasBinding() const
{
return layoutBinding != layoutBindingEnd;
@ -1167,10 +1181,12 @@ public:
noXfbBuffer.layoutXfbBuffer = TQualifier::layoutXfbBufferEnd;
if (noXfbBuffer.hasLayout()) {
p += snprintf(p, end - p, "layout(");
if (qualifier.hasLocation()) {
if (qualifier.hasAnyLocation()) {
p += snprintf(p, end - p, "location=%d ", qualifier.layoutLocation);
if (qualifier.layoutComponent != qualifier.layoutComponentEnd)
if (qualifier.hasComponent())
p += snprintf(p, end - p, "component=%d ", qualifier.layoutComponent);
if (qualifier.hasIndex())
p += snprintf(p, end - p, "index=%d ", qualifier.layoutIndex);
}
if (qualifier.hasBinding())
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);