Skip to content

Commit

Permalink
d3d11: make cache header constant size regardless of the build
Browse files Browse the repository at this point in the history
This makes cache entries compatible between 32-bit and 64-bit builds and
avoids issues with loading cache wrong.
  • Loading branch information
kasper93 authored and haasn committed Jun 7, 2024
1 parent 79a2efc commit bc9de9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ enum {
CACHE_KEY_SPIRV = UINT64_C(0x32352f6605ff60a7), // bare SPIR-V module
CACHE_KEY_VK_PIPE = UINT64_C(0x4bdab2817ad02ad4), // VkPipelineCache
CACHE_KEY_GL_PROG = UINT64_C(0x4274c309f4f0477b), // GL_ARB_get_program_binary
CACHE_KEY_D3D_DXBC = UINT64_C(0xa2be4a904a7a4feb), // DXBC bytecode
CACHE_KEY_D3D_DXBC = UINT64_C(0x5c9e6f43ec73f787), // DXBC bytecode
};
24 changes: 12 additions & 12 deletions src/d3d11/gpu_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,18 +493,18 @@ error:;
return out;
}

struct d3d11_cache_header {
bool num_workgroups_used;
int num_main_cbvs;
int num_main_srvs;
int num_main_samplers;
int num_vertex_cbvs;
int num_vertex_srvs;
int num_vertex_samplers;
int num_uavs;
size_t vert_bc_len;
size_t frag_bc_len;
size_t comp_bc_len;
struct __attribute__((packed)) d3d11_cache_header {
int32_t num_main_cbvs;
int32_t num_main_srvs;
int32_t num_main_samplers;
int32_t num_vertex_cbvs;
int32_t num_vertex_srvs;
int32_t num_vertex_samplers;
int32_t num_uavs;
uint32_t vert_bc_len;
uint32_t frag_bc_len;
uint32_t comp_bc_len;
uint8_t num_workgroups_used;
};

static inline uint64_t pass_cache_signature(pl_gpu gpu,
Expand Down

0 comments on commit bc9de9c

Please sign in to comment.