Skip to content

Commit 13276ac

Browse files
committed
runtime/vk: fix broken hash fn for spec programs
1 parent 9d528d6 commit 13276ac

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/runtime/vulkan/vk_runtime_device.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,16 @@ static bool get_physical_device_caps(SHADY_UNUSED VkrBackend* runtime, VkPhysica
208208
return false;
209209
}
210210

211+
KeyHash hash_string(const char** string);
212+
bool compare_string(const char** a, const char** b);
213+
211214
static KeyHash hash_spec_program_key(SpecProgramKey* ptr) {
212-
return hash_murmur(ptr, sizeof(SpecProgramKey));
215+
return hash_murmur(ptr->base, sizeof(Program*)) ^ hash_string(&ptr->entry_point);
213216
}
214217

215218
static bool cmp_spec_program_keys(SpecProgramKey* a, SpecProgramKey* b) {
216-
return memcmp(a, b, sizeof(SpecProgramKey)) == 0;
219+
assert(!!a & !!b);
220+
return a->base == b->base && strcmp(a->entry_point, b->entry_point) == 0;
217221
}
218222

219223
static void obtain_device_pointers(VkrDevice* device) {

0 commit comments

Comments
 (0)