#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_text.h"
+#include "nir/tgsi_to_nir.h"
+
#include "etnaviv_compiler.h"
#include "etnaviv_debug.h"
#include "etnaviv_internal.h"
const char *filename;
struct tgsi_token toks[65536];
struct tgsi_parse_context parse;
- struct etna_shader s = {};
struct etna_shader_key key = {};
void *ptr;
size_t size;
- struct etna_shader_variant *v = CALLOC_STRUCT(etna_shader_variant);
- if (!v) {
- fprintf(stderr, "malloc failed!\n");
- return 1;
- }
-
etna_mesa_debug = ETNA_DBG_MSGS | ETNA_DBG_NOCACHE;
while (n < argc) {
tgsi_parse_init(&parse, toks);
- s.specs = &specs_gc2000;
- s.tokens = toks;
+ struct etna_compiler *compiler = etna_compiler_create(NULL, &specs_gc2000);
- v->shader = &s;
- v->key = key;
+ struct etna_shader shader = {};
+ shader.nir = tgsi_to_nir_noscreen(toks, &compiler->options);
+ shader.specs = &specs_gc2000;
+ shader.compiler = compiler;
+
+ struct util_debug_callback debug = {}; // TODO: proper debug callback
+ struct etna_shader_variant *v = etna_shader_variant(&shader, key, &debug);
+ if (!v) {
+ fprintf(stderr, "shader variant creation failed!\n");
+ return 1;
+ }
if (!etna_compile_shader(v)) {
fprintf(stderr, "compiler failed!\n");