Commit 9e46bb61 by Nicolas Capens Committed by Nicolas Capens

Support _PACK32 storage image formats and fix asserts

The _PACK32 formats have non-packed equivalents with the exact same data layout, so there's no reason not to have them support the same features. Also add missing switch cases to avoid debug asserts, and remove 3-byte formats which we don't support at all. Bug: b/158259842 Tests: dEQP-VK.*pack32* Change-Id: Ie655571d50f1af3d97204466f9053b81e32f1490 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45908 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com>
parent ea6f21a0
......@@ -1521,9 +1521,13 @@ Vector4s SamplerCore::sampleTexel(UInt index[4], Pointer<Byte> buffer)
c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
break;
case VK_FORMAT_R8G8B8A8_UNORM:
case VK_FORMAT_R8G8B8A8_SINT:
case VK_FORMAT_R8G8B8A8_SNORM:
case VK_FORMAT_R8G8B8A8_SINT:
case VK_FORMAT_R8G8B8A8_SRGB:
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SINT_PACK32:
case VK_FORMAT_A8B8G8R8_SRGB_PACK32:
c.z = As<Short4>(UnpackHigh(c.x, c.y));
c.x = As<Short4>(UnpackLow(c.x, c.y));
c.y = c.x;
......@@ -1533,7 +1537,8 @@ Vector4s SamplerCore::sampleTexel(UInt index[4], Pointer<Byte> buffer)
c.z = UnpackLow(As<Byte8>(Short4(0)), As<Byte8>(c.z));
c.w = UnpackHigh(As<Byte8>(Short4(0)), As<Byte8>(c.w));
// Propagate sign bit
if(state.textureFormat == VK_FORMAT_R8G8B8A8_SINT)
if(state.textureFormat == VK_FORMAT_R8G8B8A8_SINT ||
state.textureFormat == VK_FORMAT_A8B8G8R8_SINT_PACK32)
{
c.x >>= 8;
c.y >>= 8;
......@@ -1542,6 +1547,7 @@ Vector4s SamplerCore::sampleTexel(UInt index[4], Pointer<Byte> buffer)
}
break;
case VK_FORMAT_R8G8B8A8_UINT:
case VK_FORMAT_A8B8G8R8_UINT_PACK32:
c.z = As<Short4>(UnpackHigh(c.x, c.y));
c.x = As<Short4>(UnpackLow(c.x, c.y));
c.y = c.x;
......
......@@ -639,6 +639,10 @@ void PhysicalDevice::getFormatProperties(Format format, VkFormatProperties *pFor
case VK_FORMAT_R8G8B8A8_SNORM:
case VK_FORMAT_R8G8B8A8_UINT:
case VK_FORMAT_R8G8B8A8_SINT:
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
case VK_FORMAT_A8B8G8R8_UINT_PACK32:
case VK_FORMAT_A8B8G8R8_SINT_PACK32:
case VK_FORMAT_R16G16B16A16_UINT:
case VK_FORMAT_R16G16B16A16_SINT:
case VK_FORMAT_R16G16B16A16_SFLOAT:
......@@ -676,10 +680,6 @@ void PhysicalDevice::getFormatProperties(Format format, VkFormatProperties *pFor
pFormatProperties->optimalTilingFeatures |=
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
// [[fallthrough]]
case VK_FORMAT_A8B8G8R8_UNORM_PACK32:
case VK_FORMAT_A8B8G8R8_SNORM_PACK32:
case VK_FORMAT_A8B8G8R8_UINT_PACK32:
case VK_FORMAT_A8B8G8R8_SINT_PACK32:
pFormatProperties->bufferFeatures |=
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
break;
......
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