HLSL: implement 4 (of 6) structuredbuffer types

This is a partial implemention of structurebuffers supporting:

* structured buffer types of:
*   StructuredBuffer
*   RWStructuredBuffer
*   ByteAddressBuffer
*   RWByteAddressBuffer

* Atomic operations on RWByteAddressBuffer

* Load/Load[234], Store/Store[234], GetDimensions methods (where allowed by type)

* globallycoherent flag

But NOT yet supporting:

* AppendStructuredBuffer / ConsumeStructuredBuffer types
* IncrementCounter/DecrementCounter methods

Please note: the stride returned by GetDimensions is as calculated by glslang for std430,
and may not match other environments in all cases.
This commit is contained in:
steve-lunarg
2017-02-12 17:50:28 -07:00
parent c8aed91524
commit 5da1f038d8
22 changed files with 3993 additions and 37 deletions

View File

@@ -118,6 +118,7 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["out"] = EHTokOut;
(*KeywordMap)["inout"] = EHTokInOut;
(*KeywordMap)["layout"] = EHTokLayout;
(*KeywordMap)["globallycoherent"] = EHTokGloballyCoherent;
(*KeywordMap)["point"] = EHTokPoint;
(*KeywordMap)["line"] = EHTokLine;
@@ -319,6 +320,13 @@ void HlslScanContext::fillInKeywordMap()
(*KeywordMap)["RWTexture3D"] = EHTokRWTexture3d;
(*KeywordMap)["RWBuffer"] = EHTokRWBuffer;
(*KeywordMap)["AppendStructuredBuffer"] = EHTokAppendStructuredBuffer;
(*KeywordMap)["ByteAddressBuffer"] = EHTokByteAddressBuffer;
(*KeywordMap)["ConsumeStructuredBuffer"] = EHTokConsumeStructuredBuffer;
(*KeywordMap)["RWByteAddressBuffer"] = EHTokRWByteAddressBuffer;
(*KeywordMap)["RWStructuredBuffer"] = EHTokRWStructuredBuffer;
(*KeywordMap)["StructuredBuffer"] = EHTokStructuredBuffer;
(*KeywordMap)["struct"] = EHTokStruct;
(*KeywordMap)["cbuffer"] = EHTokCBuffer;
(*KeywordMap)["tbuffer"] = EHTokTBuffer;
@@ -527,6 +535,7 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
case EHTokInOut:
case EHTokPrecise:
case EHTokLayout:
case EHTokGloballyCoherent:
return keyword;
// primitive types
@@ -722,6 +731,12 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
case EHTokRWTexture2darray:
case EHTokRWTexture3d:
case EHTokRWBuffer:
case EHTokAppendStructuredBuffer:
case EHTokByteAddressBuffer:
case EHTokConsumeStructuredBuffer:
case EHTokRWByteAddressBuffer:
case EHTokRWStructuredBuffer:
case EHTokStructuredBuffer:
return keyword;
// variable, user type, ...