summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-08-26 04:10:58 -0700
committerKristian Høgsberg Kristensen <[email protected]>2015-09-03 11:53:09 -0700
commit1d787781ff4834015d7b3008336f4765c5c709e5 (patch)
treeb71d0e869bd9cd0465d5184510a27d57feb2ae08 /src
parentc4dbff58d80c842794175f7b16cc0085ed2db940 (diff)
vk: Fall back to previous gens in entry point resolver
We used to always just do a one-level fallback from genX_* to anv_* entry points. That worked for gen7 and gen8 where all entry points were either different or could be made anv_* entry points (eg anv_CreateDynamicViewportState). We're about to add gen9 and now need to be able to fall back to gen8 entry points for most things. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/anv_device.c9
-rw-r--r--src/vulkan/anv_entrypoints_gen.py30
2 files changed, 23 insertions, 16 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index 25c60488a80..70c0c9d490a 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -542,14 +542,7 @@ VkResult anv_CreateDevice(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO);
- switch (physical_device->info->gen) {
- case 7:
- driver_layer = &gen7_layer;
- break;
- case 8:
- driver_layer = &gen8_layer;
- break;
- }
+ anv_set_dispatch_gen(physical_device->info->gen);
device = anv_instance_alloc(instance, sizeof(*device), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
diff --git a/src/vulkan/anv_entrypoints_gen.py b/src/vulkan/anv_entrypoints_gen.py
index 21f87f181e9..149f34c9842 100644
--- a/src/vulkan/anv_entrypoints_gen.py
+++ b/src/vulkan/anv_entrypoints_gen.py
@@ -91,9 +91,7 @@ if opt_header:
print " };\n"
print "};\n"
- print "extern const struct anv_layer gen7_layer;\n"
- print "extern const struct anv_layer gen8_layer;\n"
- print "extern const struct anv_layer *driver_layer;\n"
+ print "void anv_set_dispatch_gen(uint32_t gen);\n"
for type, name, args, num, h in entrypoints:
print "%s anv_%s%s;" % (type, name, args)
@@ -195,7 +193,13 @@ determine_validate(void)
enable_validate = atoi(s);
}
-const struct anv_layer *driver_layer = &anv_layer;
+static uint32_t dispatch_gen;
+
+void
+anv_set_dispatch_gen(uint32_t gen)
+{
+ dispatch_gen = gen;
+}
static void * __attribute__ ((noinline))
resolve_entrypoint(uint32_t index)
@@ -203,10 +207,20 @@ resolve_entrypoint(uint32_t index)
if (enable_validate && validate_layer.entrypoints[index])
return validate_layer.entrypoints[index];
- if (driver_layer && driver_layer->entrypoints[index])
- return driver_layer->entrypoints[index];
-
- return anv_layer.entrypoints[index];
+ switch (dispatch_gen) {
+ case 8:
+ if (gen8_layer.entrypoints[index])
+ return gen8_layer.entrypoints[index];
+ /* fall through */
+ case 7:
+ if (gen7_layer.entrypoints[index])
+ return gen7_layer.entrypoints[index];
+ /* fall through */
+ case 0:
+ return anv_layer.entrypoints[index];
+ default:
+ unreachable("unsupported gen\\n");
+ }
}
"""