Commit c101f742 by Sean Risser

Add decoder for BC6h

This passes all the non-sparse BC6h format tests in dEQP. Bug: b/151203718 Tests: dEQP-VK.*bc6* Change-Id: I5dacbc07bb54ff4fc384db974feaf7cfd0055e96 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45571 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarSean Risser <srisser@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 4f438a5a
...@@ -23,7 +23,7 @@ public: ...@@ -23,7 +23,7 @@ public:
/// @param dstPitch dst image pitch (bytes per row) /// @param dstPitch dst image pitch (bytes per row)
/// @param dstBpp dst image bytes per pixel /// @param dstBpp dst image bytes per pixel
/// @param n n in BCn format /// @param n n in BCn format
/// @param isNoAlphaU BC1: true if RGB, BC2/BC3: unused, BC4/BC5: true if unsigned /// @param isNoAlphaU BC1: true if RGB, BC2/BC3: unused, BC4/BC5/BC6H: true if unsigned
/// @return true if the decoding was performed /// @return true if the decoding was performed
static bool Decode(const unsigned char *src, unsigned char *dst, int w, int h, int dstPitch, int dstBpp, int n, bool isNoAlphaU); static bool Decode(const unsigned char *src, unsigned char *dst, int w, int h, int dstPitch, int dstBpp, int n, bool isNoAlphaU);
......
...@@ -626,7 +626,7 @@ VkFormat Format::getDecompressedFormat() const ...@@ -626,7 +626,7 @@ VkFormat Format::getDecompressedFormat() const
return VK_FORMAT_R8G8B8A8_SRGB; return VK_FORMAT_R8G8B8A8_SRGB;
case VK_FORMAT_BC6H_UFLOAT_BLOCK: case VK_FORMAT_BC6H_UFLOAT_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK: case VK_FORMAT_BC6H_SFLOAT_BLOCK:
return VK_FORMAT_R32G32B32A32_SFLOAT; return VK_FORMAT_R16G16B16A16_SFLOAT;
default: default:
UNSUPPORTED("format: %d", int(format)); UNSUPPORTED("format: %d", int(format));
return VK_FORMAT_UNDEFINED; return VK_FORMAT_UNDEFINED;
......
...@@ -91,8 +91,8 @@ int GetBCn(const vk::Format &format) ...@@ -91,8 +91,8 @@ int GetBCn(const vk::Format &format)
} }
// Returns true for BC1 if we have an RGB format, false for RGBA // Returns true for BC1 if we have an RGB format, false for RGBA
// Returns true for BC4 and BC5 if we have an unsigned format, false for signed // Returns true for BC4, BC5, BC6H if we have an unsigned format, false for signed
// Ignored by BC2, BC3, BC6 and BC7 // Ignored by BC2, BC3, and BC7
bool GetNoAlphaOrUnsigned(const vk::Format &format) bool GetNoAlphaOrUnsigned(const vk::Format &format)
{ {
switch(format) switch(format)
...@@ -101,6 +101,7 @@ bool GetNoAlphaOrUnsigned(const vk::Format &format) ...@@ -101,6 +101,7 @@ bool GetNoAlphaOrUnsigned(const vk::Format &format)
case VK_FORMAT_BC1_RGB_SRGB_BLOCK: case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
case VK_FORMAT_BC4_UNORM_BLOCK: case VK_FORMAT_BC4_UNORM_BLOCK:
case VK_FORMAT_BC5_UNORM_BLOCK: case VK_FORMAT_BC5_UNORM_BLOCK:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
return true; return true;
case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: case VK_FORMAT_BC1_RGBA_UNORM_BLOCK:
case VK_FORMAT_BC1_RGBA_SRGB_BLOCK: case VK_FORMAT_BC1_RGBA_SRGB_BLOCK:
...@@ -110,7 +111,6 @@ bool GetNoAlphaOrUnsigned(const vk::Format &format) ...@@ -110,7 +111,6 @@ bool GetNoAlphaOrUnsigned(const vk::Format &format)
case VK_FORMAT_BC3_SRGB_BLOCK: case VK_FORMAT_BC3_SRGB_BLOCK:
case VK_FORMAT_BC4_SNORM_BLOCK: case VK_FORMAT_BC4_SNORM_BLOCK:
case VK_FORMAT_BC5_SNORM_BLOCK: case VK_FORMAT_BC5_SNORM_BLOCK:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK: case VK_FORMAT_BC6H_SFLOAT_BLOCK:
case VK_FORMAT_BC7_SRGB_BLOCK: case VK_FORMAT_BC7_SRGB_BLOCK:
case VK_FORMAT_BC7_UNORM_BLOCK: case VK_FORMAT_BC7_UNORM_BLOCK:
......
...@@ -90,7 +90,7 @@ const VkPhysicalDeviceFeatures &PhysicalDevice::getFeatures() const ...@@ -90,7 +90,7 @@ const VkPhysicalDeviceFeatures &PhysicalDevice::getFeatures() const
#else #else
VK_FALSE, // textureCompressionASTC_LDR VK_FALSE, // textureCompressionASTC_LDR
#endif #endif
VK_FALSE, // textureCompressionBC VK_TRUE, // textureCompressionBC
VK_FALSE, // occlusionQueryPrecise VK_FALSE, // occlusionQueryPrecise
VK_FALSE, // pipelineStatisticsQuery VK_FALSE, // pipelineStatisticsQuery
VK_TRUE, // vertexPipelineStoresAndAtomics VK_TRUE, // vertexPipelineStoresAndAtomics
...@@ -530,6 +530,8 @@ void PhysicalDevice::getFormatProperties(Format format, VkFormatProperties *pFor ...@@ -530,6 +530,8 @@ void PhysicalDevice::getFormatProperties(Format format, VkFormatProperties *pFor
case VK_FORMAT_BC4_SNORM_BLOCK: case VK_FORMAT_BC4_SNORM_BLOCK:
case VK_FORMAT_BC5_UNORM_BLOCK: case VK_FORMAT_BC5_UNORM_BLOCK:
case VK_FORMAT_BC5_SNORM_BLOCK: case VK_FORMAT_BC5_SNORM_BLOCK:
case VK_FORMAT_BC6H_UFLOAT_BLOCK:
case VK_FORMAT_BC6H_SFLOAT_BLOCK:
case VK_FORMAT_BC7_UNORM_BLOCK: case VK_FORMAT_BC7_UNORM_BLOCK:
case VK_FORMAT_BC7_SRGB_BLOCK: case VK_FORMAT_BC7_SRGB_BLOCK:
case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
......
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