anv/entrypoints: Use devinfo instead of a gen number
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 17 Nov 2015 14:30:02 +0000 (06:30 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 17 Nov 2015 16:27:51 +0000 (08:27 -0800)
src/vulkan/anv_device.c
src/vulkan/anv_entrypoints_gen.py

index 6cdfd4e5c46bb3d705ff0749327e6fc14f4d34b8..0643944fa2396b8e8e0ef972b92f67bd5d9eee8a 100644 (file)
@@ -637,7 +637,7 @@ VkResult anv_CreateDevice(
          return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
    }
 
-   anv_set_dispatch_gen(physical_device->info->gen);
+   anv_set_dispatch_devinfo(physical_device->info);
 
    device = anv_instance_alloc(instance, sizeof(*device), 8,
                                VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
index 0fa677bbe027b5929aea44b8de70b48623042a79..bb250602b25779c5e363461651e39b3502b05588 100644 (file)
@@ -91,7 +91,7 @@ if opt_header:
     print "   };\n"
     print "};\n"
 
-    print "void anv_set_dispatch_gen(uint32_t gen);\n"
+    print "void anv_set_dispatch_devinfo(const struct brw_device_info *info);\n"
 
     for type, name, args, num, h in entrypoints:
         print "%s anv_%s%s;" % (type, name, args)
@@ -193,12 +193,12 @@ determine_validate(void)
       enable_validate = atoi(s);
 }
 
-static uint32_t dispatch_gen;
+static const struct brw_device_info *dispatch_devinfo;
 
 void
-anv_set_dispatch_gen(uint32_t gen)
+anv_set_dispatch_devinfo(const struct brw_device_info *devinfo)
 {
-   dispatch_gen = gen;   
+   dispatch_devinfo = devinfo;
 }
 
 void * __attribute__ ((noinline))
@@ -207,7 +207,12 @@ anv_resolve_entrypoint(uint32_t index)
    if (enable_validate && validate_layer.entrypoints[index])
       return validate_layer.entrypoints[index];
 
-   switch (dispatch_gen) {
+   if (dispatch_devinfo == NULL) {
+      assert(anv_layer.entrypoints[index]);
+      return anv_layer.entrypoints[index];
+   }
+
+   switch (dispatch_devinfo->gen) {
    case 8:
       if (gen8_layer.entrypoints[index])
          return gen8_layer.entrypoints[index];