#include "vk_util.h"
#include "drm-uapi/drm_fourcc.h"
-#define FMT6_x -1
-
#define TU6_FMT(vkfmt, hwfmt, swapfmt, valid) \
[VK_FORMAT_##vkfmt] = { \
.fmt = FMT6_##hwfmt, \
#define TU6_xTC(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE | FMT_COLOR)
#define TU6_Vxx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_VERTEX)
#define TU6_xTx(vk, fmt, swap) TU6_FMT(vk, fmt, swap, FMT_TEXTURE)
-#define TU6_xxx(vk, fmt, swap) TU6_FMT(vk, x, WZYX, false)
+#define TU6_xxx(vk, fmt, swap) TU6_FMT(vk, NONE, WZYX, 0)
static const struct tu_native_format tu6_format_table[] = {
TU6_xxx(UNDEFINED, x, x), /* 0 */
optimal |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT;
+ /* IBO's don't have a swap field at all, so swapped formats can't be
+ * supported, even with linear images.
+ *
+ * TODO: See if setting the swap field from the tex descriptor works,
+ * after we enable shaderStorageImageReadWithoutFormat and there are
+ * tests for these formats.
+ */
+ if (native_fmt.swap == WZYX) {
+ optimal |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
+ buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
+ }
+
+ /* TODO: The blob also exposes these for R16G16_UINT/R16G16_SINT, but we
+ * don't have any tests for those.
+ */
+ if (format == VK_FORMAT_R32_UINT || format == VK_FORMAT_R32_SINT) {
+ optimal |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
+ buffer |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
+ }
+
if (vk_format_is_float(format) ||
vk_format_is_unorm(format) ||
vk_format_is_snorm(format) ||
* the implementation for use in vkCreateImage, then all members of
* imageFormatProperties will be filled with zero.
*/
- base_props->imageFormatProperties = (VkImageFormatProperties) { 0 };
+ base_props->imageFormatProperties = (VkImageFormatProperties) {};
}
return result;