From e8adfa1241a2d8a6843f44f4b0bca390c9e8eaed Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Fri, 8 Aug 2025 12:32:35 +0100 Subject: [PATCH] pvr, pco: enable pre-generated header string functions to work with clc Signed-off-by: Simon Perretta Acked-by: Erik Faye-Lund Part-of: --- src/imagination/csbgen/gen_pack_header.py | 6 +++++- src/imagination/pco/pco_common.h.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/imagination/csbgen/gen_pack_header.py b/src/imagination/csbgen/gen_pack_header.py index f047ec07e3e..5927e984127 100644 --- a/src/imagination/csbgen/gen_pack_header.py +++ b/src/imagination/csbgen/gen_pack_header.py @@ -73,6 +73,10 @@ PACK_FILE_HEADER = """%(license)s #include "csbgen/pvr_packet_helpers.h" +#ifndef __OPENCL_VERSION__ +#define __constant +#endif + """ @@ -248,7 +252,7 @@ class Enum(Node): def _emit_to_str(self) -> None: print(textwrap.dedent("""\ - static const char * + static __constant const char * %s_to_str(const enum %s value) {""") % (self.full_name, self.full_name)) diff --git a/src/imagination/pco/pco_common.h.py b/src/imagination/pco/pco_common.h.py index 0bf67db6896..cf802773203 100644 --- a/src/imagination/pco/pco_common.h.py +++ b/src/imagination/pco/pco_common.h.py @@ -26,6 +26,10 @@ template = """/* #include +#ifndef __OPENCL_VERSION__ +#define __constant +#endif + /** Enums. */ % for enum in [enum for enum in enums.values() if enum.parent is None]: #define _${enum.name.upper()}_COUNT ${enum.unique_count}U @@ -36,7 +40,7 @@ enum ${enum.name} { }; static inline -const char *${enum.name}_str(uint64_t val) { +__constant const char *${enum.name}_str(uint64_t val) { switch (val) { % for elem in enum.elems.values(): % if elem.string is not None: