aboutsummaryrefslogtreecommitdiff
path: root/scripts/loader_extension_generator.py
diff options
context:
space:
mode:
authorJames Jones <jajones@nvidia.com>2017-02-28 17:26:09 -0800
committerMark Young <marky@lunarg.com>2017-03-01 16:14:21 -0700
commit11cf4ae8a7d98c74d79eab9cb6c21ef62ed0f447 (patch)
tree2689a9fe2187b2f848b1aa7dfe875100b6fdd8e7 /scripts/loader_extension_generator.py
parent3782bbd1fb33565647639a17a54b413ccf2e09a7 (diff)
downloadusermoji-11cf4ae8a7d98c74d79eab9cb6c21ef62ed0f447.tar.xz
loader: Fix handling of surface parameters
The loader code generation scripts had a bug that caused all the surface->ICD surface translation C code to be placed inside a block that only ran if the ICD didn't support the extension function, making it effectively a no-op. ICDs that supported the extension were instead called with the un-translated surface handle, which could cause a crash if they were expecting their local surface handle. Also, speculatively fix up return handling in this same class of functions by handling the void return type.
Diffstat (limited to 'scripts/loader_extension_generator.py')
-rw-r--r--scripts/loader_extension_generator.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/loader_extension_generator.py b/scripts/loader_extension_generator.py
index 105073d1..1d2d984c 100644
--- a/scripts/loader_extension_generator.py
+++ b/scripts/loader_extension_generator.py
@@ -1090,13 +1090,14 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
funcs += ' "ICD associated with VkPhysicalDevice does not support '
funcs += base_name
funcs += '");\n'
+ funcs += ' }\n'
if has_surface == 1:
- funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);\n'
- funcs += ' uint8_t icd_index = phys_dev_term->icd_index;\n'
- funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n'
- funcs += ' if (NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) {\n'
- funcs += ' return icd_term->dispatch.'
+ funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);\n'
+ funcs += ' uint8_t icd_index = phys_dev_term->icd_index;\n'
+ funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n'
+ funcs += ' if (NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) {\n'
+ funcs += ' ' + return_prefix + 'icd_term->dispatch.'
funcs += base_name
funcs += '('
count = 0
@@ -1113,10 +1114,10 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
count += 1
funcs += ');\n'
- funcs += ' }\n'
+ if not has_return_type:
+ funcs += ' return;\n'
funcs += ' }\n'
-
- funcs += ' }\n'
+ funcs += ' }\n'
funcs += return_prefix
funcs += 'icd_term->dispatch.'
@@ -1160,7 +1161,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
funcs += ' return;\n'
funcs += ' }\n'
funcs += ' }\n'
- funcs += ' %sicd_term->dispatch.%s(' % (return_prefix, base_name)
+ funcs += ' %sicd_term->dispatch.%s(' % (return_prefix, base_name)
count = 0
for param in ext_cmd.params:
if count != 0:
@@ -1168,7 +1169,7 @@ class LoaderExtensionOutputGenerator(OutputGenerator):
funcs += param.name
count += 1
funcs += ');\n'
- funcs += ' }\n'
+ funcs += ' }\n'
if has_return_type:
funcs += ' return VK_SUCCESS;\n'