From 2dbbeca869f1aacd0db4c77e95ca983ad9e0c407 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Tue, 30 Jan 2024 10:39:34 -0800 Subject: [PATCH] gfxstream: add REQUIRED_TYPES list This makes the checks into a list. It also adds support for uint16_t, which are hit with newer versions of vk.xml. I'm not sure exactly why we need the list, only that codegen errors occur if we don't don't generate a type here. Maybe as we try to upstream the cerealgenerator, we can figure out why and fix it. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- .../codegen/scripts/cerealgenerator.py | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/gfxstream/codegen/scripts/cerealgenerator.py b/src/gfxstream/codegen/scripts/cerealgenerator.py index 24225fdc171..25866cf39a7 100644 --- a/src/gfxstream/codegen/scripts/cerealgenerator.py +++ b/src/gfxstream/codegen/scripts/cerealgenerator.py @@ -166,6 +166,15 @@ SUPPORTED_MODULES = { "VK_KHR_swapchain" : HOST_MODULES, } +REQUIRED_TYPES = { + "int", + "uint16_t", + "int64_t", + "double", + "VkPresentScalingFlagsEXT", + "VkPresentGravityFlagsEXT", +} + copyrightHeader = """// Copyright (C) 2018 The Android Open Source Project // Copyright (C) 2018 Google Inc. // @@ -812,23 +821,9 @@ class BumpPool; def genType(self, typeinfo: TypeInfo, name, alias): OutputGenerator.genType(self, typeinfo, name, alias) - if self.featureSupported == False and name == "int": - self.typeInfo.onGenType(typeinfo, name, alias) - return - - if self.featureSupported == False and name == "int64_t": - self.typeInfo.onGenType(typeinfo, name, alias) - return - - if self.featureSupported == False and name == "double": - self.typeInfo.onGenType(typeinfo, name, alias) - return - - if self.featureSupported == False and name == "VkPresentScalingFlagsEXT": - self.typeInfo.onGenType(typeinfo, name, alias) - return - - if self.featureSupported == False and name == "VkPresentGravityFlagsEXT": + # Maybe this check can be removed if we refactor other things inside + # the cereal subdirectory. + if self.featureSupported == False and name in REQUIRED_TYPES: self.typeInfo.onGenType(typeinfo, name, alias) return