From: Kenneth Graunke Date: Tue, 17 Jul 2018 21:01:58 +0000 (-0700) Subject: iris: TES program key inputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9aa8be3d8e83b76ab18170b7b36fbce3a106ae15;p=mesa.git iris: TES program key inputs --- diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 26c40efe440..7a11840590e 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -345,6 +345,47 @@ iris_update_compiled_vs(struct iris_context *ice) UNUSED bool success = iris_compile_vs(ice, ish, &key); } +static const struct shader_info * +get_shader_info(const struct iris_context *ice, gl_shader_stage stage) +{ + const struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[stage]; + + if (!ish) + return NULL; + + const nir_shader *nir = ish->base.ir.nir; + return &nir->info; +} + +/** + * Get the union of TCS output and TES input slots. + * + * TCS and TES need to agree on a common URB entry layout. In particular, + * the data for all patch vertices is stored in a single URB entry (unlike + * GS which has one entry per input vertex). This means that per-vertex + * array indexing needs a stride. + * + * SSO requires locations to match, but doesn't require the number of + * outputs/inputs to match (in fact, the TCS often has extra outputs). + * So, we need to take the extra step of unifying these on the fly. + */ +static void +get_unified_tess_slots(const struct iris_context *ice, + uint64_t *per_vertex_slots, + uint32_t *per_patch_slots) +{ + const struct shader_info *tcs = get_shader_info(ice, MESA_SHADER_TESS_CTRL); + const struct shader_info *tes = get_shader_info(ice, MESA_SHADER_TESS_EVAL); + + *per_vertex_slots = tes->inputs_read; + *per_patch_slots = tes->patch_inputs_read; + + if (tcs) { + *per_vertex_slots |= tcs->inputs_read; + *per_patch_slots |= tcs->patch_inputs_read; + } +} + static void iris_update_compiled_tcs(struct iris_context *ice) { @@ -410,6 +451,7 @@ iris_update_compiled_tes(struct iris_context *ice) return; struct brw_tes_prog_key key = { .program_string_id = ish->program_id }; + get_unified_tess_slots(ice, &key.inputs_read, &key.patch_inputs_read); ice->vtbl.populate_tes_key(ice, &key); if (iris_bind_cached_shader(ice, IRIS_CACHE_TES, &key))