mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 20:00:11 +01:00
vk/test: Add test that prints format features
This commit is contained in:
parent
241b59cba0
commit
997596e4c4
1 changed files with 43 additions and 0 deletions
|
|
@ -13,6 +13,11 @@
|
|||
#include <poll.h>
|
||||
#include <libpng16/png.h>
|
||||
|
||||
#define for_each_bit(b, dword) \
|
||||
for (uint32_t __dword = (dword); \
|
||||
(b) = __builtin_ffs(__dword) - 1, __dword; \
|
||||
__dword &= ~(1 << (b)))
|
||||
|
||||
static void
|
||||
fail_if(int cond, const char *format, ...)
|
||||
{
|
||||
|
|
@ -298,6 +303,42 @@ test_timestamp(VkDevice device, VkQueue queue)
|
|||
vkFreeMemory(device, mem);
|
||||
}
|
||||
|
||||
static void
|
||||
test_formats(VkDevice device, VkQueue queue)
|
||||
{
|
||||
VkFormatProperties properties;
|
||||
size_t size = sizeof(properties);
|
||||
uint32_t f;
|
||||
|
||||
static const char *features[] = {
|
||||
"sampled_image",
|
||||
"storage_image",
|
||||
"storage_image_atomic",
|
||||
"uniform_texel_buffer",
|
||||
"storage_texel_buffer",
|
||||
"storage_texel_buffer_atomic",
|
||||
"vertex_buffer",
|
||||
"color_attachment",
|
||||
"color_attachment_blend",
|
||||
"depth_stencil_attachment",
|
||||
"conversion"
|
||||
};
|
||||
|
||||
vkGetFormatInfo(device,
|
||||
VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
VK_FORMAT_INFO_TYPE_PROPERTIES,
|
||||
&size, &properties);
|
||||
|
||||
printf("linear tiling features:");
|
||||
for_each_bit(f, properties.linearTilingFeatures)
|
||||
printf(" %s", features[f]);
|
||||
|
||||
printf("\noptimal tiling features:");
|
||||
for_each_bit(f, properties.optimalTilingFeatures)
|
||||
printf(" %s", features[f]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
test_triangle(VkDevice device, VkQueue queue)
|
||||
{
|
||||
|
|
@ -894,6 +935,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc > 1 && strcmp(argv[1], "timestamp") == 0) {
|
||||
test_timestamp(device, queue);
|
||||
} else if (argc > 1 && strcmp(argv[1], "formats") == 0) {
|
||||
test_formats(device, queue);
|
||||
} else {
|
||||
test_triangle(device, queue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue