HLSL: Fix #1332: consistently use uint for counter buf typing.

This commit is contained in:
John Kessenich
2018-04-10 11:57:20 -06:00
parent 1dcd162399
commit 6ae18707f9
9 changed files with 345 additions and 347 deletions

View File

@@ -3164,7 +3164,7 @@ bool HlslParseContext::hasStructBuffCounter(const TType& type) const
void HlslParseContext::counterBufferType(const TSourceLoc& loc, TType& type)
{
// Counter type
TType* counterType = new TType(EbtInt, EvqBuffer);
TType* counterType = new TType(EbtUint, EvqBuffer);
counterType->setFieldName(intermediate.implicitCounterName);
TTypeList* blockStruct = new TTypeList;
@@ -3216,7 +3216,7 @@ TIntermTyped* HlslParseContext::getStructBufferCounter(const TSourceLoc& loc, TI
TIntermTyped* index = intermediate.addConstantUnion(0, loc); // index to counter inside block struct
TIntermTyped* counterMember = intermediate.addIndex(EOpIndexDirectStruct, counterVar, index, loc);
counterMember->setType(TType(EbtInt));
counterMember->setType(TType(EbtUint));
return counterMember;
}
@@ -3249,7 +3249,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
// Some methods require a hidden internal counter, obtained via getStructBufferCounter().
// This lambda adds something to it and returns the old value.
const auto incDecCounter = [&](int incval) -> TIntermTyped* {
TIntermTyped* incrementValue = intermediate.addConstantUnion(incval, loc, true);
TIntermTyped* incrementValue = intermediate.addConstantUnion(static_cast<unsigned int>(incval), loc, true);
TIntermTyped* counter = getStructBufferCounter(loc, bufferObj); // obtain the counter member
if (counter == nullptr)