Fix max index of buffer lookup component being applied to the wrong idx

* The component must be clamped (ie if the stride is 8 bytes, .z is not
  valid) rather than the place of the component (.xxxy is fine - even if
  .y is in the 'w' place)
This commit is contained in:
baldurk
2017-02-21 11:03:52 +00:00
parent 6d428669d5
commit c141137a59
+2 -2
View File
@@ -2601,7 +2601,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const
for(int i = 0; i < 4; i++)
{
uint8_t comp = op.operands[srcIdx + 1].comps[i];
if(op.operands[srcIdx + 1].comps[i] == 0xff || i >= maxIndex)
if(op.operands[srcIdx + 1].comps[i] == 0xff || comp >= maxIndex)
comp = 0;
fetch.value.uv[i] = datau32[comp];
@@ -2622,7 +2622,7 @@ State State::GetNext(GlobalState &global, State quad[4]) const
{
uint8_t comp = op.operands[0].comps[i];
// masks must be contiguous from x, if we reach the 'end' we're done
if(comp == 0xff || i >= maxIndex)
if(comp == 0xff || comp >= maxIndex)
break;
datau32[i] = srcOpers[srcIdx].value.uv[i];