Commit e4e8f7b7 by John Kessenich Committed by GitHub

Merge pull request #722 from steve-lunarg/tessellation

Add basic HS/DS implementation.
parents 9a2733a9 858c928a
hlsl.hull.void.tesc
Shader version: 450
vertices = 3
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 3-element array of structure{temp 3-component vector of float cpoint})
0:26 move second child to first child (temp structure{temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:26 Function Call: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Function Call: PCF( (temp void)
0:33 Function Definition: PCF( (temp void)
0:33 Function Parameters:
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'InvocationId' (in uint InvocationID)
Linked tessellation control stage:
Shader version: 450
vertices = 3
0:? Sequence
0:26 Function Definition: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:26 Function Parameters:
0:26 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:? Sequence
0:28 move second child to first child (temp 3-component vector of float)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 'output' (temp structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 cpoint: direct index for structure (temp 3-component vector of float)
0:28 direct index (temp structure{temp 3-component vector of float cpoint})
0:28 'ip' (in 3-element array of structure{temp 3-component vector of float cpoint})
0:28 Constant:
0:28 0 (const int)
0:28 Constant:
0:28 0 (const int)
0:29 Branch: Return with expression
0:29 'output' (temp structure{temp 3-component vector of float cpoint})
0:26 Function Definition: main( (temp void)
0:26 Function Parameters:
0:? Sequence
0:26 move second child to first child (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 3-element array of structure{temp 3-component vector of float cpoint})
0:26 move second child to first child (temp structure{temp 3-component vector of float cpoint})
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:26 Function Call: @main(struct-VS_OUT-vf31[3]; (temp structure{temp 3-component vector of float cpoint})
0:? 'ip' (temp 3-element array of structure{temp 3-component vector of float cpoint})
0:? Barrier (temp void)
0:? Test condition and select (temp void)
0:? Condition
0:? Compare Equal (temp bool)
0:? 'InvocationId' (in uint InvocationID)
0:? Constant:
0:? 0 (const int)
0:? true case
0:? Function Call: PCF( (temp void)
0:33 Function Definition: PCF( (temp void)
0:33 Function Parameters:
0:? Linker Objects
0:? '@entryPointOutput' (layout(location=0 ) out structure{temp 3-component vector of float cpoint})
0:? 'ip' (layout(location=0 ) in 3-element array of structure{temp 3-component vector of float cpoint})
0:? 'InvocationId' (in uint InvocationID)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 51
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 33 36 44
ExecutionMode 4 OutputVertices 3
Name 4 "main"
Name 8 "VS_OUT"
MemberName 8(VS_OUT) 0 "cpoint"
Name 13 "HS_OUT"
MemberName 13(HS_OUT) 0 "cpoint"
Name 16 "@main(struct-VS_OUT-vf31[3];"
Name 15 "ip"
Name 18 "PCF("
Name 21 "output"
Name 31 "ip"
Name 33 "ip"
Name 36 "@entryPointOutput"
Name 37 "param"
Name 44 "InvocationId"
Decorate 33(ip) Location 0
Decorate 36(@entryPointOutput) Location 0
Decorate 44(InvocationId) BuiltIn InvocationId
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 3
8(VS_OUT): TypeStruct 7(fvec3)
9: TypeInt 32 0
10: 9(int) Constant 3
11: TypeArray 8(VS_OUT) 10
12: TypePointer Function 11
13(HS_OUT): TypeStruct 7(fvec3)
14: TypeFunction 13(HS_OUT) 12(ptr)
20: TypePointer Function 13(HS_OUT)
22: TypeInt 32 1
23: 22(int) Constant 0
24: TypePointer Function 7(fvec3)
32: TypePointer Input 11
33(ip): 32(ptr) Variable Input
35: TypePointer Output 13(HS_OUT)
36(@entryPointOutput): 35(ptr) Variable Output
40: 9(int) Constant 2
41: 9(int) Constant 1
42: 9(int) Constant 0
43: TypePointer Input 9(int)
44(InvocationId): 43(ptr) Variable Input
46: TypeBool
4(main): 2 Function None 3
5: Label
31(ip): 12(ptr) Variable Function
37(param): 12(ptr) Variable Function
34: 11 Load 33(ip)
Store 31(ip) 34
38: 11 Load 31(ip)
Store 37(param) 38
39: 13(HS_OUT) FunctionCall 16(@main(struct-VS_OUT-vf31[3];) 37(param)
Store 36(@entryPointOutput) 39
ControlBarrier 40 41 42
45: 9(int) Load 44(InvocationId)
47: 46(bool) IEqual 45 23
SelectionMerge 49 None
BranchConditional 47 48 49
48: Label
50: 2 FunctionCall 18(PCF()
Branch 49
49: Label
Return
FunctionEnd
16(@main(struct-VS_OUT-vf31[3];): 13(HS_OUT) Function None 14
15(ip): 12(ptr) FunctionParameter
17: Label
21(output): 20(ptr) Variable Function
25: 24(ptr) AccessChain 15(ip) 23 23
26: 7(fvec3) Load 25
27: 24(ptr) AccessChain 21(output) 23
Store 27 26
28: 13(HS_OUT) Load 21(output)
ReturnValue 28
FunctionEnd
18(PCF(): 2 Function None 3
19: Label
Return
FunctionEnd
// ***
// invocation ID coming from input to entry point
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("isoline")]
[partitioning("integer")]
[outputtopology("line")]
[outputcontrolpoints(4)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 4> ip, uint m_cpid : SV_OutputControlPointID)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
HS_CONSTANT_OUT PCF(uint pid : SV_PrimitiveId)
{
HS_CONSTANT_OUT output;
output.edges[0] = 2.0f;
output.edges[1] = 8.0f;
return output;
}
// ***
// invocation ID coming from synthesized variable
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("isoline")]
[partitioning("integer")]
[outputtopology("line")]
[outputcontrolpoints(4)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 4> ip)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
HS_CONSTANT_OUT PCF(uint pid : SV_PrimitiveId, float4 pos : SV_Position)
{
HS_CONSTANT_OUT output;
output.edges[0] = 2.0f;
output.edges[1] = 8.0f;
return output;
}
// ***
// void patchconstantfunction input and return
// ***
struct VS_OUT
{
float3 cpoint : CPOINT;
};
struct HS_CONSTANT_OUT
{
float edges[2] : SV_TessFactor;
};
struct HS_OUT
{
float3 cpoint : CPOINT;
};
[domain("tri")]
[partitioning("fractional_even")]
[outputtopology("line")]
[outputcontrolpoints(3)]
[patchconstantfunc("PCF")]
HS_OUT main(InputPatch<VS_OUT, 3> ip)
{
HS_OUT output;
output.cpoint = ip[0].cpoint;
return output;
}
void PCF()
{
}
...@@ -81,12 +81,19 @@ public: ...@@ -81,12 +81,19 @@ public:
type = EbtBool; type = EbtBool;
} }
void setSConst(const TString* s)
{
sConst = s;
type = EbtString;
}
int getIConst() const { return iConst; } int getIConst() const { return iConst; }
unsigned int getUConst() const { return uConst; } unsigned int getUConst() const { return uConst; }
long long getI64Const() const { return i64Const; } long long getI64Const() const { return i64Const; }
unsigned long long getU64Const() const { return u64Const; } unsigned long long getU64Const() const { return u64Const; }
double getDConst() const { return dConst; } double getDConst() const { return dConst; }
bool getBConst() const { return bConst; } bool getBConst() const { return bConst; }
const TString* getSConst() const { return sConst; }
bool operator==(const int i) const bool operator==(const int i) const
{ {
...@@ -532,6 +539,7 @@ private: ...@@ -532,6 +539,7 @@ private:
unsigned long long u64Const; // used for u64vec, scalar uint64s unsigned long long u64Const; // used for u64vec, scalar uint64s
bool bConst; // used for bvec, scalar bools bool bConst; // used for bvec, scalar bools
double dConst; // used for vec, dvec, mat, dmat, scalar floats and doubles double dConst; // used for vec, dvec, mat, dmat, scalar floats and doubles
const TString* sConst; // string constant
}; };
TBasicType type; TBasicType type;
......
...@@ -1403,6 +1403,14 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseT ...@@ -1403,6 +1403,14 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(double d, TBasicType baseT
return addConstantUnion(unionArray, TType(baseType, EvqConst), loc, literal); return addConstantUnion(unionArray, TType(baseType, EvqConst), loc, literal);
} }
TIntermConstantUnion* TIntermediate::addConstantUnion(const TString* s, const TSourceLoc& loc, bool literal) const
{
TConstUnionArray unionArray(1);
unionArray[0].setSConst(s);
return addConstantUnion(unionArray, TType(EbtString, EvqConst), loc, literal);
}
// Put vector swizzle selectors onto the given sequence // Put vector swizzle selectors onto the given sequence
void TIntermediate::pushSelector(TIntermSequence& sequence, const TVectorSelector& selector, const TSourceLoc& loc) void TIntermediate::pushSelector(TIntermSequence& sequence, const TVectorSelector& selector, const TSourceLoc& loc)
{ {
......
...@@ -198,6 +198,7 @@ struct TParameter { ...@@ -198,6 +198,7 @@ struct TParameter {
TString *name; TString *name;
TType* type; TType* type;
TIntermTyped* defaultValue; TIntermTyped* defaultValue;
TBuiltInVariable declaredBuiltIn;
void copyParam(const TParameter& param) void copyParam(const TParameter& param)
{ {
if (param.name) if (param.name)
...@@ -206,6 +207,7 @@ struct TParameter { ...@@ -206,6 +207,7 @@ struct TParameter {
name = 0; name = 0;
type = param.type->clone(); type = param.type->clone();
defaultValue = param.defaultValue; defaultValue = param.defaultValue;
declaredBuiltIn = param.declaredBuiltIn;
} }
}; };
...@@ -222,7 +224,11 @@ public: ...@@ -222,7 +224,11 @@ public:
TSymbol(name), TSymbol(name),
mangledName(*name + '('), mangledName(*name + '('),
op(tOp), op(tOp),
defined(false), prototyped(false), defaultParamCount(0) { returnType.shallowCopy(retType); } defined(false), prototyped(false), defaultParamCount(0)
{
returnType.shallowCopy(retType);
declaredBuiltIn = retType.getQualifier().builtIn;
}
virtual TFunction* clone() const; virtual TFunction* clone() const;
virtual ~TFunction(); virtual ~TFunction();
...@@ -232,6 +238,7 @@ public: ...@@ -232,6 +238,7 @@ public:
virtual void addParameter(TParameter& p) virtual void addParameter(TParameter& p)
{ {
assert(writable); assert(writable);
p.declaredBuiltIn = p.type->getQualifier().builtIn;
parameters.push_back(p); parameters.push_back(p);
p.type->appendMangledName(mangledName); p.type->appendMangledName(mangledName);
...@@ -246,6 +253,7 @@ public: ...@@ -246,6 +253,7 @@ public:
virtual const TString& getMangledName() const { return mangledName; } virtual const TString& getMangledName() const { return mangledName; }
virtual const TType& getType() const { return returnType; } virtual const TType& getType() const { return returnType; }
virtual TBuiltInVariable getDeclaredBuiltInType() const { return declaredBuiltIn; }
virtual TType& getWritableType() { return returnType; } virtual TType& getWritableType() { return returnType; }
virtual void relateToOperator(TOperator o) { assert(writable); op = o; } virtual void relateToOperator(TOperator o) { assert(writable); op = o; }
virtual TOperator getBuiltInOp() const { return op; } virtual TOperator getBuiltInOp() const { return op; }
...@@ -273,6 +281,8 @@ protected: ...@@ -273,6 +281,8 @@ protected:
typedef TVector<TParameter> TParamList; typedef TVector<TParameter> TParamList;
TParamList parameters; TParamList parameters;
TType returnType; TType returnType;
TBuiltInVariable declaredBuiltIn;
TString mangledName; TString mangledName;
TOperator op; TOperator op;
bool defined; bool defined;
......
...@@ -263,6 +263,7 @@ public: ...@@ -263,6 +263,7 @@ public:
TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(unsigned long long, const TSourceLoc&, bool literal = false) const;
TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(bool, const TSourceLoc&, bool literal = false) const;
TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const; TIntermConstantUnion* addConstantUnion(double, TBasicType, const TSourceLoc&, bool literal = false) const;
TIntermConstantUnion* addConstantUnion(const TString*, const TSourceLoc&, bool literal = false) const;
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const; TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) const;
bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false); bool parseConstTree(TIntermNode*, TConstUnionArray, TOperator, const TType&, bool singleConstantParam = false);
TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&); TIntermLoop* addLoop(TIntermNode*, TIntermTyped*, TIntermTyped*, bool testFirst, const TSourceLoc&);
......
...@@ -119,6 +119,9 @@ INSTANTIATE_TEST_CASE_P( ...@@ -119,6 +119,9 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.getdimensions.rw.dx10.frag", "main"}, {"hlsl.getdimensions.rw.dx10.frag", "main"},
{"hlsl.getdimensions.dx10.vert", "main"}, {"hlsl.getdimensions.dx10.vert", "main"},
{"hlsl.getsampleposition.dx10.frag", "main"}, {"hlsl.getsampleposition.dx10.frag", "main"},
{"hlsl.hull.1.tesc", "main"},
{"hlsl.hull.2.tesc", "main"},
{"hlsl.hull.void.tesc", "main"},
{"hlsl.identifier.sample.frag", "main"}, {"hlsl.identifier.sample.frag", "main"},
{"hlsl.if.frag", "PixelShaderFunction"}, {"hlsl.if.frag", "PixelShaderFunction"},
{"hlsl.inoutquals.frag", "main"}, {"hlsl.inoutquals.frag", "main"},
......
...@@ -60,6 +60,7 @@ namespace glslang { ...@@ -60,6 +60,7 @@ namespace glslang {
EatOutputTopology, EatOutputTopology,
EatPartitioning, EatPartitioning,
EatPatchConstantFunc, EatPatchConstantFunc,
EatPatchSize,
EatUnroll, EatUnroll,
}; };
} }
......
...@@ -869,6 +869,67 @@ bool HlslGrammar::acceptOutputPrimitiveGeometry(TLayoutGeometry& geometry) ...@@ -869,6 +869,67 @@ bool HlslGrammar::acceptOutputPrimitiveGeometry(TLayoutGeometry& geometry)
return true; return true;
} }
// tessellation_decl_type
// : INPUTPATCH
// | OUTPUTPATCH
//
bool HlslGrammar::acceptTessellationDeclType()
{
// read geometry type
const EHlslTokenClass tessType = peek();
switch (tessType) {
case EHTokInputPatch: break;
case EHTokOutputPatch: break;
default:
return false; // not a tessellation decl
}
advanceToken(); // consume the keyword
return true;
}
// tessellation_patch_template_type
// : tessellation_decl_type LEFT_ANGLE type comma integer_literal RIGHT_ANGLE
//
bool HlslGrammar::acceptTessellationPatchTemplateType(TType& type)
{
if (! acceptTessellationDeclType())
return false;
if (! acceptTokenClass(EHTokLeftAngle))
return false;
if (! acceptType(type)) {
expected("tessellation patch type");
return false;
}
if (! acceptTokenClass(EHTokComma))
return false;
// integer size
if (! peekTokenClass(EHTokIntConstant)) {
expected("literal integer");
return false;
}
TIntermTyped* size;
if (! acceptLiteral(size))
return false;
TArraySizes* arraySizes = new TArraySizes;
arraySizes->addInnerSize(size->getAsConstantUnion()->getConstArray()[0].getIConst());
type.newArraySizes(*arraySizes);
if (! acceptTokenClass(EHTokRightAngle)) {
expected("right angle bracket");
return false;
}
return true;
}
// stream_out_template_type // stream_out_template_type
// : output_primitive_geometry_type LEFT_ANGLE type RIGHT_ANGLE // : output_primitive_geometry_type LEFT_ANGLE type RIGHT_ANGLE
// //
...@@ -1147,6 +1208,15 @@ bool HlslGrammar::acceptType(TType& type) ...@@ -1147,6 +1208,15 @@ bool HlslGrammar::acceptType(TType& type)
return true; return true;
} }
case EHTokInputPatch: // fall through
case EHTokOutputPatch: // ...
{
if (! acceptTessellationPatchTemplateType(type))
return false;
return true;
}
case EHTokSampler: // fall through case EHTokSampler: // fall through
case EHTokSampler1d: // ... case EHTokSampler1d: // ...
case EHTokSampler2d: // ... case EHTokSampler2d: // ...
...@@ -2522,7 +2592,7 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node) ...@@ -2522,7 +2592,7 @@ bool HlslGrammar::acceptLiteral(TIntermTyped*& node)
node = intermediate.addConstantUnion(token.b, token.loc, true); node = intermediate.addConstantUnion(token.b, token.loc, true);
break; break;
case EHTokStringConstant: case EHTokStringConstant:
node = nullptr; node = intermediate.addConstantUnion(token.string, token.loc, true);
break; break;
default: default:
......
...@@ -76,6 +76,8 @@ namespace glslang { ...@@ -76,6 +76,8 @@ namespace glslang {
bool acceptTemplateVecMatBasicType(TBasicType&); bool acceptTemplateVecMatBasicType(TBasicType&);
bool acceptVectorTemplateType(TType&); bool acceptVectorTemplateType(TType&);
bool acceptMatrixTemplateType(TType&); bool acceptMatrixTemplateType(TType&);
bool acceptTessellationDeclType();
bool acceptTessellationPatchTemplateType(TType&);
bool acceptStreamOutTemplateType(TType&, TLayoutGeometry&); bool acceptStreamOutTemplateType(TType&, TLayoutGeometry&);
bool acceptOutputPrimitiveGeometry(TLayoutGeometry&); bool acceptOutputPrimitiveGeometry(TLayoutGeometry&);
bool acceptAnnotations(TQualifier&); bool acceptAnnotations(TQualifier&);
......
...@@ -225,6 +225,7 @@ protected: ...@@ -225,6 +225,7 @@ protected:
TVariable* getSplitIoVar(const TVariable* var) const; TVariable* getSplitIoVar(const TVariable* var) const;
TVariable* getSplitIoVar(int id) const; TVariable* getSplitIoVar(int id) const;
void addInterstageIoToLinkage(); void addInterstageIoToLinkage();
void addPatchConstantInvocation();
void flatten(const TSourceLoc& loc, const TVariable& variable); void flatten(const TSourceLoc& loc, const TVariable& variable);
int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name); int flatten(const TSourceLoc& loc, const TVariable& variable, const TType&, TFlattenData&, TString name);
...@@ -242,6 +243,10 @@ protected: ...@@ -242,6 +243,10 @@ protected:
void correctUniform(TQualifier& qualifier); void correctUniform(TQualifier& qualifier);
void clearUniformInputOutput(TQualifier& qualifier); void clearUniformInputOutput(TQualifier& qualifier);
// Pass through to base class after remembering builtin mappings.
using TParseContextBase::trackLinkage;
void trackLinkage(TSymbol& variable) override;
void finish() override; // post-processing void finish() override; // post-processing
// Current state of parsing // Current state of parsing
...@@ -324,6 +329,9 @@ protected: ...@@ -324,6 +329,9 @@ protected:
// can build the linkage correctly if position appears on both sides. Otherwise, multiple positions // can build the linkage correctly if position appears on both sides. Otherwise, multiple positions
// are considered identical. // are considered identical.
struct tInterstageIoData { struct tInterstageIoData {
tInterstageIoData(TBuiltInVariable bi, TStorageQualifier q) :
builtIn(bi), storage(q) { }
tInterstageIoData(const TType& memberType, const TType& storageType) : tInterstageIoData(const TType& memberType, const TType& storageType) :
builtIn(memberType.getQualifier().builtIn), builtIn(memberType.getQualifier().builtIn),
storage(storageType.getQualifier().storage) { } storage(storageType.getQualifier().storage) { }
...@@ -348,7 +356,13 @@ protected: ...@@ -348,7 +356,13 @@ protected:
unsigned int nextInLocation; unsigned int nextInLocation;
unsigned int nextOutLocation; unsigned int nextOutLocation;
TString sourceEntryPointName; TString sourceEntryPointName;
TFunction* entryPointFunction;
TIntermNode* entryPointFunctionBody;
TString patchConstantFunctionName; // hull shader patch constant function name, from function level attribute.
TMap<TBuiltInVariable, TSymbol*> builtInLinkageSymbols; // used for tessellation, finding declared builtins
}; };
} // end namespace glslang } // end namespace glslang
......
...@@ -129,6 +129,9 @@ void HlslScanContext::fillInKeywordMap() ...@@ -129,6 +129,9 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["LineStream"] = EHTokLineStream; (*KeywordMap)["LineStream"] = EHTokLineStream;
(*KeywordMap)["TriangleStream"] = EHTokTriangleStream; (*KeywordMap)["TriangleStream"] = EHTokTriangleStream;
(*KeywordMap)["InputPatch"] = EHTokInputPatch;
(*KeywordMap)["OutputPatch"] = EHTokOutputPatch;
(*KeywordMap)["Buffer"] = EHTokBuffer; (*KeywordMap)["Buffer"] = EHTokBuffer;
(*KeywordMap)["vector"] = EHTokVector; (*KeywordMap)["vector"] = EHTokVector;
(*KeywordMap)["matrix"] = EHTokMatrix; (*KeywordMap)["matrix"] = EHTokMatrix;
...@@ -540,6 +543,11 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier() ...@@ -540,6 +543,11 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
case EHTokTriangleStream: case EHTokTriangleStream:
return keyword; return keyword;
// Tessellation patches
case EHTokInputPatch:
case EHTokOutputPatch:
return keyword;
case EHTokBuffer: case EHTokBuffer:
case EHTokVector: case EHTokVector:
case EHTokMatrix: case EHTokMatrix:
......
...@@ -78,6 +78,10 @@ enum EHlslTokenClass { ...@@ -78,6 +78,10 @@ enum EHlslTokenClass {
EHTokLineStream, EHTokLineStream,
EHTokTriangleStream, EHTokTriangleStream,
// Tessellation patches
EHTokInputPatch,
EHTokOutputPatch,
// template types // template types
EHTokBuffer, EHTokBuffer,
EHTokVector, EHTokVector,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment