This commit is contained in:
parent
c45dddae5f
commit
7f349c73db
@ -2045,8 +2045,15 @@ Block& Builder::makeNewBlock()
|
|||||||
|
|
||||||
Builder::LoopBlocks& Builder::makeNewLoop()
|
Builder::LoopBlocks& Builder::makeNewLoop()
|
||||||
{
|
{
|
||||||
// Older MSVC versions don't allow inlining of blocks below.
|
// This verbosity is needed to simultaneously get the same behavior
|
||||||
LoopBlocks blocks = {makeNewBlock(), makeNewBlock(), makeNewBlock(), makeNewBlock()};
|
// everywhere (id's in the same order), have a syntax that works
|
||||||
|
// across lots of versions of C++, have no warnings from pedantic
|
||||||
|
// compilation modes, and leave the rest of the code alone.
|
||||||
|
Block& head = makeNewBlock();
|
||||||
|
Block& body = makeNewBlock();
|
||||||
|
Block& merge = makeNewBlock();
|
||||||
|
Block& continue_target = makeNewBlock();
|
||||||
|
LoopBlocks blocks(head, body, merge, continue_target);
|
||||||
loops.push(blocks);
|
loops.push(blocks);
|
||||||
return loops.top();
|
return loops.top();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -397,7 +397,12 @@ public:
|
|||||||
void endSwitch(std::vector<Block*>& segmentBB);
|
void endSwitch(std::vector<Block*>& segmentBB);
|
||||||
|
|
||||||
struct LoopBlocks {
|
struct LoopBlocks {
|
||||||
|
LoopBlocks(Block& head, Block& body, Block& merge, Block& continue_target) :
|
||||||
|
head(head), body(body), merge(merge), continue_target(continue_target) { }
|
||||||
Block &head, &body, &merge, &continue_target;
|
Block &head, &body, &merge, &continue_target;
|
||||||
|
private:
|
||||||
|
LoopBlocks();
|
||||||
|
LoopBlocks& operator=(const LoopBlocks&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start a new loop and prepare the builder to generate code for it. Until
|
// Start a new loop and prepare the builder to generate code for it. Until
|
||||||
|
|||||||
@ -238,7 +238,8 @@ std::string GetDefaultTBuiltInResourceString()
|
|||||||
return ostream.str();
|
return ostream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodeResourceLimits(TBuiltInResource* resources, char* config) {
|
void DecodeResourceLimits(TBuiltInResource* resources, char* config)
|
||||||
|
{
|
||||||
const char* delims = " \t\n\r";
|
const char* delims = " \t\n\r";
|
||||||
const char* token = strtok(config, delims);
|
const char* token = strtok(config, delims);
|
||||||
while (token) {
|
while (token) {
|
||||||
|
|||||||
@ -579,7 +579,10 @@ public:
|
|||||||
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; }
|
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; }
|
||||||
virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; }
|
virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; }
|
||||||
virtual ~TIntermNode() { }
|
virtual ~TIntermNode() { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TIntermNode(const TIntermNode&);
|
||||||
|
TIntermNode& operator=(const TIntermNode&);
|
||||||
glslang::TSourceLoc loc;
|
glslang::TSourceLoc loc;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -621,6 +624,7 @@ public:
|
|||||||
TString getCompleteString() const { return type.getCompleteString(); }
|
TString getCompleteString() const { return type.getCompleteString(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TIntermTyped& operator=(const TIntermTyped&);
|
||||||
TType type;
|
TType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -702,6 +706,7 @@ public:
|
|||||||
const TConstUnionArray& getConstArray() const { return constArray; }
|
const TConstUnionArray& getConstArray() const { return constArray; }
|
||||||
void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; }
|
void setConstSubtree(TIntermTyped* subtree) { constSubtree = subtree; }
|
||||||
TIntermTyped* getConstSubtree() const { return constSubtree; }
|
TIntermTyped* getConstSubtree() const { return constSubtree; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int id; // the unique id of the symbol this node represents
|
int id; // the unique id of the symbol this node represents
|
||||||
TString name; // the name of the symbol this node represents
|
TString name; // the name of the symbol this node represents
|
||||||
@ -721,7 +726,10 @@ public:
|
|||||||
void setLiteral() { literal = true; }
|
void setLiteral() { literal = true; }
|
||||||
void setExpression() { literal = false; }
|
void setExpression() { literal = false; }
|
||||||
bool isLiteral() const { return literal; }
|
bool isLiteral() const { return literal; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TIntermConstantUnion& operator=(const TIntermConstantUnion&);
|
||||||
|
|
||||||
const TConstUnionArray constArray;
|
const TConstUnionArray constArray;
|
||||||
bool literal; // true if node represents a literal in the source code
|
bool literal; // true if node represents a literal in the source code
|
||||||
};
|
};
|
||||||
|
|||||||
@ -173,7 +173,7 @@ public:
|
|||||||
loc[getLastValidSourceIndex()].name = filename;
|
loc[getLastValidSourceIndex()].name = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFile(const char* filename, size_t i)
|
void setFile(const char* filename, int i)
|
||||||
{
|
{
|
||||||
if (i == getLastValidSourceIndex()) {
|
if (i == getLastValidSourceIndex()) {
|
||||||
logicalSourceLoc.name = filename;
|
logicalSourceLoc.name = filename;
|
||||||
|
|||||||
@ -783,6 +783,8 @@ public:
|
|||||||
void setLineNum(int newLineNum) { lastLine = newLineNum; }
|
void setLineNum(int newLineNum) { lastLine = newLineNum; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SourceLineSynchronizer& operator=(const SourceLineSynchronizer&);
|
||||||
|
|
||||||
// A function for getting the index of the last valid source string we've
|
// A function for getting the index of the last valid source string we've
|
||||||
// read tokens from.
|
// read tokens from.
|
||||||
const std::function<int()> getLastSourceIndex;
|
const std::function<int()> getLastSourceIndex;
|
||||||
|
|||||||
@ -487,6 +487,8 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
TokenizableIncludeFile& operator=(const TokenizableIncludeFile&);
|
||||||
|
|
||||||
// Stores the prologue for this string.
|
// Stores the prologue for this string.
|
||||||
const std::string prologue_;
|
const std::string prologue_;
|
||||||
|
|
||||||
|
|||||||
@ -244,6 +244,8 @@ public:
|
|||||||
bool visitBranch(glslang::TVisit, glslang::TIntermBranch*) override;
|
bool visitBranch(glslang::TVisit, glslang::TIntermBranch*) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TSymbolDefinitionCollectingTraverser& operator=(const TSymbolDefinitionCollectingTraverser&);
|
||||||
|
|
||||||
// The mapping from symbol node IDs to their defining nodes. This should be
|
// The mapping from symbol node IDs to their defining nodes. This should be
|
||||||
// populated along traversing the AST.
|
// populated along traversing the AST.
|
||||||
NodeMapping& symbol_definition_mapping_;
|
NodeMapping& symbol_definition_mapping_;
|
||||||
@ -548,6 +550,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TNoContractionAssigneeCheckingTraverser& operator=(const TNoContractionAssigneeCheckingTraverser&);
|
||||||
|
|
||||||
bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override;
|
bool visitBinary(glslang::TVisit, glslang::TIntermBinary* node) override;
|
||||||
void visitSymbol(glslang::TIntermSymbol* node) override;
|
void visitSymbol(glslang::TIntermSymbol* node) override;
|
||||||
|
|
||||||
@ -648,6 +652,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TNoContractionPropagator& operator=(const TNoContractionPropagator&);
|
||||||
|
|
||||||
// Visits an aggregate node. The node can be a initializer list, in which
|
// Visits an aggregate node. The node can be a initializer list, in which
|
||||||
// case we need to find the 'precise' or 'precise' containing object node
|
// case we need to find the 'precise' or 'precise' containing object node
|
||||||
// with the access chain record. In other cases, just need to traverse all
|
// with the access chain record. In other cases, just need to traverse all
|
||||||
|
|||||||
@ -307,7 +307,7 @@ public:
|
|||||||
// 2. Call parse with an Includer.
|
// 2. Call parse with an Includer.
|
||||||
//
|
//
|
||||||
// When the Glslang parser encounters an #include directive, it calls
|
// When the Glslang parser encounters an #include directive, it calls
|
||||||
// the Includer's include method with the the requested include name
|
// the Includer's include method with the requested include name
|
||||||
// together with the current string name. The returned IncludeResult
|
// together with the current string name. The returned IncludeResult
|
||||||
// contains the fully resolved name of the included source, together
|
// contains the fully resolved name of the included source, together
|
||||||
// with the source text that should replace the #include directive
|
// with the source text that should replace the #include directive
|
||||||
@ -323,8 +323,10 @@ public:
|
|||||||
// An IncludeResult contains the resolved name and content of a source
|
// An IncludeResult contains the resolved name and content of a source
|
||||||
// inclusion.
|
// inclusion.
|
||||||
struct IncludeResult {
|
struct IncludeResult {
|
||||||
|
IncludeResult(const std::string& file_name, const char* const file_data, const size_t file_length, void* user_data) :
|
||||||
|
file_name(file_name), file_data(file_data), file_length(file_length), user_data(user_data) { }
|
||||||
// For a successful inclusion, the fully resolved name of the requested
|
// For a successful inclusion, the fully resolved name of the requested
|
||||||
// include. For example, in a filesystem-based includer, full resolution
|
// include. For example, in a file system-based includer, full resolution
|
||||||
// should convert a relative path name into an absolute path name.
|
// should convert a relative path name into an absolute path name.
|
||||||
// For a failed inclusion, this is an empty string.
|
// For a failed inclusion, this is an empty string.
|
||||||
const std::string file_name;
|
const std::string file_name;
|
||||||
@ -337,6 +339,9 @@ public:
|
|||||||
const size_t file_length;
|
const size_t file_length;
|
||||||
// Include resolver's context.
|
// Include resolver's context.
|
||||||
void* user_data;
|
void* user_data;
|
||||||
|
protected:
|
||||||
|
IncludeResult& operator=(const IncludeResult&);
|
||||||
|
IncludeResult();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Resolves an inclusion request by name, type, current source name,
|
// Resolves an inclusion request by name, type, current source name,
|
||||||
@ -365,11 +370,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
IncludeResult* include(const char*, IncludeType, const char*, size_t) override
|
IncludeResult* include(const char*, IncludeType, const char*, size_t) override
|
||||||
{
|
{
|
||||||
static const char unexpected_include[] =
|
const char* unexpected_include = "unexpected include directive";
|
||||||
"unexpected include directive";
|
return new IncludeResult(std::string(""), unexpected_include, strlen(unexpected_include), nullptr);
|
||||||
static const IncludeResult unexpectedIncludeResult =
|
|
||||||
{"", unexpected_include, sizeof(unexpected_include) - 1, nullptr};
|
|
||||||
return new IncludeResult(unexpectedIncludeResult);
|
|
||||||
}
|
}
|
||||||
virtual void releaseInclude(IncludeResult* result) override
|
virtual void releaseInclude(IncludeResult* result) override
|
||||||
{
|
{
|
||||||
|
|||||||
@ -107,7 +107,7 @@ std::pair<bool, std::string> ReadFile(const std::string& path)
|
|||||||
if (fstream) {
|
if (fstream) {
|
||||||
std::string contents;
|
std::string contents;
|
||||||
fstream.seekg(0, std::ios::end);
|
fstream.seekg(0, std::ios::end);
|
||||||
contents.reserve(fstream.tellg());
|
contents.reserve((std::string::size_type)fstream.tellg());
|
||||||
fstream.seekg(0, std::ios::beg);
|
fstream.seekg(0, std::ios::beg);
|
||||||
contents.assign((std::istreambuf_iterator<char>(fstream)),
|
contents.assign((std::istreambuf_iterator<char>(fstream)),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
|
|||||||
@ -180,8 +180,7 @@ public:
|
|||||||
shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1);
|
shader->setStringsWithLengths(&shaderStrings, &shaderLengths, 1);
|
||||||
if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str());
|
if (!entryPointName.empty()) shader->setEntryPoint(entryPointName.c_str());
|
||||||
// Reinitialize glslang if the semantics change.
|
// Reinitialize glslang if the semantics change.
|
||||||
GlslangInitializer::InitializationToken token =
|
GlobalTestSettings.initializer->acquire(controls);
|
||||||
GlobalTestSettings.initializer->acquire(controls);
|
|
||||||
return shader->parse(
|
return shader->parse(
|
||||||
(resources ? resources : &glslang::DefaultTBuiltInResource),
|
(resources ? resources : &glslang::DefaultTBuiltInResource),
|
||||||
defaultVersion, isForwardCompatible, controls);
|
defaultVersion, isForwardCompatible, controls);
|
||||||
|
|||||||
@ -55,6 +55,9 @@ namespace glslang {
|
|||||||
bool parse();
|
bool parse();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
HlslGrammar();
|
||||||
|
HlslGrammar& operator=(const HlslGrammar&);
|
||||||
|
|
||||||
void expected(const char*);
|
void expected(const char*);
|
||||||
bool acceptIdentifier(HlslToken&);
|
bool acceptIdentifier(HlslToken&);
|
||||||
bool acceptCompilationUnit();
|
bool acceptCompilationUnit();
|
||||||
|
|||||||
@ -409,7 +409,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HlslParseContext::checkIndex(const TSourceLoc& loc, const TType& type, int& index)
|
void HlslParseContext::checkIndex(const TSourceLoc& /*loc*/, const TType& /*type*/, int& /*index*/)
|
||||||
{
|
{
|
||||||
// HLSL todo: any rules for index fixups?
|
// HLSL todo: any rules for index fixups?
|
||||||
}
|
}
|
||||||
@ -527,7 +527,7 @@ int HlslParseContext::getIoArrayImplicitSize() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HlslParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredSize, const char* feature, TType& type, const TString& name)
|
void HlslParseContext::checkIoArrayConsistency(const TSourceLoc& /*loc*/, int requiredSize, const char* /*feature*/, TType& type, const TString& /*name*/)
|
||||||
{
|
{
|
||||||
if (type.isImplicitlySizedArray())
|
if (type.isImplicitlySizedArray())
|
||||||
type.changeOuterArraySize(requiredSize);
|
type.changeOuterArraySize(requiredSize);
|
||||||
@ -1254,15 +1254,15 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
|
|
||||||
if (arguments) {
|
if (arguments) {
|
||||||
// Make sure qualifications work for these arguments.
|
// Make sure qualifications work for these arguments.
|
||||||
TIntermAggregate* aggregate = arguments->getAsAggregate();
|
//TIntermAggregate* aggregate = arguments->getAsAggregate();
|
||||||
for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
//for (int i = 0; i < fnCandidate->getParamCount(); ++i) {
|
||||||
// At this early point there is a slight ambiguity between whether an aggregate 'arguments'
|
// // At this early point there is a slight ambiguity between whether an aggregate 'arguments'
|
||||||
// is the single argument itself or its children are the arguments. Only one argument
|
// // is the single argument itself or its children are the arguments. Only one argument
|
||||||
// means take 'arguments' itself as the one argument.
|
// // means take 'arguments' itself as the one argument.
|
||||||
TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments);
|
// TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments);
|
||||||
TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier();
|
// TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier();
|
||||||
TQualifier& argQualifier = arg->getAsTyped()->getQualifier();
|
// TQualifier& argQualifier = arg->getAsTyped()->getQualifier();
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Convert 'in' arguments
|
// Convert 'in' arguments
|
||||||
addInputArgumentConversions(*fnCandidate, arguments); // arguments may be modified if it's just a single argument node
|
addInputArgumentConversions(*fnCandidate, arguments); // arguments may be modified if it's just a single argument node
|
||||||
@ -1895,7 +1895,7 @@ void HlslParseContext::globalCheck(const TSourceLoc& loc, const char* token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool HlslParseContext::builtInName(const TString& identifier)
|
bool HlslParseContext::builtInName(const TString& /*identifier*/)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1907,7 +1907,8 @@ bool HlslParseContext::builtInName(const TString& identifier)
|
|||||||
//
|
//
|
||||||
// Returns true if there was an error in construction.
|
// Returns true if there was an error in construction.
|
||||||
//
|
//
|
||||||
bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, TFunction& function, TOperator op, TType& type)
|
bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* /*node*/, TFunction& function,
|
||||||
|
TOperator op, TType& type)
|
||||||
{
|
{
|
||||||
type.shallowCopy(function.getType());
|
type.shallowCopy(function.getType());
|
||||||
|
|
||||||
@ -2043,7 +2044,7 @@ bool HlslParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIntermTyped* typed = node->getAsTyped();
|
// TIntermTyped* typed = node->getAsTyped();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2132,7 +2133,7 @@ void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type
|
|||||||
//
|
//
|
||||||
// Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
|
// Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
|
||||||
//
|
//
|
||||||
void HlslParseContext::globalQualifierFix(const TSourceLoc& loc, TQualifier& qualifier)
|
void HlslParseContext::globalQualifierFix(const TSourceLoc&, TQualifier& qualifier)
|
||||||
{
|
{
|
||||||
// move from parameter/unknown qualifiers to pipeline in/out qualifiers
|
// move from parameter/unknown qualifiers to pipeline in/out qualifiers
|
||||||
switch (qualifier.storage) {
|
switch (qualifier.storage) {
|
||||||
@ -2398,7 +2399,9 @@ void HlslParseContext::updateImplicitArraySize(const TSourceLoc& loc, TIntermNod
|
|||||||
//
|
//
|
||||||
// Returns a redeclared and type-modified variable if a redeclared occurred.
|
// Returns a redeclared and type-modified variable if a redeclared occurred.
|
||||||
//
|
//
|
||||||
TSymbol* HlslParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier, const TQualifier& qualifier, const TShaderQualifiers& publicType, bool& newDeclaration)
|
TSymbol* HlslParseContext::redeclareBuiltinVariable(const TSourceLoc& /*loc*/, const TString& identifier,
|
||||||
|
const TQualifier& /*qualifier*/,
|
||||||
|
const TShaderQualifiers& /*publicType*/, bool& /*newDeclaration*/)
|
||||||
{
|
{
|
||||||
if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
|
if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -2698,7 +2701,7 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
|
|||||||
void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id, const TIntermTyped* node)
|
void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id, const TIntermTyped* node)
|
||||||
{
|
{
|
||||||
const char* feature = "layout-id value";
|
const char* feature = "layout-id value";
|
||||||
const char* nonLiteralFeature = "non-literal layout-id value";
|
//const char* nonLiteralFeature = "non-literal layout-id value";
|
||||||
|
|
||||||
integerCheck(node, feature);
|
integerCheck(node, feature);
|
||||||
const TIntermConstantUnion* constUnion = node->getAsConstantUnion();
|
const TIntermConstantUnion* constUnion = node->getAsConstantUnion();
|
||||||
@ -2838,7 +2841,6 @@ void HlslParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& pu
|
|||||||
|
|
||||||
case EShLangFragment:
|
case EShLangFragment:
|
||||||
if (id == "index") {
|
if (id == "index") {
|
||||||
const char* exts[2] = { E_GL_ARB_separate_shader_objects, E_GL_ARB_explicit_attrib_location };
|
|
||||||
publicType.qualifier.layoutIndex = value;
|
publicType.qualifier.layoutIndex = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2953,7 +2955,7 @@ void HlslParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQuali
|
|||||||
//
|
//
|
||||||
const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn)
|
const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, const TFunction& call, bool& builtIn)
|
||||||
{
|
{
|
||||||
const TFunction* function = nullptr;
|
// const TFunction* function = nullptr;
|
||||||
|
|
||||||
if (symbolTable.isFunctionNameVariable(call.getName())) {
|
if (symbolTable.isFunctionNameVariable(call.getName())) {
|
||||||
error(loc, "can't use function syntax on variable", call.getName().c_str(), "");
|
error(loc, "can't use function syntax on variable", call.getName().c_str(), "");
|
||||||
@ -3866,7 +3868,7 @@ void HlslParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc,
|
|||||||
{
|
{
|
||||||
if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) {
|
if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) {
|
||||||
assert(language == EShLangTessControl || language == EShLangGeometry);
|
assert(language == EShLangTessControl || language == EShLangGeometry);
|
||||||
const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices";
|
// const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices";
|
||||||
|
|
||||||
if (language == EShLangTessControl)
|
if (language == EShLangTessControl)
|
||||||
checkIoArraysConsistency(loc);
|
checkIoArraysConsistency(loc);
|
||||||
|
|||||||
@ -60,8 +60,8 @@ public:
|
|||||||
void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
void C_DECL ppWarn(const TSourceLoc&, const char* szReason, const char* szToken,
|
||||||
const char* szExtraInfoFormat, ...);
|
const char* szExtraInfoFormat, ...);
|
||||||
|
|
||||||
void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op) { }
|
void reservedPpErrorCheck(const TSourceLoc&, const char* /*name*/, const char* /*op*/) { }
|
||||||
bool lineContinuationCheck(const TSourceLoc&, bool endOfComment) { return true; }
|
bool lineContinuationCheck(const TSourceLoc&, bool /*endOfComment*/) { return true; }
|
||||||
bool lineDirectiveShouldSetNextLine() const { return true; }
|
bool lineDirectiveShouldSetNextLine() const { return true; }
|
||||||
bool builtInName(const TString&);
|
bool builtInName(const TString&);
|
||||||
|
|
||||||
|
|||||||
@ -136,12 +136,14 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
|
|||||||
switch (*argOrder) {
|
switch (*argOrder) {
|
||||||
case '-': break; // no dimensions for voids
|
case '-': break; // no dimensions for voids
|
||||||
case 'S': break; // no dimensions on scalars
|
case 'S': break; // no dimensions on scalars
|
||||||
case 'V': s += ('0' + dim0); break;
|
case 'V': s += ('0' + (char)dim0); break;
|
||||||
case 'M':
|
case 'M':
|
||||||
{
|
{
|
||||||
if (!UseHlslTypes) // GLSL has column first for mat types
|
if (!UseHlslTypes) // GLSL has column first for mat types
|
||||||
std::swap(dim0, dim1);
|
std::swap(dim0, dim1);
|
||||||
s += ('0' + dim0); s += 'x'; s += ('0' + dim1);
|
s += ('0' + (char)dim0);
|
||||||
|
s += 'x';
|
||||||
|
s += ('0' + (char)dim1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
|
|||||||
// TODO: the GLSL parser is currently used to parse HLSL prototypes. However, many valid HLSL prototypes
|
// TODO: the GLSL parser is currently used to parse HLSL prototypes. However, many valid HLSL prototypes
|
||||||
// are not valid GLSL prototypes. This rejects the invalid ones. Thus, there is a single switch below
|
// are not valid GLSL prototypes. This rejects the invalid ones. Thus, there is a single switch below
|
||||||
// to enable creation of the entire HLSL space.
|
// to enable creation of the entire HLSL space.
|
||||||
inline bool IsValidGlsl(const char* cname, char retOrder, char retType, char argOrder, char argType,
|
inline bool IsValidGlsl(const char* cname, char retOrder, char retType, char /*argOrder*/, char argType,
|
||||||
int dim0, int dim1, int dim0Max, int dim1Max)
|
int dim0, int dim1, int dim0Max, int dim1Max)
|
||||||
{
|
{
|
||||||
const bool isVec = dim0Max > 1 || argType == 'V';
|
const bool isVec = dim0Max > 1 || argType == 'V';
|
||||||
@ -208,7 +210,7 @@ inline const char* NthArg(const char* arg, int n)
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void FindVectorMatrixBounds(const char* argOrder, int fixedVecSize, int& dim0Min, int& dim0Max, int& dim1Min, int& dim1Max)
|
inline void FindVectorMatrixBounds(const char* argOrder, int fixedVecSize, int& dim0Min, int& dim0Max, int& /*dim1Min*/, int& dim1Max)
|
||||||
{
|
{
|
||||||
for (int arg = 0; ; ++arg) {
|
for (int arg = 0; ; ++arg) {
|
||||||
const char* nthArgOrder(NthArg(argOrder, arg));
|
const char* nthArgOrder(NthArg(argOrder, arg));
|
||||||
@ -273,7 +275,7 @@ void TBuiltInParseablesHlsl::createMatTimesMat()
|
|||||||
// Most built-ins variables can be added as simple text strings. Some need to
|
// Most built-ins variables can be added as simple text strings. Some need to
|
||||||
// be added programmatically, which is done later in IdentifyBuiltIns() below.
|
// be added programmatically, which is done later in IdentifyBuiltIns() below.
|
||||||
//
|
//
|
||||||
void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const SpvVersion& spvVersion)
|
void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, const SpvVersion& /*spvVersion*/)
|
||||||
{
|
{
|
||||||
static const EShLanguageMask EShLangAll = EShLanguageMask(EShLangCount - 1);
|
static const EShLanguageMask EShLangAll = EShLanguageMask(EShLangCount - 1);
|
||||||
|
|
||||||
@ -556,8 +558,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
|||||||
// add stage-specific entries to the commonBuiltins, and only if that stage
|
// add stage-specific entries to the commonBuiltins, and only if that stage
|
||||||
// was requested.
|
// was requested.
|
||||||
//
|
//
|
||||||
void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int version, EProfile profile,
|
void TBuiltInParseablesHlsl::initialize(const TBuiltInResource& /*resources*/, int /*version*/, EProfile /*profile*/,
|
||||||
const SpvVersion& spvVersion, EShLanguage language)
|
const SpvVersion& /*spvVersion*/, EShLanguage /*language*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +572,7 @@ void TBuiltInParseablesHlsl::initialize(const TBuiltInResource &resources, int v
|
|||||||
// 3) Tag extension-related symbols added to their base version with their extensions, so
|
// 3) Tag extension-related symbols added to their base version with their extensions, so
|
||||||
// that if an early version has the extension turned off, there is an error reported on use.
|
// that if an early version has the extension turned off, there is an error reported on use.
|
||||||
//
|
//
|
||||||
void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
|
void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profile*/, const SpvVersion& /*spvVersion*/, EShLanguage /*language*/,
|
||||||
TSymbolTable& symbolTable)
|
TSymbolTable& symbolTable)
|
||||||
{
|
{
|
||||||
// symbolTable.relateToOperator("abort", EOpAbort);
|
// symbolTable.relateToOperator("abort", EOpAbort);
|
||||||
@ -719,8 +721,8 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, con
|
|||||||
// 2) Tag extension-related symbols added to their base version with their extensions, so
|
// 2) Tag extension-related symbols added to their base version with their extensions, so
|
||||||
// that if an early version has the extension turned off, there is an error reported on use.
|
// that if an early version has the extension turned off, there is an error reported on use.
|
||||||
//
|
//
|
||||||
void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
|
void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profile*/, const SpvVersion& /*spvVersion*/, EShLanguage /*language*/,
|
||||||
TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
TSymbolTable& /*symbolTable*/, const TBuiltInResource& /*resources*/)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,9 @@ namespace glslang {
|
|||||||
HlslToken token; // the token we are currently looking at, but have not yet accepted
|
HlslToken token; // the token we are currently looking at, but have not yet accepted
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
HlslTokenStream();
|
||||||
|
HlslTokenStream& operator=(const HlslTokenStream&);
|
||||||
|
|
||||||
HlslScanContext& scanner; // lexical scanner, to get next token
|
HlslScanContext& scanner; // lexical scanner, to get next token
|
||||||
|
|
||||||
// Previously scanned tokens, returned for future advances,
|
// Previously scanned tokens, returned for future advances,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user