pvr, pco: enable pre-generated header string functions to work with clc

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37439>
This commit is contained in:
Simon Perretta 2025-08-08 12:32:35 +01:00
parent 7855446a51
commit e8adfa1241
2 changed files with 10 additions and 2 deletions

View file

@ -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))

View file

@ -26,6 +26,10 @@ template = """/*
#include <stdbool.h>
#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: