anv/entrypoints: Split entrypoint index lookup into its own function
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 17 Jan 2018 00:52:50 +0000 (16:52 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 23 Jan 2018 08:15:40 +0000 (00:15 -0800)
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/intel/vulkan/anv_entrypoints_gen.py
src/intel/vulkan/anv_private.h

index 6c922b8a6427bdf319095b682266be77da387575..9dbf828131e6dd74e51391edb9a88dbb88c04558 100644 (file)
@@ -215,8 +215,8 @@ static const uint16_t map[] = {
 % endfor
 };
 
-void *
-anv_lookup_entrypoint(const struct gen_device_info *devinfo, const char *name)
+int
+anv_get_entrypoint_index(const char *name)
 {
    static const uint32_t prime_factor = ${prime_factor};
    static const uint32_t prime_step = ${prime_step};
@@ -232,15 +232,24 @@ anv_lookup_entrypoint(const struct gen_device_info *devinfo, const char *name)
    do {
       i = map[h & ${hash_mask}];
       if (i == none)
-         return NULL;
+         return -1;
       e = &entrypoints[i];
       h += prime_step;
    } while (e->hash != hash);
 
    if (strcmp(name, strings + e->name) != 0)
-      return NULL;
+      return -1;
+
+   return i;
+}
 
-   return anv_resolve_entrypoint(devinfo, i);
+void *
+anv_lookup_entrypoint(const struct gen_device_info *devinfo, const char *name)
+{
+   int idx = anv_get_entrypoint_index(name);
+   if (idx < 0)
+      return NULL;
+   return anv_resolve_entrypoint(devinfo, idx);
 }""", output_encoding='utf-8')
 
 NONE = 0xffff
index 36d87e2f17681eaee7233b51ea636228582706e9..1fd7c39567dec5260720073553a3b860d4dd695f 100644 (file)
@@ -2816,6 +2816,8 @@ struct anv_query_pool {
    struct anv_bo                                bo;
 };
 
+int anv_get_entrypoint_index(const char *name);
+
 void *anv_lookup_entrypoint(const struct gen_device_info *devinfo,
                             const char *name);