Commit 57977c1c by Chris Forbes

Add storage image support for R16G16_{UINT,SINT,SFLOAT}

This is a step toward being able to claim support for storageImageExtendedFormats. Bug: b/146579770 Test: dEQP-VK.*r16g16* Change-Id: Iba658f39271f7e181c10c117e53c8e3dbdf37595 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39769 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 7d0ce41d
......@@ -43,6 +43,9 @@ VkFormat SpirvFormatToVulkanFormat(spv::ImageFormat format)
case spv::ImageFormatRg32f: return VK_FORMAT_R32G32_SFLOAT;
case spv::ImageFormatRg32i: return VK_FORMAT_R32G32_SINT;
case spv::ImageFormatRg32ui: return VK_FORMAT_R32G32_UINT;
case spv::ImageFormatRg16f: return VK_FORMAT_R16G16_SFLOAT;
case spv::ImageFormatRg16i: return VK_FORMAT_R16G16_SINT;
case spv::ImageFormatRg16ui: return VK_FORMAT_R16G16_UINT;
default:
UNIMPLEMENTED("SPIR-V ImageFormat %u", format);
......@@ -922,8 +925,18 @@ SpirvShader::EmitResult SpirvShader::EmitImageWrite(InsnIterator insn, EmitState
packed[1] = texel.Int(1);
numPackedElements = 2;
break;
case spv::ImageFormatRg16f:
texelSize = 4;
packed[0] = floatToHalfBits(texel.UInt(0), false) | floatToHalfBits(texel.UInt(1), true);
numPackedElements = 1;
break;
case spv::ImageFormatRg16i:
case spv::ImageFormatRg16ui:
texelSize = 4;
packed[0] = SIMD::UInt(texel.UInt(0) & SIMD::UInt(0xffff)) | (SIMD::UInt(texel.UInt(1) & SIMD::UInt(0xffff)) << 16);
numPackedElements = 1;
break;
case spv::ImageFormatR11fG11fB10f:
case spv::ImageFormatR16f:
case spv::ImageFormatRgba16:
......@@ -937,12 +950,10 @@ SpirvShader::EmitResult SpirvShader::EmitImageWrite(InsnIterator insn, EmitState
case spv::ImageFormatRg8Snorm:
case spv::ImageFormatR16Snorm:
case spv::ImageFormatR8Snorm:
case spv::ImageFormatRg16i:
case spv::ImageFormatRg8i:
case spv::ImageFormatR16i:
case spv::ImageFormatR8i:
case spv::ImageFormatRgb10a2ui:
case spv::ImageFormatRg16ui:
case spv::ImageFormatRg8ui:
case spv::ImageFormatR16ui:
case spv::ImageFormatR8ui:
......
......@@ -580,6 +580,9 @@ void PhysicalDevice::getFormatProperties(Format format, VkFormatProperties *pFor
case VK_FORMAT_R32G32B32A32_UINT:
case VK_FORMAT_R32G32B32A32_SINT:
case VK_FORMAT_R32G32B32A32_SFLOAT:
case VK_FORMAT_R16G16_UINT:
case VK_FORMAT_R16G16_SINT:
case VK_FORMAT_R16G16_SFLOAT:
pFormatProperties->optimalTilingFeatures |=
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
// Fall through
......
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