Non-functional: Sweep through the stack for consistent with "main" and entry point.
Partially addresses issue #513.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 4513df8..eab7cec 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -137,7 +137,7 @@
void updateMemberOffset(const glslang::TType& structType, const glslang::TType& memberType, int& currentOffset, int& nextOffset, glslang::TLayoutPacking, glslang::TLayoutMatrix);
void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember);
- bool isShaderEntrypoint(const glslang::TIntermAggregate* node);
+ bool isShaderEntryPoint(const glslang::TIntermAggregate* node);
void makeFunctions(const glslang::TIntermSequence&);
void makeGlobalInitializers(const glslang::TIntermSequence&);
void visitFunctions(const glslang::TIntermSequence&);
@@ -713,7 +713,7 @@
builder.setSource(TranslateSourceLanguage(glslangIntermediate->getSource(), glslangIntermediate->getProfile()), glslangIntermediate->getVersion());
stdBuiltins = builder.import("GLSL.std.450");
builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450);
- shaderEntry = builder.makeEntrypoint(glslangIntermediate->getEntryPoint().c_str());
+ shaderEntry = builder.makeEntryPoint(glslangIntermediate->getEntryPoint().c_str());
entryPoint = builder.addEntryPoint(executionModel, shaderEntry, glslangIntermediate->getEntryPoint().c_str());
// Add the source extensions
@@ -1279,7 +1279,7 @@
// In all cases, still let the traverser visit the children for us.
makeFunctions(node->getAsAggregate()->getSequence());
- // Also, we want all globals initializers to go into the entry of main(), before
+ // Also, we want all globals initializers to go into the beginning of the entry point, before
// anything else gets there, so visit out of order, doing them all now.
makeGlobalInitializers(node->getAsAggregate()->getSequence());
@@ -1313,7 +1313,7 @@
}
case glslang::EOpFunction:
if (visit == glslang::EvPreVisit) {
- if (isShaderEntrypoint(node)) {
+ if (isShaderEntryPoint(node)) {
inMain = true;
builder.setBuildPoint(shaderEntry->getLastBlock());
} else {
@@ -2451,7 +2451,7 @@
}
}
-bool TGlslangToSpvTraverser::isShaderEntrypoint(const glslang::TIntermAggregate* node)
+bool TGlslangToSpvTraverser::isShaderEntryPoint(const glslang::TIntermAggregate* node)
{
// have to ignore mangling and just look at the base name
size_t firstOpen = node->getName().find('(');
@@ -2463,7 +2463,7 @@
{
for (int f = 0; f < (int)glslFunctions.size(); ++f) {
glslang::TIntermAggregate* glslFunction = glslFunctions[f]->getAsAggregate();
- if (! glslFunction || glslFunction->getOp() != glslang::EOpFunction || isShaderEntrypoint(glslFunction))
+ if (! glslFunction || glslFunction->getOp() != glslang::EOpFunction || isShaderEntryPoint(glslFunction))
continue;
// We're on a user function. Set up the basic interface for the function now,
@@ -2523,7 +2523,7 @@
if (initializer && initializer->getOp() != glslang::EOpFunction && initializer->getOp() != glslang::EOpLinkerObjects) {
// We're on a top-level node that's not a function. Treat as an initializer, whose
- // code goes into the beginning of main.
+ // code goes into the beginning of the entry point.
initializer->traverse(this);
}
}
diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp
index 708871e..a881d1b 100644
--- a/SPIRV/SpvBuilder.cpp
+++ b/SPIRV/SpvBuilder.cpp
@@ -931,7 +931,7 @@
}
// Comments in header
-Function* Builder::makeEntrypoint(const char* entryPoint)
+Function* Builder::makeEntryPoint(const char* entryPoint)
{
assert(! mainFunction);
diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h
index 787d98e..38dc1fa 100755
--- a/SPIRV/SpvBuilder.h
+++ b/SPIRV/SpvBuilder.h
@@ -210,7 +210,7 @@
// Make the entry-point function. The returned pointer is only valid
// for the lifetime of this builder.
- Function* makeEntrypoint(const char*);
+ Function* makeEntryPoint(const char*);
// Make a shader-style function, and create its entry block if entry is non-zero.
// Return the function, pass back the entry.
diff --git a/Test/baseResults/120.frag.out b/Test/baseResults/120.frag.out
index 0d10b0e..4fa7600 100644
--- a/Test/baseResults/120.frag.out
+++ b/Test/baseResults/120.frag.out
@@ -23,7 +23,7 @@
ERROR: 0:85: 'assign' : l-value required
ERROR: 0:91: 'int' : overloaded functions must have the same return type
ERROR: 0:91: 'main' : function already has a body
-ERROR: 0:91: 'int' : main function cannot return a value
+ERROR: 0:91: 'int' : entry point cannot return a value
ERROR: 0:92: 'main' : function cannot take any parameter(s)
ERROR: 0:94: 'a' : variables with qualifier 'const' must be initialized
ERROR: 0:97: 'out' : overloaded functions must have the same parameter storage qualifiers for argument 1
diff --git a/Test/baseResults/420.geom.out b/Test/baseResults/420.geom.out
index 416df13..625feea 100644
--- a/Test/baseResults/420.geom.out
+++ b/Test/baseResults/420.geom.out
@@ -132,7 +132,7 @@
Linked geometry stage:
-ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
diff --git a/Test/baseResults/420_size_gl_in.geom.out b/Test/baseResults/420_size_gl_in.geom.out
index 21d1944..28d09a6 100644
--- a/Test/baseResults/420_size_gl_in.geom.out
+++ b/Test/baseResults/420_size_gl_in.geom.out
@@ -39,7 +39,7 @@
Linked geometry stage:
-ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
diff --git a/Test/baseResults/430.vert.out b/Test/baseResults/430.vert.out
index 4b7825b..676fcd3 100644
--- a/Test/baseResults/430.vert.out
+++ b/Test/baseResults/430.vert.out
@@ -266,7 +266,7 @@
Linked vertex stage:
-ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
ERROR: xfb_buffer 3, xfb_stride 64, minimum stride needed: 80
diff --git a/Test/baseResults/440.frag.out b/Test/baseResults/440.frag.out
index cafd85a..064fe19 100644
--- a/Test/baseResults/440.frag.out
+++ b/Test/baseResults/440.frag.out
@@ -122,7 +122,7 @@
Linked fragment stage:
-ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 440
ERROR: node is still EOpNull!
diff --git a/Test/baseResults/440.vert.out b/Test/baseResults/440.vert.out
index 2e1f5fe..022ddec 100644
--- a/Test/baseResults/440.vert.out
+++ b/Test/baseResults/440.vert.out
@@ -160,7 +160,7 @@
Linked vertex stage:
-ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
ERROR: Linking vertex stage: xfb_stride is too small to hold all buffer entries:
ERROR: xfb_buffer 0, xfb_stride 92, minimum stride needed: 96
ERROR: Linking vertex stage: xfb_stride must be multiple of 8 for buffer holding a double:
diff --git a/Test/baseResults/450.comp.out b/Test/baseResults/450.comp.out
index d5d1eca..203c4b2 100644
--- a/Test/baseResults/450.comp.out
+++ b/Test/baseResults/450.comp.out
@@ -9,7 +9,7 @@
Linked compute stage:
-ERROR: Linking compute stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking compute stage: Missing entry point: Each stage requires one entry point
Shader version: 450
local_size = (1, 1, 1)
diff --git a/Test/baseResults/badChars.frag.out b/Test/baseResults/badChars.frag.out
index 37af287..a29b22f 100644
--- a/Test/baseResults/badChars.frag.out
+++ b/Test/baseResults/badChars.frag.out
@@ -17,7 +17,7 @@
Linked fragment stage:
-ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 100
ERROR: node is still EOpNull!
diff --git a/Test/baseResults/cppBad.vert.out b/Test/baseResults/cppBad.vert.out
index 6938af6..1fb18ec 100755
--- a/Test/baseResults/cppBad.vert.out
+++ b/Test/baseResults/cppBad.vert.out
@@ -14,7 +14,7 @@
Linked vertex stage:
-ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Shader version: 100
ERROR: node is still EOpNull!
diff --git a/Test/baseResults/dce.frag.out b/Test/baseResults/dce.frag.out
index a19fe4e..2846abd 100644
--- a/Test/baseResults/dce.frag.out
+++ b/Test/baseResults/dce.frag.out
@@ -138,7 +138,7 @@
Linked fragment stage:
-ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 400
0:? Sequence
diff --git a/Test/baseResults/errors.frag.out b/Test/baseResults/errors.frag.out
index f1e06d2..23f6631 100644
--- a/Test/baseResults/errors.frag.out
+++ b/Test/baseResults/errors.frag.out
@@ -1,6 +1,6 @@
errors.frag
ERROR: 0:1: 'main' : function cannot take any parameter(s)
-ERROR: 0:1: 'int' : main function cannot return a value
+ERROR: 0:1: 'int' : entry point cannot return a value
ERROR: 2 compilation errors. No code generated.
diff --git a/Test/baseResults/mains1.frag.out b/Test/baseResults/mains1.frag.out
index 8ba02bf..0b5c2b7 100644
--- a/Test/baseResults/mains1.frag.out
+++ b/Test/baseResults/mains1.frag.out
@@ -42,7 +42,7 @@
Linked geometry stage:
ERROR: Linking geometry stage: Contradictory output layout primitives
-ERROR: Linking geometry stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking geometry stage: Missing entry point: Each stage requires one entry point
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
diff --git a/Test/baseResults/noMain.vert.out b/Test/baseResults/noMain.vert.out
index 630af95..80a3225 100644
--- a/Test/baseResults/noMain.vert.out
+++ b/Test/baseResults/noMain.vert.out
@@ -23,7 +23,7 @@
Linked vertex stage:
-ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point
Linked fragment stage:
diff --git a/Test/baseResults/nonVulkan.frag.out b/Test/baseResults/nonVulkan.frag.out
index 10c693c..8e03610 100644
--- a/Test/baseResults/nonVulkan.frag.out
+++ b/Test/baseResults/nonVulkan.frag.out
@@ -18,7 +18,7 @@
Linked fragment stage:
-ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 450
ERROR: node is still EOpNull!
diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h
index 1fc0ca7..2058a25 100644
--- a/glslang/Include/revision.h
+++ b/glslang/Include/revision.h
@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
-#define GLSLANG_REVISION "Overload400-PrecQual.1495"
+#define GLSLANG_REVISION "Overload400-PrecQual.1496"
#define GLSLANG_DATE "19-Sep-2016"
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index 297ae15..c15d721 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -1058,8 +1058,8 @@
if (function.getParamCount() > 0)
error(loc, "function cannot take any parameter(s)", function.getName().c_str(), "");
if (function.getType().getBasicType() != EbtVoid)
- error(loc, "", function.getType().getBasicTypeString().c_str(), "main function cannot return a value");
- intermediate.addMainCount();
+ error(loc, "", function.getType().getBasicTypeString().c_str(), "entry point cannot return a value");
+ intermediate.incrementEntryPointCount();
inMain = true;
} else
inMain = false;
diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp
index 630053a..2068f26 100644
--- a/glslang/MachineIndependent/SymbolTable.cpp
+++ b/glslang/MachineIndependent/SymbolTable.cpp
@@ -35,7 +35,7 @@
//
//
-// Symbol table for parsing. Most functionaliy and main ideas
+// Symbol table for parsing. Most functionality and main ideas
// are documented in the header file.
//
diff --git a/glslang/MachineIndependent/linkValidate.cpp b/glslang/MachineIndependent/linkValidate.cpp
index dbd2f92..9fd93a7 100644
--- a/glslang/MachineIndependent/linkValidate.cpp
+++ b/glslang/MachineIndependent/linkValidate.cpp
@@ -81,7 +81,7 @@
else
entryPoint = unit.entryPoint;
}
- numMains += unit.numMains;
+ numEntryPoints += unit.numEntryPoints;
numErrors += unit.numErrors;
numPushConstants += unit.numPushConstants;
callGraph.insert(callGraph.end(), unit.callGraph.begin(), unit.callGraph.end());
@@ -370,8 +370,8 @@
//
void TIntermediate::finalCheck(TInfoSink& infoSink)
{
- if (source == EShSourceGlsl && numMains < 1)
- error(infoSink, "Missing entry point: Each stage requires one \"void main()\" entry point");
+ if (source == EShSourceGlsl && numEntryPoints < 1)
+ error(infoSink, "Missing entry point: Each stage requires one entry point");
if (numPushConstants > 1)
error(infoSink, "Only one push_constant block is allowed per stage");
diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h
index 80deabe..0491bdd 100644
--- a/glslang/MachineIndependent/localintermediate.h
+++ b/glslang/MachineIndependent/localintermediate.h
@@ -137,7 +137,7 @@
public:
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) :
source(EShSourceNone), language(l), profile(p), version(v), treeRoot(0),
- numMains(0), numErrors(0), numPushConstants(0), recursive(false),
+ numEntryPoints(0), numErrors(0), numPushConstants(0), recursive(false),
invocations(TQualifier::layoutNotSet), vertices(TQualifier::layoutNotSet), inputPrimitive(ElgNone), outputPrimitive(ElgNone),
pixelCenterInteger(false), originUpperLeft(false),
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), depthReplacing(false), blendEquations(0),
@@ -173,8 +173,8 @@
void setTreeRoot(TIntermNode* r) { treeRoot = r; }
TIntermNode* getTreeRoot() const { return treeRoot; }
- void addMainCount() { ++numMains; }
- int getNumMains() const { return numMains; }
+ void incrementEntryPointCount() { ++numEntryPoints; }
+ int getNumEntryPoints() const { return numEntryPoints; }
int getNumErrors() const { return numErrors; }
void addPushConstantCount() { ++numPushConstants; }
bool isRecursive() const { return recursive; }
@@ -370,7 +370,7 @@
TIntermNode* treeRoot;
std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
TBuiltInResource resources;
- int numMains;
+ int numEntryPoints;
int numErrors;
int numPushConstants;
bool recursive;
diff --git a/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp
index d6b76c5..7daebb3 100644
--- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp
+++ b/glslang/MachineIndependent/preprocessor/PpScanner.cpp
@@ -696,7 +696,7 @@
}
//
-// The main functional entry-point into the preprocessor, which will
+// The main functional entry point into the preprocessor, which will
// scan the source strings to figure out and return the next processing token.
//
// Return string pointer to next token.
diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp
index d3e04af..3082647 100644
--- a/glslang/MachineIndependent/reflection.cpp
+++ b/glslang/MachineIndependent/reflection.cpp
@@ -48,7 +48,7 @@
//
// High-level algorithm for one stage:
//
-// 1. Put main() on list of live functions.
+// 1. Put the entry point on the list of live functions.
//
// 2. Traverse any live function, while skipping if-tests with a compile-time constant
// condition of false, and while adding any encountered function calls to the live
@@ -59,7 +59,7 @@
// 3. Add any encountered uniform variables and blocks to the reflection database.
//
// Can be attempted with a failed link, but will return false if recursion had been detected, or
-// there wasn't exactly one main.
+// there wasn't exactly one entry point.
//
namespace glslang {
@@ -83,7 +83,7 @@
virtual void visitSymbol(TIntermSymbol* base);
virtual bool visitSelection(TVisit, TIntermSelection* node);
- // Track live funtions as well as uniforms, so that we don't visit dead functions
+ // Track live functions as well as uniforms, so that we don't visit dead functions
// and only visit each function once.
void addFunctionCall(TIntermAggregate* call)
{
@@ -717,12 +717,12 @@
// Returns false if the input is too malformed to do this.
bool TReflection::addStage(EShLanguage, const TIntermediate& intermediate)
{
- if (intermediate.getNumMains() != 1 || intermediate.isRecursive())
+ if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive())
return false;
TLiveTraverser it(intermediate, *this);
- // put main() on functions to process
+ // put the entry point on functions to process
it.pushFunction("main(");
// process all the functions
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index 5504d1f..edbb706 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -704,7 +704,7 @@
// E.g., pipeline inputs to the vertex stage and outputs from the fragment stage.
bool HlslParseContext::shouldFlatten(const TType& type) const
{
- if (! inEntrypoint)
+ if (! inEntryPoint)
return false;
const TStorageQualifier qualifier = type.getQualifier().storage;
@@ -850,16 +850,16 @@
currentFunctionType = new TType(EbtVoid);
functionReturnsValue = false;
- inEntrypoint = (function.getName() == intermediate.getEntryPoint().c_str());
- if (inEntrypoint) {
- remapEntrypointIO(function);
+ inEntryPoint = (function.getName() == intermediate.getEntryPoint().c_str());
+ if (inEntryPoint) {
+ remapEntryPointIO(function);
if (entryPointOutput) {
if (shouldFlatten(entryPointOutput->getType()))
flatten(*entryPointOutput);
assignLocations(*entryPointOutput);
}
} else
- remapNonEntrypointIO(function);
+ remapNonEntryPointIO(function);
//
// New symbol table scope for body of function plus its arguments
@@ -885,7 +885,7 @@
error(loc, "redefinition", variable->getName().c_str(), "");
else {
// get IO straightened out
- if (inEntrypoint) {
+ if (inEntryPoint) {
if (shouldFlatten(*param.type))
flatten(*variable);
assignLocations(*variable);
@@ -925,7 +925,7 @@
// AST I/O is done through shader globals declared in the 'in' or 'out'
// storage class. An HLSL entry point has a return value, input parameters
// and output parameters. These need to get remapped to the AST I/O.
-void HlslParseContext::remapEntrypointIO(TFunction& function)
+void HlslParseContext::remapEntryPointIO(TFunction& function)
{
// Will auto-assign locations here to the inputs/outputs defined by the entry point
@@ -969,7 +969,7 @@
// An HLSL function that looks like an entry point, but is not,
// declares entry point IO built-ins, but these have to be undone.
-void HlslParseContext::remapNonEntrypointIO(TFunction& function)
+void HlslParseContext::remapNonEntryPointIO(TFunction& function)
{
const auto remapBuiltInType = [&](TType& type) { type.getQualifier().builtIn = EbvNone; };
@@ -1007,7 +1007,7 @@
// assignment subtree, and the second part being a return with no value.
//
// Otherwise, for a non entry point, just return a return statement.
- if (inEntrypoint) {
+ if (inEntryPoint) {
assert(entryPointOutput != nullptr); // should have been error tested at the beginning
TIntermSymbol* left = new TIntermSymbol(entryPointOutput->getUniqueId(), entryPointOutput->getName(),
entryPointOutput->getType());
diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h
index d963584..ea76341 100755
--- a/hlsl/hlslParseHelper.h
+++ b/hlsl/hlslParseHelper.h
@@ -90,8 +90,8 @@
TFunction& handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&);
void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
- void remapEntrypointIO(TFunction& function);
- void remapNonEntrypointIO(TFunction& function);
+ void remapEntryPointIO(TFunction& function);
+ void remapNonEntryPointIO(TFunction& function);
TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*);
void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg);
TIntermTyped* handleAssign(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right) const;
@@ -185,7 +185,7 @@
int structNestingLevel; // 0 if outside blocks and structures
int controlFlowNestingLevel; // 0 if outside all flow control
TList<TIntermSequence*> switchSequenceStack; // case, node, case, case, node, ...; ensure only one node between cases; stack of them for nesting
- bool inEntrypoint; // if inside a function, true if the function is the entry point
+ bool inEntryPoint; // if inside a function, true if the function is the entry point
bool postMainReturn; // if inside a function, true if the function is the entry point and this is after a return statement
const TType* currentFunctionType; // the return type of the function that's currently being parsed
bool functionReturnsValue; // true if a non-void function has a return