HLSL: Implement half matrices, and map all half* -> float*.
This commit is contained in:
@@ -111,6 +111,22 @@ bool HlslGrammar::acceptIdentifier(HlslToken& idToken)
|
||||
switch (peek()) {
|
||||
case EHTokSample: idString = NewPoolTString("sample"); break;
|
||||
case EHTokHalf: idString = NewPoolTString("half"); break;
|
||||
case EHTokHalf1x1: idString = NewPoolTString("half1x1"); break;
|
||||
case EHTokHalf1x2: idString = NewPoolTString("half1x2"); break;
|
||||
case EHTokHalf1x3: idString = NewPoolTString("half1x3"); break;
|
||||
case EHTokHalf1x4: idString = NewPoolTString("half1x4"); break;
|
||||
case EHTokHalf2x1: idString = NewPoolTString("half2x1"); break;
|
||||
case EHTokHalf2x2: idString = NewPoolTString("half2x2"); break;
|
||||
case EHTokHalf2x3: idString = NewPoolTString("half2x3"); break;
|
||||
case EHTokHalf2x4: idString = NewPoolTString("half2x4"); break;
|
||||
case EHTokHalf3x1: idString = NewPoolTString("half3x1"); break;
|
||||
case EHTokHalf3x2: idString = NewPoolTString("half3x2"); break;
|
||||
case EHTokHalf3x3: idString = NewPoolTString("half3x3"); break;
|
||||
case EHTokHalf3x4: idString = NewPoolTString("half3x4"); break;
|
||||
case EHTokHalf4x1: idString = NewPoolTString("half4x1"); break;
|
||||
case EHTokHalf4x2: idString = NewPoolTString("half4x2"); break;
|
||||
case EHTokHalf4x3: idString = NewPoolTString("half4x3"); break;
|
||||
case EHTokHalf4x4: idString = NewPoolTString("half4x4"); break;
|
||||
case EHTokBool: idString = NewPoolTString("bool"); break;
|
||||
case EHTokFloat: idString = NewPoolTString("float"); break;
|
||||
case EHTokDouble: idString = NewPoolTString("double"); break;
|
||||
@@ -1479,20 +1495,20 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
|
||||
break;
|
||||
|
||||
case EHTokHalf:
|
||||
new(&type) TType(half_bt, EvqTemporary, EpqMedium);
|
||||
new(&type) TType(half_bt, EvqTemporary);
|
||||
break;
|
||||
case EHTokHalf1:
|
||||
new(&type) TType(half_bt, EvqTemporary, EpqMedium);
|
||||
new(&type) TType(half_bt, EvqTemporary);
|
||||
type.makeVector();
|
||||
break;
|
||||
case EHTokHalf2:
|
||||
new(&type) TType(half_bt, EvqTemporary, EpqMedium, 2);
|
||||
new(&type) TType(half_bt, EvqTemporary, 2);
|
||||
break;
|
||||
case EHTokHalf3:
|
||||
new(&type) TType(half_bt, EvqTemporary, EpqMedium, 3);
|
||||
new(&type) TType(half_bt, EvqTemporary, 3);
|
||||
break;
|
||||
case EHTokHalf4:
|
||||
new(&type) TType(half_bt, EvqTemporary, EpqMedium, 4);
|
||||
new(&type) TType(half_bt, EvqTemporary, 4);
|
||||
break;
|
||||
|
||||
case EHTokMin16float:
|
||||
@@ -1776,6 +1792,55 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
|
||||
new(&type) TType(EbtFloat, EvqTemporary, 0, 4, 4);
|
||||
break;
|
||||
|
||||
case EHTokHalf1x1:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 1, 1);
|
||||
break;
|
||||
case EHTokHalf1x2:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 1, 2);
|
||||
break;
|
||||
case EHTokHalf1x3:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 1, 3);
|
||||
break;
|
||||
case EHTokHalf1x4:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 1, 4);
|
||||
break;
|
||||
case EHTokHalf2x1:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 2, 1);
|
||||
break;
|
||||
case EHTokHalf2x2:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 2, 2);
|
||||
break;
|
||||
case EHTokHalf2x3:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 2, 3);
|
||||
break;
|
||||
case EHTokHalf2x4:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 2, 4);
|
||||
break;
|
||||
case EHTokHalf3x1:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 3, 1);
|
||||
break;
|
||||
case EHTokHalf3x2:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 3, 2);
|
||||
break;
|
||||
case EHTokHalf3x3:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 3, 3);
|
||||
break;
|
||||
case EHTokHalf3x4:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 3, 4);
|
||||
break;
|
||||
case EHTokHalf4x1:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 4, 1);
|
||||
break;
|
||||
case EHTokHalf4x2:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 4, 2);
|
||||
break;
|
||||
case EHTokHalf4x3:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 4, 3);
|
||||
break;
|
||||
case EHTokHalf4x4:
|
||||
new(&type) TType(half_bt, EvqTemporary, 0, 4, 4);
|
||||
break;
|
||||
|
||||
case EHTokDouble1x1:
|
||||
new(&type) TType(EbtDouble, EvqTemporary, 0, 1, 1);
|
||||
break;
|
||||
|
||||
@@ -279,6 +279,22 @@ void HlslScanContext::fillInKeywordMap()
|
||||
(*KeywordMap)["float4x2"] = EHTokFloat4x2;
|
||||
(*KeywordMap)["float4x3"] = EHTokFloat4x3;
|
||||
(*KeywordMap)["float4x4"] = EHTokFloat4x4;
|
||||
(*KeywordMap)["half1x1"] = EHTokHalf1x1;
|
||||
(*KeywordMap)["half1x2"] = EHTokHalf1x2;
|
||||
(*KeywordMap)["half1x3"] = EHTokHalf1x3;
|
||||
(*KeywordMap)["half1x4"] = EHTokHalf1x4;
|
||||
(*KeywordMap)["half2x1"] = EHTokHalf2x1;
|
||||
(*KeywordMap)["half2x2"] = EHTokHalf2x2;
|
||||
(*KeywordMap)["half2x3"] = EHTokHalf2x3;
|
||||
(*KeywordMap)["half2x4"] = EHTokHalf2x4;
|
||||
(*KeywordMap)["half3x1"] = EHTokHalf3x1;
|
||||
(*KeywordMap)["half3x2"] = EHTokHalf3x2;
|
||||
(*KeywordMap)["half3x3"] = EHTokHalf3x3;
|
||||
(*KeywordMap)["half3x4"] = EHTokHalf3x4;
|
||||
(*KeywordMap)["half4x1"] = EHTokHalf4x1;
|
||||
(*KeywordMap)["half4x2"] = EHTokHalf4x2;
|
||||
(*KeywordMap)["half4x3"] = EHTokHalf4x3;
|
||||
(*KeywordMap)["half4x4"] = EHTokHalf4x4;
|
||||
(*KeywordMap)["double1x1"] = EHTokDouble1x1;
|
||||
(*KeywordMap)["double1x2"] = EHTokDouble1x2;
|
||||
(*KeywordMap)["double1x3"] = EHTokDouble1x3;
|
||||
@@ -773,6 +789,22 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
|
||||
case EHTokFloat4x2:
|
||||
case EHTokFloat4x3:
|
||||
case EHTokFloat4x4:
|
||||
case EHTokHalf1x1:
|
||||
case EHTokHalf1x2:
|
||||
case EHTokHalf1x3:
|
||||
case EHTokHalf1x4:
|
||||
case EHTokHalf2x1:
|
||||
case EHTokHalf2x2:
|
||||
case EHTokHalf2x3:
|
||||
case EHTokHalf2x4:
|
||||
case EHTokHalf3x1:
|
||||
case EHTokHalf3x2:
|
||||
case EHTokHalf3x3:
|
||||
case EHTokHalf3x4:
|
||||
case EHTokHalf4x1:
|
||||
case EHTokHalf4x2:
|
||||
case EHTokHalf4x3:
|
||||
case EHTokHalf4x4:
|
||||
case EHTokDouble1x1:
|
||||
case EHTokDouble1x2:
|
||||
case EHTokDouble1x3:
|
||||
|
||||
@@ -216,6 +216,22 @@ enum EHlslTokenClass {
|
||||
EHTokFloat4x2,
|
||||
EHTokFloat4x3,
|
||||
EHTokFloat4x4,
|
||||
EHTokHalf1x1,
|
||||
EHTokHalf1x2,
|
||||
EHTokHalf1x3,
|
||||
EHTokHalf1x4,
|
||||
EHTokHalf2x1,
|
||||
EHTokHalf2x2,
|
||||
EHTokHalf2x3,
|
||||
EHTokHalf2x4,
|
||||
EHTokHalf3x1,
|
||||
EHTokHalf3x2,
|
||||
EHTokHalf3x3,
|
||||
EHTokHalf3x4,
|
||||
EHTokHalf4x1,
|
||||
EHTokHalf4x2,
|
||||
EHTokHalf4x3,
|
||||
EHTokHalf4x4,
|
||||
EHTokDouble1x1,
|
||||
EHTokDouble1x2,
|
||||
EHTokDouble1x3,
|
||||
|
||||
Reference in New Issue
Block a user