summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-10-03 06:25:09 +0100
committerErik Faye-Lund <erik.faye-lund@collabora.com>2019-10-28 08:51:45 +0000
commit5dbfb0245930e045ed0fbccad361d03b3a078c8c (patch)
tree8e2702f4871c58fb1e30a098b178d996a1df5caf
parent6ae8686bff4ae380ead84fc6bdbb8f91b51f22eb (diff)
zink: add support for compressed formats
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/gallium/drivers/zink/zink_screen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index fd2fdb5faa9..06215132ca9 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -31,6 +31,7 @@
#include "os/os_process.h"
#include "util/u_debug.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_screen.h"
@@ -527,6 +528,20 @@ static const VkFormat formats[PIPE_FORMAT_COUNT] = {
[PIPE_FORMAT_Z16_UNORM] = VK_FORMAT_D16_UNORM,
[PIPE_FORMAT_X8Z24_UNORM] = VK_FORMAT_X8_D24_UNORM_PACK32,
[PIPE_FORMAT_Z24_UNORM_S8_UINT] = VK_FORMAT_D24_UNORM_S8_UINT,
+
+ // compressed formats
+ [PIPE_FORMAT_DXT1_RGB] = VK_FORMAT_BC1_RGB_UNORM_BLOCK,
+ [PIPE_FORMAT_DXT1_RGBA] = VK_FORMAT_BC1_RGBA_UNORM_BLOCK,
+ [PIPE_FORMAT_DXT3_RGBA] = VK_FORMAT_BC2_UNORM_BLOCK,
+ [PIPE_FORMAT_DXT5_RGBA] = VK_FORMAT_BC3_UNORM_BLOCK,
+ [PIPE_FORMAT_RGTC1_UNORM] = VK_FORMAT_BC4_UNORM_BLOCK,
+ [PIPE_FORMAT_RGTC1_SNORM] = VK_FORMAT_BC4_SNORM_BLOCK,
+ [PIPE_FORMAT_RGTC2_UNORM] = VK_FORMAT_BC5_UNORM_BLOCK,
+ [PIPE_FORMAT_RGTC2_SNORM] = VK_FORMAT_BC5_SNORM_BLOCK,
+ [PIPE_FORMAT_BPTC_RGBA_UNORM] = VK_FORMAT_BC7_UNORM_BLOCK,
+ [PIPE_FORMAT_BPTC_SRGBA] = VK_FORMAT_BC7_SRGB_BLOCK,
+ [PIPE_FORMAT_BPTC_RGB_FLOAT] = VK_FORMAT_BC6H_SFLOAT_BLOCK,
+ [PIPE_FORMAT_BPTC_RGB_UFLOAT] = VK_FORMAT_BC6H_UFLOAT_BLOCK,
};
VkFormat
@@ -578,6 +593,11 @@ zink_is_format_supported(struct pipe_screen *pscreen,
return FALSE;
}
+ const struct util_format_description *desc = util_format_description(format);
+ if (desc->layout == UTIL_FORMAT_LAYOUT_BPTC &&
+ !screen->feats.textureCompressionBC)
+ return FALSE;
+
return TRUE;
}