This includes the "< decl ; decl ; >" syntax which has its own namespace.
This functionality is not implemented, just silently accepted.
--- /dev/null
+hlsl.string.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:10 Function Definition: main(f1; (global float)
+0:10 Function Parameters:
+0:10 'f' (layout(location=0 ) in float)
+0:? Sequence
+0:11 Sequence
+0:11 move second child to first child (temp float)
+0:? '@entryPointOutput' (layout(location=0 ) out float)
+0:11 'f' (layout(location=0 ) in float)
+0:11 Branch: Return
+0:? Linker Objects
+0:? '@entryPointOutput' (layout(location=0 ) out float)
+0:? 'f' (layout(location=0 ) in float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:10 Function Definition: main(f1; (global float)
+0:10 Function Parameters:
+0:10 'f' (layout(location=0 ) in float)
+0:? Sequence
+0:11 Sequence
+0:11 move second child to first child (temp float)
+0:? '@entryPointOutput' (layout(location=0 ) out float)
+0:11 'f' (layout(location=0 ) in float)
+0:11 Branch: Return
+0:? Linker Objects
+0:? '@entryPointOutput' (layout(location=0 ) out float)
+0:? 'f' (layout(location=0 ) in float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 13
+
+ Capability Shader
+ 1: ExtInstImport "GLSL.std.450"
+ MemoryModel Logical GLSL450
+ EntryPoint Fragment 4 "main" 8 10
+ ExecutionMode 4 OriginUpperLeft
+ Name 4 "main"
+ Name 8 "@entryPointOutput"
+ Name 10 "f"
+ Decorate 8(@entryPointOutput) Location 0
+ Decorate 10(f) Location 0
+ 2: TypeVoid
+ 3: TypeFunction 2
+ 6: TypeFloat 32
+ 7: TypePointer Output 6(float)
+8(@entryPointOutput): 7(ptr) Variable Output
+ 9: TypePointer Input 6(float)
+ 10(f): 9(ptr) Variable Input
+ 4(main): 2 Function None 3
+ 5: Label
+ 11: 6(float) Load 10(f)
+ Store 8(@entryPointOutput) 11
+ Return
+ FunctionEnd
--- /dev/null
+string s = "string1";
+string e = "";
+string bracket < string a = "nested" ; > ;
+string brackets < string b = "nest1" ; string c = "nest2" ; string d = "nest3" ; > ;
+string brackete1 < > ;
+string brackete2 < ; > ;
+string brackete3 < ; ; > ;
+
+float main(float f)
+{
+ return f;
+}
\ No newline at end of file
EbtSampler,
EbtStruct,
EbtBlock,
+
+ // HLSL types that live only temporarily.
+ EbtString,
+
EbtNumTypes
};
// 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.1499"
+#define GLSLANG_REVISION "Overload400-PrecQual.1501"
#define GLSLANG_DATE "19-Sep-2016"
{"hlsl.semicolons.frag", "main"},
{"hlsl.shapeConv.frag", "main"},
{"hlsl.stringtoken.frag", "main"},
+ {"hlsl.string.frag", "main"},
{"hlsl.structin.vert", "main"},
{"hlsl.intrinsics.vert", "VertexShaderFunction"},
{"hlsl.matType.frag", "PixelShaderFunction"},
return true;
}
+// string_template_type
+// : STRING
+// | STRING identifier LEFT_ANGLE declaration SEMI_COLON ... declaration SEMICOLON RIGHT_ANGLE
+//
+bool HlslGrammar::acceptStringTemplateType(TType& type)
+{
+ // STRING
+ if (! acceptTokenClass(EHTokString))
+ return false;
+
+ // no matter what happens next, we recognized a string type
+ new(&type) TType(EbtString);
+
+ // identifier LEFT_ANGLE, or not?
+ if (! acceptTokenClass(EHTokIdentifier)) {
+ expected("identifier following 'string'");
+ return false;
+ }
+
+ if (! peekTokenClass(EHTokLeftAngle)) {
+ // then it must be the non-template version, back up and let
+ // normal declaration code handle it
+
+ // recede the identifier
+ recedeToken();
+ return true;
+ }
+
+ // move past the LEFT_ANGLE
+ advanceToken();
+
+ // declaration SEMI_COLON ... declaration SEMICOLON RIGHT_ANGLE
+ do {
+ // eat any extra SEMI_COLON; don't know if the grammar calls for this or not
+ while (acceptTokenClass(EHTokSemicolon))
+ ;
+
+ if (acceptTokenClass(EHTokRightAngle))
+ return true;
+
+ // declaration
+ TIntermNode* node;
+ if (! acceptDeclaration(node)) {
+ expected("declaration in string list");
+ return false;
+ }
+ } while (true);
+}
// sampler_type
// : SAMPLER
return acceptMatrixTemplateType(type);
break;
+ case EHTokString:
+ return acceptStringTemplateType(type);
+ break;
+
case EHTokSampler: // fall through
case EHTokSampler1d: // ...
case EHTokSampler2d: // ...
case EHTokBoolConstant:
node = intermediate.addConstantUnion(token.b, token.loc, true);
break;
+ case EHTokStringConstant:
+ node = nullptr;
+ break;
default:
return false;
bool acceptTemplateType(TBasicType&);
bool acceptVectorTemplateType(TType&);
bool acceptMatrixTemplateType(TType&);
+ bool acceptStringTemplateType(TType&);
bool acceptSamplerType(TType&);
bool acceptTextureType(TType&);
bool acceptStruct(TType&);
//
TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, TString& identifier, const TType& parseType, TArraySizes* arraySizes, TIntermTyped* initializer)
{
+ // string identifiers can nest inside < ... >, apparently with their own namespace,
+ // which is not implemented
+ if (parseType.getBasicType() == EbtString)
+ return nullptr;
+
TType type;
type.shallowCopy(parseType);
if (type.isImplicitlySizedArray()) {
(*KeywordMap)["Buffer"] = EHTokBuffer;
(*KeywordMap)["vector"] = EHTokVector;
(*KeywordMap)["matrix"] = EHTokMatrix;
+ (*KeywordMap)["string"] = EHTokString;
(*KeywordMap)["void"] = EHTokVoid;
(*KeywordMap)["bool"] = EHTokBool;
case EHTokBuffer:
case EHTokVector:
case EHTokMatrix:
+ case EHTokString:
return keyword;
// scalar types
EHTokBuffer,
EHTokVector,
EHTokMatrix,
+ EHTokString,
// scalar types
EHTokVoid,