static device_table_map tableMap;
static instance_table_map tableInstanceMap;
-#define DISPATCH_MAP_DEBUG 0
-
// Map lookup must be thread safe
VkLayerDispatchTable *device_dispatch_table(void *object) {
dispatch_key key = get_dispatch_key(object);
VkLayerInstanceDispatchTable *instance_dispatch_table(void *object) {
dispatch_key key = get_dispatch_key(object);
instance_table_map::const_iterator it = tableInstanceMap.find((void *)key);
-#if DISPATCH_MAP_DEBUG
- if (it != tableInstanceMap.end()) {
- fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%p\n", &tableInstanceMap, object,
- key, it->second);
- } else {
- fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap,
- object, key);
- }
-#endif
assert(it != tableInstanceMap.end() && "Not able to find instance dispatch entry");
return it->second;
}
void destroy_dispatch_table(device_table_map &map, dispatch_key key) {
device_table_map::const_iterator it = map.find((void *)key);
-#if DISPATCH_MAP_DEBUG
- if (it != map.end()) {
- fprintf(stderr, "destroy device dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second);
- } else {
- fprintf(stderr, "destroy device dispatch table: map: 0x%p, key: 0x%p, table: UNKNOWN\n", &map, key);
- assert(it != map.end());
- }
-#endif
if (it != map.end()) {
delete it->second;
map.erase(it);
void destroy_dispatch_table(instance_table_map &map, dispatch_key key) {
instance_table_map::const_iterator it = map.find((void *)key);
-#if DISPATCH_MAP_DEBUG
- if (it != map.end()) {
- fprintf(stderr, "destroy instance dispatch_table: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second);
- } else {
- fprintf(stderr, "destroy instance dispatch table: map: 0x%p, key: 0x%p, table: UNKNOWN\n", &map, key);
- assert(it != map.end());
- }
-#endif
if (it != map.end()) {
delete it->second;
map.erase(it);
VkLayerDispatchTable *get_dispatch_table(device_table_map &map, void *object) {
dispatch_key key = get_dispatch_key(object);
device_table_map::const_iterator it = map.find((void *)key);
-#if DISPATCH_MAP_DEBUG
- if (it != map.end()) {
- fprintf(stderr, "device_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%p\n", &tableInstanceMap, object,
- key, it->second);
- } else {
- fprintf(stderr, "device_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap, object,
- key);
- }
-#endif
assert(it != map.end() && "Not able to find device dispatch entry");
return it->second;
}
VkLayerInstanceDispatchTable *get_dispatch_table(instance_table_map &map, void *object) {
dispatch_key key = get_dispatch_key(object);
instance_table_map::const_iterator it = map.find((void *)key);
-#if DISPATCH_MAP_DEBUG
- if (it != map.end()) {
- fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: 0x%p\n", &tableInstanceMap, object,
- key, it->second);
- } else {
- fprintf(stderr, "instance_dispatch_table: map: 0x%p, object: 0x%p, key: 0x%p, table: UNKNOWN\n", &tableInstanceMap,
- object, key);
- }
-#endif
assert(it != map.end() && "Not able to find instance dispatch entry");
return it->second;
}
if (it == map.end()) {
pTable = new VkLayerInstanceDispatchTable;
map[(void *)key] = pTable;
-#if DISPATCH_MAP_DEBUG
- fprintf(stderr, "New, Instance: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, pTable);
-#endif
} else {
-#if DISPATCH_MAP_DEBUG
- fprintf(stderr, "Instance: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second);
-#endif
return it->second;
}
if (it == map.end()) {
pTable = new VkLayerDispatchTable;
map[(void *)key] = pTable;
-#if DISPATCH_MAP_DEBUG
- fprintf(stderr, "New, Device: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, pTable);
-#endif
} else {
-#if DISPATCH_MAP_DEBUG
- fprintf(stderr, "Device: map: 0x%p, key: 0x%p, table: 0x%p\n", &map, key, it->second);
-#endif
return it->second;
}