mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 17:40:11 +01:00
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28622>
47 lines
863 B
Python
47 lines
863 B
Python
|
|
template = """\
|
|
/*
|
|
* Copyright (c) 2018 Valve Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* This file was generated by aco_opcodes_h.py
|
|
*/
|
|
|
|
#ifndef _ACO_OPCODES_
|
|
#define _ACO_OPCODES_
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace aco {
|
|
|
|
enum class Format : uint16_t {
|
|
% for e in Format:
|
|
${e.name} = ${hex(e.value)},
|
|
% endfor
|
|
};
|
|
|
|
enum class instr_class : uint8_t {
|
|
% for name in InstrClass:
|
|
${name.value},
|
|
% endfor
|
|
count,
|
|
};
|
|
|
|
<% opcode_names = sorted(instructions.keys()) %>
|
|
|
|
enum class aco_opcode : uint16_t {
|
|
% for name in opcode_names:
|
|
${name},
|
|
% endfor
|
|
last_opcode = ${opcode_names[-1]},
|
|
num_opcodes = last_opcode + 1
|
|
};
|
|
|
|
}
|
|
#endif /* _ACO_OPCODES_ */"""
|
|
|
|
from aco_opcodes import instructions, InstrClass, Format
|
|
from mako.template import Template
|
|
|
|
print(Template(template).render(instructions=instructions, InstrClass=InstrClass, Format=Format))
|