From 3478de84444df74be8406454ad6e0d2fafecfdbc Mon Sep 17 00:00:00 2001 From: Serdar Kocdemir Date: Thu, 4 Jul 2024 09:39:41 +0100 Subject: [PATCH] Handle all extensions for structure size calculation Structure size is needed to parse incoming streams correctly. This avoids emulator crashes when an unsupported extension structure is used on the guest side. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/codegen/scripts/cerealgenerator.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gfxstream/codegen/scripts/cerealgenerator.py b/src/gfxstream/codegen/scripts/cerealgenerator.py index dc70c046b70..cb32fd31514 100644 --- a/src/gfxstream/codegen/scripts/cerealgenerator.py +++ b/src/gfxstream/codegen/scripts/cerealgenerator.py @@ -171,6 +171,13 @@ SUPPORTED_MODULES = { "VK_KHR_swapchain" : HOST_MODULES, } +# These modules will be used when the feature is not supported. +# This is necessary to cover all extensions where needed. +UNSUPPORTED_FEATURE_MODULES = { + "goldfish_vk_extension_structs", +} + + REQUIRED_TYPES = { "int", "uint16_t", @@ -789,10 +796,14 @@ class BumpPool; if self.featureName == supportedFeature: self.featureSupported = True - if self.featureSupported == False: + if self.featureSupported == False and UNSUPPORTED_FEATURE_MODULES: + self.featureSupported = True + self.supportedModules = UNSUPPORTED_FEATURE_MODULES + elif self.featureSupported == False: return + else: + self.supportedModules = SUPPORTED_MODULES.get(self.featureName) - self.supportedModules = SUPPORTED_MODULES.get(self.featureName) self.typeInfo.onBeginFeature(self.featureName, self.featureType) self.forEachModule(