Header is defined at vkGetPipelineCacheData spec, in any vulkan
version, and anv, tu and radv were using the same struct, and v3dv was
about to do the same.
Defining the same struct four times seemed odd, so let's define on a
common place.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6058>
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_shader.h"
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_shader.h"
+#include "vulkan/util/vk_util.h"
#include "ac_nir_to_llvm.h"
#include "ac_nir_to_llvm.h"
-struct cache_header {
- uint32_t header_size;
- uint32_t header_version;
- uint32_t vendor_id;
- uint32_t device_id;
- uint8_t uuid[VK_UUID_SIZE];
-};
-
bool
radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
const void *data, size_t size)
{
struct radv_device *device = cache->device;
bool
radv_pipeline_cache_load(struct radv_pipeline_cache *cache,
const void *data, size_t size)
{
struct radv_device *device = cache->device;
- struct cache_header header;
+ struct vk_pipeline_cache_header header;
if (size < sizeof(header))
return false;
if (size < sizeof(header))
return false;
{
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
{
RADV_FROM_HANDLE(radv_device, device, _device);
RADV_FROM_HANDLE(radv_pipeline_cache, cache, _cache);
- struct cache_header *header;
+ struct vk_pipeline_cache_header *header;
VkResult result = VK_SUCCESS;
radv_pipeline_cache_lock(cache);
VkResult result = VK_SUCCESS;
radv_pipeline_cache_lock(cache);
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
#include "util/u_atomic.h"
#include "util/disk_cache.h"
#include "util/mesa-sha1.h"
#include "util/u_atomic.h"
+#include "vulkan/util/vk_util.h"
struct cache_entry_variant_info
{
struct cache_entry_variant_info
{
tu_pipeline_cache_set_entry(cache, entry);
}
tu_pipeline_cache_set_entry(cache, entry);
}
-struct cache_header
-{
- uint32_t header_size;
- uint32_t header_version;
- uint32_t vendor_id;
- uint32_t device_id;
- uint8_t uuid[VK_UUID_SIZE];
-};
-
static void
tu_pipeline_cache_load(struct tu_pipeline_cache *cache,
const void *data,
size_t size)
{
struct tu_device *device = cache->device;
static void
tu_pipeline_cache_load(struct tu_pipeline_cache *cache,
const void *data,
size_t size)
{
struct tu_device *device = cache->device;
- struct cache_header header;
+ struct vk_pipeline_cache_header header;
if (size < sizeof(header))
return;
if (size < sizeof(header))
return;
{
TU_FROM_HANDLE(tu_device, device, _device);
TU_FROM_HANDLE(tu_pipeline_cache, cache, _cache);
{
TU_FROM_HANDLE(tu_device, device, _device);
TU_FROM_HANDLE(tu_pipeline_cache, cache, _cache);
- struct cache_header *header;
+ struct vk_pipeline_cache_header *header;
VkResult result = VK_SUCCESS;
pthread_mutex_lock(&cache->mutex);
VkResult result = VK_SUCCESS;
pthread_mutex_lock(&cache->mutex);
#include "nir/nir_serialize.h"
#include "anv_private.h"
#include "nir/nir_xfb_info.h"
#include "nir/nir_serialize.h"
#include "anv_private.h"
#include "nir/nir_xfb_info.h"
+#include "vulkan/util/vk_util.h"
struct anv_shader_bin *
anv_shader_bin_create(struct anv_device *device,
struct anv_shader_bin *
anv_shader_bin_create(struct anv_device *device,
-struct cache_header {
- uint32_t header_size;
- uint32_t header_version;
- uint32_t vendor_id;
- uint32_t device_id;
- uint8_t uuid[VK_UUID_SIZE];
-};
-
static void
anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
const void *data, size_t size)
static void
anv_pipeline_cache_load(struct anv_pipeline_cache *cache,
const void *data, size_t size)
struct blob_reader blob;
blob_reader_init(&blob, data, size);
struct blob_reader blob;
blob_reader_init(&blob, data, size);
- struct cache_header header;
+ struct vk_pipeline_cache_header header;
blob_copy_bytes(&blob, &header, sizeof(header));
uint32_t count = blob_read_uint32(&blob);
if (blob.overrun)
blob_copy_bytes(&blob, &header, sizeof(header));
uint32_t count = blob_read_uint32(&blob);
if (blob.overrun)
blob_init_fixed(&blob, NULL, SIZE_MAX);
}
blob_init_fixed(&blob, NULL, SIZE_MAX);
}
- struct cache_header header = {
- .header_size = sizeof(struct cache_header),
+ struct vk_pipeline_cache_header header = {
+ .header_size = sizeof(struct vk_pipeline_cache_header),
.header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
.vendor_id = 0x8086,
.device_id = device->info.chipset_id,
.header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE,
.vendor_id = 0x8086,
.device_id = device->info.chipset_id,
uint32_t vk_get_version_override(void);
uint32_t vk_get_version_override(void);
+struct vk_pipeline_cache_header {
+ uint32_t header_size;
+ uint32_t header_version;
+ uint32_t vendor_id;
+ uint32_t device_id;
+ uint8_t uuid[VK_UUID_SIZE];
+};
+
#define VK_EXT_OFFSET (1000000000UL)
#define VK_ENUM_EXTENSION(__enum) \
((__enum) >= VK_EXT_OFFSET ? ((((__enum) - VK_EXT_OFFSET) / 1000UL) + 1) : 0)
#define VK_EXT_OFFSET (1000000000UL)
#define VK_ENUM_EXTENSION(__enum) \
((__enum) >= VK_EXT_OFFSET ? ((((__enum) - VK_EXT_OFFSET) / 1000UL) + 1) : 0)