Merge pull request #1579 from TiemoJung/handle_c_register

HLSL: implemented c register handling
This commit is contained in:
John Kessenich 2018-11-14 11:40:45 -07:00 committed by GitHub
commit e3cc0d35f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View File

@ -5,7 +5,7 @@ struct sb_t
bool test2;
}; // stride = 20
StructuredBuffer<sb_t> sbuf : register(c10);
StructuredBuffer<sb_t> sbuf : register(t10);
StructuredBuffer<float> sbuf2;
float4 main(uint pos : FOO) : SV_Target0

View File

@ -6066,13 +6066,22 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
}
}
// TODO: learn what all these really mean and how they interact with regNumber and subComponent
// more information about register types see
// https://docs.microsoft.com/en-us/windows/desktop/direct3dhlsl/dx-graphics-hlsl-variable-register
const std::vector<std::string>& resourceInfo = intermediate.getResourceSetBinding();
switch (std::tolower(desc[0])) {
case 'b':
case 't':
case 'c':
// c register is the register slot in the global const buffer
// each slot is a vector of 4 32 bit components
qualifier.layoutOffset = regNumber * 4 * 4;
break;
// const buffer register slot
case 'b':
// textrues and structured buffers
case 't':
// samplers
case 's':
// uav resources
case 'u':
// if nothing else has set the binding, do so now
// (other mechanisms override this one)