summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-04-07 01:18:12 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:05 -0800
commit012154c20f64cb4bb3f6864f1cb2ce002012825d (patch)
treea1913a8b86c7ca14797d163ba8340b0c1e625509 /src
parentd890aee15d7e466f81306a3cf917fedb76e66152 (diff)
iris: TES stash
TODO: key setup
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_program.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
index 4a866b9ddb9..b0ec74c58da 100644
--- a/src/gallium/drivers/iris/iris_program.c
+++ b/src/gallium/drivers/iris/iris_program.c
@@ -288,10 +288,63 @@ iris_update_compiled_tcs(struct iris_context *ice)
// XXX: TCS
}
+static bool
+iris_compile_tes(struct iris_context *ice,
+ struct iris_uncompiled_shader *ish,
+ const struct brw_tes_prog_key *key)
+{
+ struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
+ const struct brw_compiler *compiler = screen->compiler;
+ const struct gen_device_info *devinfo = &screen->devinfo;
+ void *mem_ctx = ralloc_context(NULL);
+ struct brw_tes_prog_data *tes_prog_data =
+ rzalloc(mem_ctx, struct brw_tes_prog_data);
+ struct brw_vue_prog_data *vue_prog_data = &tes_prog_data->base;
+ struct brw_stage_prog_data *prog_data = &vue_prog_data->base;
+
+ assert(ish->base.type == PIPE_SHADER_IR_NIR);
+
+ nir_shader *nir = ish->base.ir.nir;
+
+ assign_common_binding_table_offsets(devinfo, &nir->info, prog_data, 0);
+
+ struct brw_vue_map input_vue_map;
+ brw_compute_tess_vue_map(&input_vue_map, key->inputs_read,
+ key->patch_inputs_read);
+
+ char *error_str = NULL;
+ const unsigned *program =
+ brw_compile_tes(compiler, &ice->dbg, mem_ctx, key, &input_vue_map,
+ tes_prog_data, nir, NULL, -1, &error_str);
+ if (program == NULL) {
+ dbg_printf("Failed to compile vertex shader: %s\n", error_str);
+ ralloc_free(mem_ctx);
+ return false;
+ }
+
+ iris_upload_and_bind_shader(ice, IRIS_CACHE_TES, key, program, prog_data);
+
+ ralloc_free(mem_ctx);
+ return true;
+}
+
+
static void
iris_update_compiled_tes(struct iris_context *ice)
{
- // XXX: TES
+ struct iris_uncompiled_shader *ish =
+ ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL];
+
+ if (!ish)
+ return;
+
+ struct brw_tes_prog_key key;
+ ice->state.populate_tes_key(ice, &key);
+
+ if (iris_bind_cached_shader(ice, IRIS_CACHE_TES, &key))
+ return;
+
+ UNUSED bool success = iris_compile_tes(ice, ish, &key);
}
static void