Commit 56dd42fb by Alexis Hetu Committed by Alexis Hétu

ETC1 fix for npot textures

Simple fix that replaces width by pitch where needed to avoid misalignment due to the difference between pitch and width in npot textures. Change-Id: I7acddc28fae21dddf870a6ef80ac7984cfaf8e0f Reviewed-on: https://swiftshader-review.googlesource.com/3931Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 92ab1986
......@@ -1968,7 +1968,7 @@ namespace sw
{
for(int x = 0; x < external.width; x += 4)
{
bgrx8 *color = reinterpret_cast<bgrx8*>(&dest[x + y * internal.width]);
bgrx8 *color = reinterpret_cast<bgrx8*>(&dest[x + y * internal.pitchP]);
int r1, g1, b1;
int r2, g2, b2;
......@@ -2038,7 +2038,7 @@ namespace sw
if((x + 1) < internal.width) color[1] = subblockColors0[source->getIndex(1, j)];
if((x + 2) < internal.width) color[2] = subblockColors0[source->getIndex(2, j)];
if((x + 3) < internal.width) color[3] = subblockColors0[source->getIndex(3, j)];
color += internal.width;
color += internal.pitchP;
}
for(int j = 2; j < 4 && (y + j) < internal.height; j++)
......@@ -2047,7 +2047,7 @@ namespace sw
if((x + 1) < internal.width) color[1] = subblockColors1[source->getIndex(1, j)];
if((x + 2) < internal.width) color[2] = subblockColors1[source->getIndex(2, j)];
if((x + 3) < internal.width) color[3] = subblockColors1[source->getIndex(3, j)];
color += internal.width;
color += internal.pitchP;
}
}
else
......@@ -2058,7 +2058,7 @@ namespace sw
if((x + 1) < internal.width) color[1] = subblockColors0[source->getIndex(1, j)];
if((x + 2) < internal.width) color[2] = subblockColors1[source->getIndex(2, j)];
if((x + 3) < internal.width) color[3] = subblockColors1[source->getIndex(3, j)];
color += internal.width;
color += internal.pitchP;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment