Commit c57ec6f0 by Chris Forbes

Add support for sampling VK_FORMAT_B10G11R11_UFLOAT_PACK32

Test: dEQP-VK.*b10g11r11* Bug: b/131246807 Change-Id: I3357cb5d6fccd37c1bf612fbc51380b490ded7d0 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/30508Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 7d091431
...@@ -251,6 +251,7 @@ namespace sw ...@@ -251,6 +251,7 @@ namespace sw
case VK_FORMAT_R8G8B8A8_SRGB: case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
if(componentCount < 2) c.y = Float4(0.0f); if(componentCount < 2) c.y = Float4(0.0f);
if(componentCount < 3) c.z = Float4(0.0f); if(componentCount < 3) c.z = Float4(0.0f);
if(componentCount < 4) c.w = Float4(1.0f); if(componentCount < 4) c.w = Float4(1.0f);
...@@ -1939,6 +1940,19 @@ namespace sw ...@@ -1939,6 +1940,19 @@ namespace sw
c.z = Float4((t0 >> 18) & UInt4(0x1FF)) * c.w; c.z = Float4((t0 >> 18) & UInt4(0x1FF)) * c.w;
break; break;
} }
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
{
Float4 t; // TODO: add Insert(UInt4, RValue<UInt>)
t.x = *Pointer<Float>(buffer[f0] + index[0] * 4);
t.y = *Pointer<Float>(buffer[f1] + index[1] * 4);
t.z = *Pointer<Float>(buffer[f2] + index[2] * 4);
t.w = *Pointer<Float>(buffer[f3] + index[3] * 4);
t0 = As<UInt4>(t);
c.x = As<Float4>(halfToFloatBits((t0 << 4) & UInt4(0x7FF0)));
c.y = As<Float4>(halfToFloatBits((t0 >> 7) & UInt4(0x7FF0)));
c.z = As<Float4>(halfToFloatBits((t0 >> 17) & UInt4(0x7FE0)));
break;
}
default: default:
UNIMPLEMENTED("Format %d", VkFormat(state.textureFormat)); UNIMPLEMENTED("Format %d", VkFormat(state.textureFormat));
} }
......
...@@ -1707,6 +1707,7 @@ bool Format::has16bitTextureFormat() const ...@@ -1707,6 +1707,7 @@ bool Format::has16bitTextureFormat() const
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return false; return false;
default: default:
UNIMPLEMENTED("Format: %d", int(format)); UNIMPLEMENTED("Format: %d", int(format));
...@@ -1761,6 +1762,7 @@ bool Format::has8bitTextureComponents() const ...@@ -1761,6 +1762,7 @@ bool Format::has8bitTextureComponents() const
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return false; return false;
default: default:
UNIMPLEMENTED("Format: %d", int(format)); UNIMPLEMENTED("Format: %d", int(format));
...@@ -1803,6 +1805,7 @@ bool Format::has16bitTextureComponents() const ...@@ -1803,6 +1805,7 @@ bool Format::has16bitTextureComponents() const
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return false; return false;
case VK_FORMAT_R16G16_UNORM: case VK_FORMAT_R16G16_UNORM:
case VK_FORMAT_R16G16B16A16_UNORM: case VK_FORMAT_R16G16B16A16_UNORM:
...@@ -1862,6 +1865,7 @@ bool Format::has32bitIntegerTextureComponents() const ...@@ -1862,6 +1865,7 @@ bool Format::has32bitIntegerTextureComponents() const
case VK_FORMAT_A2B10G10R10_UNORM_PACK32: case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return false; return false;
case VK_FORMAT_R32_SINT: case VK_FORMAT_R32_SINT:
case VK_FORMAT_R32_UINT: case VK_FORMAT_R32_UINT:
...@@ -1924,6 +1928,7 @@ bool Format::hasYuvFormat() const ...@@ -1924,6 +1928,7 @@ bool Format::hasYuvFormat() const
case VK_FORMAT_A2B10G10R10_UINT_PACK32: case VK_FORMAT_A2B10G10R10_UINT_PACK32:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_D32_SFLOAT: case VK_FORMAT_D32_SFLOAT:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return false; return false;
default: default:
UNIMPLEMENTED("Format: %d", int(format)); UNIMPLEMENTED("Format: %d", int(format));
...@@ -1977,6 +1982,7 @@ bool Format::isRGBComponent(int component) const ...@@ -1977,6 +1982,7 @@ bool Format::isRGBComponent(int component) const
case VK_FORMAT_R32G32B32A32_SFLOAT: case VK_FORMAT_R32G32B32A32_SFLOAT:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
return component < 3; return component < 3;
case VK_FORMAT_D32_SFLOAT: case VK_FORMAT_D32_SFLOAT:
return false; return false;
......
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