HLSL: Plumb in HLSL parse context and keywords, and most basic HLSL parser and test.

This commit is contained in:
John Kessenich 2016-03-12 20:11:22 -07:00
parent b3dc3acd59
commit e01a9bc8c0
16 changed files with 5047 additions and 16 deletions

View file

@ -69,6 +69,18 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message)
//
void TIntermediate::merge(TInfoSink& infoSink, TIntermediate& unit)
{
if (source == EShSourceNone)
source = unit.source;
if (source != unit.source)
error(infoSink, "can't link compilation units from different source languages");
if (source == EShSourceHlsl && unit.entryPoint.size() > 0) {
if (entryPoint.size() > 0)
error(infoSink, "can't handle multiple entry points per stage");
else
entryPoint = unit.entryPoint;
}
numMains += unit.numMains;
numErrors += unit.numErrors;
numPushConstants += unit.numPushConstants;
@ -355,8 +367,8 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
// Also, lock in defaults of things not set, including array sizes.
//
void TIntermediate::finalCheck(TInfoSink& infoSink)
{
if (numMains < 1)
{
if (source == EShSourceGlsl && numMains < 1)
error(infoSink, "Missing entry point: Each stage requires one \"void main()\" entry point");
if (numPushConstants > 1)