HLSL: implement TextureBuffer<type>
Almost equivalent to tbuffer, except members not at global scope. So, reference is "TextureBuffer_var.member", not simply "member".
This commit is contained in:
@@ -1453,6 +1453,10 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
|
||||
return acceptStructBufferType(type);
|
||||
break;
|
||||
|
||||
case EHTokTextureBuffer:
|
||||
return acceptTextureBufferType(type);
|
||||
break;
|
||||
|
||||
case EHTokConstantBuffer:
|
||||
return acceptConstantBufferType(type);
|
||||
|
||||
@@ -2127,6 +2131,43 @@ bool HlslGrammar::acceptConstantBufferType(TType& type)
|
||||
}
|
||||
}
|
||||
|
||||
// texture_buffer
|
||||
// : TEXTUREBUFFER LEFT_ANGLE type RIGHT_ANGLE
|
||||
bool HlslGrammar::acceptTextureBufferType(TType& type)
|
||||
{
|
||||
if (! acceptTokenClass(EHTokTextureBuffer))
|
||||
return false;
|
||||
|
||||
if (! acceptTokenClass(EHTokLeftAngle)) {
|
||||
expected("left angle bracket");
|
||||
return false;
|
||||
}
|
||||
|
||||
TType templateType;
|
||||
if (! acceptType(templateType)) {
|
||||
expected("type");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! acceptTokenClass(EHTokRightAngle)) {
|
||||
expected("right angle bracket");
|
||||
return false;
|
||||
}
|
||||
|
||||
templateType.getQualifier().storage = EvqBuffer;
|
||||
templateType.getQualifier().readonly = true;
|
||||
|
||||
TType blockType(templateType.getWritableStruct(), "", templateType.getQualifier());
|
||||
|
||||
blockType.getQualifier().storage = EvqBuffer;
|
||||
blockType.getQualifier().readonly = true;
|
||||
|
||||
type.shallowCopy(blockType);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// struct_buffer
|
||||
// : APPENDSTRUCTUREDBUFFER
|
||||
// | BYTEADDRESSBUFFER
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace glslang {
|
||||
bool acceptTextureType(TType&);
|
||||
bool acceptSubpassInputType(TType&);
|
||||
bool acceptStructBufferType(TType&);
|
||||
bool acceptTextureBufferType(TType&);
|
||||
bool acceptConstantBufferType(TType&);
|
||||
bool acceptStruct(TType&, TIntermNode*& nodeList);
|
||||
bool acceptStructDeclarationList(TTypeList*&, TIntermNode*& nodeList, TVector<TFunctionDeclarator>&);
|
||||
|
||||
@@ -345,6 +345,7 @@ void HlslScanContext::fillInKeywordMap()
|
||||
(*KeywordMap)["RWByteAddressBuffer"] = EHTokRWByteAddressBuffer;
|
||||
(*KeywordMap)["RWStructuredBuffer"] = EHTokRWStructuredBuffer;
|
||||
(*KeywordMap)["StructuredBuffer"] = EHTokStructuredBuffer;
|
||||
(*KeywordMap)["TextureBuffer"] = EHTokTextureBuffer;
|
||||
|
||||
(*KeywordMap)["class"] = EHTokClass;
|
||||
(*KeywordMap)["struct"] = EHTokStruct;
|
||||
@@ -829,6 +830,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
|
||||
case EHTokRWByteAddressBuffer:
|
||||
case EHTokRWStructuredBuffer:
|
||||
case EHTokStructuredBuffer:
|
||||
case EHTokTextureBuffer:
|
||||
case EHTokSubpassInput:
|
||||
case EHTokSubpassInputMS:
|
||||
return keyword;
|
||||
|
||||
@@ -283,6 +283,7 @@ enum EHlslTokenClass {
|
||||
EHTokRWByteAddressBuffer,
|
||||
EHTokRWStructuredBuffer,
|
||||
EHTokStructuredBuffer,
|
||||
EHTokTextureBuffer,
|
||||
|
||||
// variable, user type, ...
|
||||
EHTokIdentifier,
|
||||
|
||||
Reference in New Issue
Block a user