anv: add anv_is_format_emulated

anv_is_format_emulated returns true when a format is emulated.  It will
be used for ASTC LDR emulation, but it always return false at the
moment.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25467>
This commit is contained in:
Chia-I Wu
2023-09-28 09:28:21 -07:00
committed by Marge Bot
parent 94192418f8
commit 9ffe8b9235
2 changed files with 16 additions and 0 deletions
+3
View File
@@ -1351,6 +1351,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
device->has_protected_contexts = device->info.ver >= 12 &&
intel_gem_supports_protected_context(fd, device->info.kmd_type);
/* always false for now */
device->emu_astc_ldr = false;
result = anv_physical_device_init_heaps(device, fd);
if (result != VK_SUCCESS)
goto fail_base;
+13
View File
@@ -92,6 +92,7 @@
#include "vk_shader_module.h"
#include "vk_sync.h"
#include "vk_sync_timeline.h"
#include "vk_texcompress_astc.h"
#include "vk_util.h"
#include "vk_query_pool.h"
#include "vk_queue.h"
@@ -921,6 +922,9 @@ struct anv_physical_device {
*/
bool has_sparse;
/** True if ASTC LDR is supported via emulation */
bool emu_astc_ldr;
/**/
bool uses_ex_bso;
@@ -4479,6 +4483,15 @@ bool anv_formats_ccs_e_compatible(const struct intel_device_info *devinfo,
extern VkFormat
vk_format_from_android(unsigned android_format, unsigned android_usage);
static inline bool
anv_is_format_emulated(const struct anv_physical_device *pdevice, VkFormat format)
{
if (pdevice->emu_astc_ldr &&
vk_texcompress_astc_emulation_format(format) != VK_FORMAT_UNDEFINED)
return true;
return false;
}
static inline struct isl_swizzle
anv_swizzle_for_render(struct isl_swizzle swizzle)
{