Fixed default alpha value for integer types
The default alpha value for integer types is 1 and not the
largest representable value for that type, as it was
previously implemented. A value of 1 still means that the
texture is opaque. This fixes ~60 fragment output tests.
Change-Id: I96650fc8ba4812dcb8a2787979c6829f14f0960e
Reviewed-on: https://swiftshader-review.googlesource.com/7190
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Renderer/Blitter.cpp b/src/Renderer/Blitter.cpp
index 900b77b..9ee53de 100644
--- a/src/Renderer/Blitter.cpp
+++ b/src/Renderer/Blitter.cpp
@@ -697,7 +697,7 @@
bool Blitter::read(Int4 &c, Pointer<Byte> element, Format format)
{
- c = Int4(0, 0, 0, 0xFFFFFFFF);
+ c = Int4(0, 0, 0, 1);
switch(format)
{
@@ -709,10 +709,6 @@
c = Insert(c, Int(*Pointer<SByte>(element + 1)), 1);
case FORMAT_R8I:
c = Insert(c, Int(*Pointer<SByte>(element)), 0);
- if(format != FORMAT_A8B8G8R8I)
- {
- c = Insert(c, Int(0x7F), 3); // Set alpha
- }
break;
case FORMAT_A8B8G8R8UI:
c = Insert(c, Int(*Pointer<Byte>(element + 3)), 3);
@@ -722,10 +718,6 @@
c = Insert(c, Int(*Pointer<Byte>(element + 1)), 1);
case FORMAT_R8UI:
c = Insert(c, Int(*Pointer<Byte>(element)), 0);
- if(format != FORMAT_A8B8G8R8UI)
- {
- c = Insert(c, Int(0xFF), 3); // Set alpha
- }
break;
case FORMAT_A16B16G16R16I:
c = Insert(c, Int(*Pointer<Short>(element + 6)), 3);
@@ -735,10 +727,6 @@
c = Insert(c, Int(*Pointer<Short>(element + 2)), 1);
case FORMAT_R16I:
c = Insert(c, Int(*Pointer<Short>(element)), 0);
- if(format != FORMAT_A16B16G16R16I)
- {
- c = Insert(c, Int(0x7FFF), 3); // Set alpha
- }
break;
case FORMAT_A16B16G16R16UI:
c = Insert(c, Int(*Pointer<UShort>(element + 6)), 3);
@@ -748,10 +736,6 @@
c = Insert(c, Int(*Pointer<UShort>(element + 2)), 1);
case FORMAT_R16UI:
c = Insert(c, Int(*Pointer<UShort>(element)), 0);
- if(format != FORMAT_A16B16G16R16UI)
- {
- c = Insert(c, Int(0xFFFF), 3); // Set alpha
- }
break;
case FORMAT_A32B32G32R32I:
c = *Pointer<Int4>(element);
@@ -762,7 +746,6 @@
c = Insert(c, *Pointer<Int>(element + 4), 1);
case FORMAT_R32I:
c = Insert(c, *Pointer<Int>(element), 0);
- c = Insert(c, Int(0x7FFFFFFF), 3); // Set alpha
break;
case FORMAT_A32B32G32R32UI:
c = *Pointer<UInt4>(element);
@@ -773,7 +756,6 @@
c = Insert(c, Int(*Pointer<UInt>(element + 4)), 1);
case FORMAT_R32UI:
c = Insert(c, Int(*Pointer<UInt>(element)), 0);
- c = Insert(c, Int(UInt(0xFFFFFFFFU)), 3); // Set alpha
break;
default:
return false;