Commit a4308130 by Alexis Hetu Committed by Alexis Hétu

Fixed sRGB multisample tests

The blitter was not doing the sRGB conversion on the first of N source samples when accumulating samples for doing an sRGB resolve. This cl also includes Chris' initial fix for PixelRoutine and SpirvShader. See: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31928 Change-Id: I97ce06fb39788fd623eb9b5c0203e45fd911c1dd Tests: dEQP-VK.renderpass.suballocation.multisample.*.samples_4 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/32848Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Presubmit-Ready: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com>
parent df84b946
...@@ -1441,6 +1441,11 @@ namespace sw ...@@ -1441,6 +1441,11 @@ namespace sw
if(state.srcSamples > 1) // Resolve multisampled source if(state.srcSamples > 1) // Resolve multisampled source
{ {
if(state.convertSRGB && state.sourceFormat.isSRGBformat()) // sRGB -> RGB
{
if(!ApplyScaleAndClamp(color, state)) return nullptr;
preScaled = true;
}
Float4 accum = color; Float4 accum = color;
for(int i = 1; i < state.srcSamples; i++) for(int i = 1; i < state.srcSamples; i++)
{ {
......
...@@ -1913,13 +1913,6 @@ namespace sw ...@@ -1913,13 +1913,6 @@ namespace sw
UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index])); UNIMPLEMENTED("VkFormat: %d", int(state.targetFormat[index]));
} }
if(isSRGB(index))
{
sRGBtoLinear(pixel.x);
sRGBtoLinear(pixel.y);
sRGBtoLinear(pixel.z);
}
// Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor // Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
Vector4f sourceFactor; Vector4f sourceFactor;
Vector4f destFactor; Vector4f destFactor;
......
...@@ -274,10 +274,7 @@ namespace ...@@ -274,10 +274,7 @@ namespace
sw::SIMD::Int linear = CmpLT(c, sw::SIMD::Float(0.04045f)); sw::SIMD::Int linear = CmpLT(c, sw::SIMD::Float(0.04045f));
sw::SIMD::Float s = c; return rr::As<sw::SIMD::Float>((linear & rr::As<sw::SIMD::Int>(lc)) | (~linear & rr::As<sw::SIMD::Int>(ec))); // TODO: IfThenElse()
s.xyz = rr::As<sw::SIMD::Float>((linear & rr::As<sw::SIMD::Int>(lc)) | (~linear & rr::As<sw::SIMD::Int>(ec))); // TODO: IfThenElse()
return s;
} }
} // anonymous namespace } // anonymous namespace
...@@ -5310,7 +5307,7 @@ namespace sw ...@@ -5310,7 +5307,7 @@ namespace sw
dst.move(0, ::sRGBtoLinear(SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(0, ::sRGBtoLinear(SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(1, ::sRGBtoLinear(SIMD::Float(((packed[0]>>8) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(1, ::sRGBtoLinear(SIMD::Float(((packed[0]>>8) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(2, ::sRGBtoLinear(SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(2, ::sRGBtoLinear(SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(3, ::sRGBtoLinear(SIMD::Float(((packed[0]>>24) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(3, SIMD::Float(((packed[0]>>24) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f));
break; break;
case VK_FORMAT_B8G8R8A8_UNORM: case VK_FORMAT_B8G8R8A8_UNORM:
dst.move(0, SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)); dst.move(0, SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f));
...@@ -5322,7 +5319,7 @@ namespace sw ...@@ -5322,7 +5319,7 @@ namespace sw
dst.move(0, ::sRGBtoLinear(SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(0, ::sRGBtoLinear(SIMD::Float(((packed[0]>>16) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(1, ::sRGBtoLinear(SIMD::Float(((packed[0]>>8) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(1, ::sRGBtoLinear(SIMD::Float(((packed[0]>>8) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(2, ::sRGBtoLinear(SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(2, ::sRGBtoLinear(SIMD::Float((packed[0] & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f)));
dst.move(3, ::sRGBtoLinear(SIMD::Float(((packed[0]>>24) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f))); dst.move(3, SIMD::Float(((packed[0]>>24) & SIMD::Int(0xFF))) * SIMD::Float(1.0f / 255.f));
break; break;
case VK_FORMAT_R8G8B8A8_UINT: case VK_FORMAT_R8G8B8A8_UINT:
case VK_FORMAT_A8B8G8R8_UINT_PACK32: case VK_FORMAT_A8B8G8R8_UINT_PACK32:
......
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