From: Mark Lobodzinski Date: Thu, 9 Feb 2017 22:58:14 +0000 (-0700) Subject: layers: Codegen unique-objects extension whitelists X-Git-Tag: upstream/1.1.92~1597 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afdce378e35d6274d2f8c969308ca3c1839858ea;p=platform%2Fupstream%2FVulkan-Tools.git layers: Codegen unique-objects extension whitelists These lists are now generated from vk.xml. Change-Id: Id7571d8b18b272c7d7ead905d53e5ff778afcb6e --- diff --git a/layers/unique_objects.h b/layers/unique_objects.h index 85d35fe..fb46b77 100644 --- a/layers/unique_objects.h +++ b/layers/unique_objects.h @@ -30,66 +30,6 @@ namespace unique_objects { -// The clang-format utility does not handle non-delimited strings well at all -// clang-format off - -// The display-server-specific WSI extensions are handled explicitly -static const char *kUniqueObjectsSupportedInstanceExtensions = -#ifdef VK_USE_PLATFORM_XLIB_KHR - VK_KHR_XLIB_SURFACE_EXTENSION_NAME -#endif -#ifdef VK_USE_PLATFORM_XCB_KHR - VK_KHR_XCB_SURFACE_EXTENSION_NAME -#endif -#ifdef VK_USE_PLATFORM_WAYLAND_KHR - VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME -#endif -#ifdef VK_USE_PLATFORM_MIR_KHR - VK_KHR_MIR_SURFACE_EXTENSION_NAME -#endif -#ifdef VK_USE_PLATFORM_ANDROID_KHR - VK_KHR_ANDROID_SURFACE_EXTENSION_NAME -#endif -#ifdef VK_USE_PLATFORM_WIN32_KHR - VK_KHR_WIN32_SURFACE_EXTENSION_NAME -#endif - VK_EXT_DEBUG_MARKER_EXTENSION_NAME - VK_EXT_DEBUG_REPORT_EXTENSION_NAME - VK_KHR_DISPLAY_EXTENSION_NAME - VK_KHR_SURFACE_EXTENSION_NAME - VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME - VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME - VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME - VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME - VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME; - -static const char *kUniqueObjectsSupportedDeviceExtensions = - VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME - VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME - VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME - VK_AMD_GCN_SHADER_EXTENSION_NAME - VK_IMG_FILTER_CUBIC_EXTENSION_NAME - VK_IMG_FORMAT_PVRTC_EXTENSION_NAME - VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME - VK_KHR_SWAPCHAIN_EXTENSION_NAME - VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME - VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME - VK_NV_GLSL_SHADER_EXTENSION_NAME - VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME - VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME - VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME - VK_AMD_SHADER_BALLOT_EXTENSION_NAME - VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME -#ifdef VK_USE_PLATFORM_WIN32_KHR - VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME - VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME -#endif - VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME - VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME - VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME; - -// clang-format on - // All increments must be guarded by global_lock static uint64_t global_unique_id = 1; diff --git a/scripts/unique_objects_generator.py b/scripts/unique_objects_generator.py index bba7cfd..fdf4c38 100644 --- a/scripts/unique_objects_generator.py +++ b/scripts/unique_objects_generator.py @@ -121,8 +121,9 @@ class UniqueObjectsOutputGenerator(OutputGenerator): diagFile = sys.stdout): OutputGenerator.__init__(self, errFile, warnFile, diagFile) self.INDENT_SPACES = 4 - # Commands to ignore self.intercepts = [] + self.instance_extensions = [] + self.device_extensions = [] # Commands which are not autogenerated but still intercepted self.no_autogen_list = [ 'vkGetDeviceProcAddr', @@ -197,7 +198,23 @@ class UniqueObjectsOutputGenerator(OutputGenerator): write('namespace unique_objects {', file = self.outFile) # def endFile(self): + # Write out device extension white list self.newline() + write('// Layer Device Extension Whitelist', file=self.outFile) + write('static const char *kUniqueObjectsSupportedDeviceExtensions =', file=self.outFile) + for line in self.device_extensions: + write('%s' % line, file=self.outFile) + write(';\n', file=self.outFile) + + # Write out instance extension white list + self.newline() + write('// Layer Instance Extension Whitelist', file=self.outFile) + write('static const char *kUniqueObjectsSupportedInstanceExtensions =', file=self.outFile) + for line in self.instance_extensions: + write('%s' % line, file=self.outFile) + write(';\n', file=self.outFile) + self.newline() + # Record intercepted procedures write('// intercepts', file=self.outFile) write('struct { const char* name; PFN_vkVoidFunction pFunc;} procmap[] = {', file=self.outFile) @@ -222,6 +239,18 @@ class UniqueObjectsOutputGenerator(OutputGenerator): self.flags = set() self.StructMemberData = namedtuple('StructMemberData', ['name', 'members']) self.CmdMemberData = namedtuple('CmdMemberData', ['name', 'members']) + if self.featureName != 'VK_VERSION_1_0': + white_list_entry = [] + if (self.featureExtraProtect != None): + white_list_entry += [ '#ifdef %s' % self.featureExtraProtect ] + white_list_entry += [ '"%s"' % self.featureName ] + if (self.featureExtraProtect != None): + white_list_entry += [ '#endif' ] + featureType = interface.get('type') + if featureType == 'instance': + self.instance_extensions += white_list_entry + elif featureType == 'device': + self.device_extensions += white_list_entry # def endFeature(self): # Actually write the interface to the output file.