[lunarglass] r1100 committed - GLSL AST -> Top IR: Add locations of default uniforms (new to ES 3.1) ...

1 view
Skip to first unread message

lunar...@googlecode.com

unread,
Aug 3, 2015, 11:08:56 PM8/3/15
to lunargla...@googlegroups.com
Revision: 1100
Author: jo...@lunarg.com
Date: Tue Aug 4 03:08:44 2015 UTC
Log: GLSL AST -> Top IR: Add locations of default uniforms (new to ES
3.1) to the Metadata.
https://code.google.com/p/lunarglass/source/detail?r=1100

Modified:
/trunk/Frontends/glslang/GlslangToTopVisitor.cpp

=======================================
--- /trunk/Frontends/glslang/GlslangToTopVisitor.cpp Fri Jul 24 20:27:07
2015 UTC
+++ /trunk/Frontends/glslang/GlslangToTopVisitor.cpp Tue Aug 4 03:08:44
2015 UTC
@@ -350,12 +350,19 @@
return type.getQualifier().layoutLocation;
}

-int GetMdBinding(const glslang::TType& type)
+// Get the right binding/location/set content.
+//
+// Location and binding are generally mutually exclusive and can share the
same
+// metadata field.
+//
+int GetMdBindingLocation(const glslang::TType& type)
{
- if (type.getQualifier().layoutBinding ==
glslang::TQualifier::layoutBindingEnd)
+ if (type.getQualifier().layoutBinding !=
glslang::TQualifier::layoutBindingEnd)
+ return type.getQualifier().layoutBinding;
+ else if (type.getQualifier().layoutLocation !=
glslang::TQualifier::layoutLocationEnd)
+ return type.getQualifier().layoutLocation;
+ else
return gla::MaxUserLayoutLocation;
- else
- return type.getQualifier().layoutBinding;
}

gla::EMdPrecision GetMdPrecision(const glslang::TType& type)
@@ -2900,7 +2907,7 @@
// Make the main node
return metadata.makeMdInputOutput(node->getName().c_str(),
gla::UniformListMdName, gla::EMioDefaultUniform,
MakePermanentTypeProxy(value),
- layout, GetMdPrecision(type),
GetMdBinding(type), samplerMd, structure, -1, GetMdBuiltIn(type));
+ layout, GetMdPrecision(type),
GetMdBindingLocation(type), samplerMd, structure, -1, GetMdBuiltIn(type));
}

llvm::MDNode* TGlslangToTopTraverser::makeMdSampler(const glslang::TType&
type, llvm::Value* value)
@@ -2931,7 +2938,7 @@

// Make the main node
return
metadata.makeMdInputOutput(filterMdName(node->getName().c_str()),
gla::UniformListMdName, ioType, MakePermanentTypeProxy(value),
- GetMdTypeLayout(type),
GetMdPrecision(type), GetMdBinding(type), 0, block);
+ GetMdTypeLayout(type),
GetMdPrecision(type), GetMdBindingLocation(type), 0, block);
}

// Make a !type node as per metadata.h, recursively
Reply all
Reply to author
Forward
0 new messages