Commit 143dfc7e by Alexis Hetu Committed by Alexis Hétu

Added RG8 fragment output format

Tying up loose ends from the new output formats project. One of the missing outputs was the RG8 format, which I added here. Change-Id: I865ad4c462e892dbc3a7820003b2390b54453ee9 Reviewed-on: https://swiftshader-review.googlesource.com/7171Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 827d07ab
...@@ -604,6 +604,7 @@ namespace sw ...@@ -604,6 +604,7 @@ namespace sw
case FORMAT_A8B8G8R8: case FORMAT_A8B8G8R8:
case FORMAT_SRGB8_X8: case FORMAT_SRGB8_X8:
case FORMAT_SRGB8_A8: case FORMAT_SRGB8_A8:
case FORMAT_G8R8:
case FORMAT_R8: case FORMAT_R8:
case FORMAT_A8: case FORMAT_A8:
case FORMAT_G16R16: case FORMAT_G16R16:
...@@ -741,6 +742,7 @@ namespace sw ...@@ -741,6 +742,7 @@ namespace sw
case FORMAT_X8B8G8R8: case FORMAT_X8B8G8R8:
case FORMAT_SRGB8_X8: case FORMAT_SRGB8_X8:
case FORMAT_SRGB8_A8: case FORMAT_SRGB8_A8:
case FORMAT_G8R8:
case FORMAT_R8: case FORMAT_R8:
case FORMAT_A8: case FORMAT_A8:
case FORMAT_G16R16: case FORMAT_G16R16:
......
...@@ -1395,6 +1395,7 @@ namespace sw ...@@ -1395,6 +1395,7 @@ namespace sw
case FORMAT_A8B8G8R8: case FORMAT_A8B8G8R8:
case FORMAT_SRGB8_X8: case FORMAT_SRGB8_X8:
case FORMAT_SRGB8_A8: case FORMAT_SRGB8_A8:
case FORMAT_G8R8:
case FORMAT_R8: case FORMAT_R8:
current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080); current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080); current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
...@@ -1513,6 +1514,13 @@ namespace sw ...@@ -1513,6 +1514,13 @@ namespace sw
current.y = As<Short4>(UnpackHigh(current.y, current.x)); current.y = As<Short4>(UnpackHigh(current.y, current.x));
} }
break; break;
case FORMAT_G8R8:
current.x = As<Short4>(As<UShort4>(current.x) >> 8);
current.y = As<Short4>(As<UShort4>(current.y) >> 8);
current.x = As<Short4>(Pack(As<UShort4>(current.x), As<UShort4>(current.x)));
current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.y)));
current.x = UnpackLow(As<Byte8>(current.x), As<Byte8>(current.y));
break;
case FORMAT_R8: case FORMAT_R8:
current.x = As<Short4>(As<UShort4>(current.x) >> 8); current.x = As<Short4>(As<UShort4>(current.x) >> 8);
current.x = As<Short4>(Pack(As<UShort4>(current.x), As<UShort4>(current.x))); current.x = As<Short4>(Pack(As<UShort4>(current.x), As<UShort4>(current.x)));
...@@ -1713,6 +1721,31 @@ namespace sw ...@@ -1713,6 +1721,31 @@ namespace sw
*Pointer<Short4>(buffer) = c23; *Pointer<Short4>(buffer) = c23;
} }
break; break;
case FORMAT_G8R8:
if((rgbaWriteMask & 0x00000003) != 0x0)
{
Pointer<Byte> buffer = cBuffer + 2 * x;
Int2 value;
value = Insert(value, *Pointer<Int>(buffer), 0);
Int pitch = *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
value = Insert(value, *Pointer<Int>(buffer + pitch), 1);
Int2 packedCol = As<Int2>(current.x);
UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
if((rgbaWriteMask & 0x3) != 0x3)
{
Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
mergedMask &= rgbaMask;
}
packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask));
*Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
*Pointer<UInt>(buffer + pitch) = As<UInt>(Extract(packedCol, 1));
}
break;
case FORMAT_R8: case FORMAT_R8:
if(rgbaWriteMask & 0x00000001) if(rgbaWriteMask & 0x00000001)
{ {
......
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