#include "nir/tgsi_to_nir.h"
#define KEY_INIT_NO_ID(gen) \
+ .base.subgroup_size_type = BRW_SUBGROUP_SIZE_UNIFORM, \
.base.tex.swizzles[0 ... MAX_SAMPLERS - 1] = 0x688, \
.base.tex.compressed_multisample_layout_mask = ~0, \
.base.tex.msaa_16 = (gen >= 9 ? ~0 : 0)
brw_debug_key_recompile(c, &ice->dbg, info->stage, old_key, key);
}
+/**
+ * Get the shader for the last enabled geometry stage.
+ *
+ * This stage is the one which will feed stream output and the rasterizer.
+ */
+static gl_shader_stage
+last_vue_stage(struct iris_context *ice)
+{
+ if (ice->shaders.uncompiled[MESA_SHADER_GEOMETRY])
+ return MESA_SHADER_GEOMETRY;
+
+ if (ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL])
+ return MESA_SHADER_TESS_EVAL;
+
+ return MESA_SHADER_VERTEX;
+}
/**
* Compile a vertex shader, and upload the assembly.
const struct gen_device_info *devinfo = &screen->devinfo;
struct brw_vs_prog_key key = { KEY_INIT(devinfo->gen) };
- ice->vtbl.populate_vs_key(ice, &ish->nir->info, &key);
+ ice->vtbl.populate_vs_key(ice, &ish->nir->info, last_vue_stage(ice), &key);
struct iris_compiled_shader *old = ice->shaders.prog[IRIS_CACHE_VS];
struct iris_compiled_shader *shader =
nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir);
+ if (key->nr_userclip_plane_consts) {
+ nir_function_impl *impl = nir_shader_get_entrypoint(nir);
+ nir_lower_clip_vs(nir, (1 << key->nr_userclip_plane_consts) - 1, true);
+ nir_lower_io_to_temporaries(nir, impl, true, false);
+ nir_lower_global_vars_to_local(nir);
+ nir_lower_vars_to_ssa(nir);
+ nir_shader_gather_info(nir, impl);
+ }
+
iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values,
&num_system_values, &num_cbufs);
struct brw_tes_prog_key key = { KEY_INIT(devinfo->gen) };
get_unified_tess_slots(ice, &key.inputs_read, &key.patch_inputs_read);
- ice->vtbl.populate_tes_key(ice, &key);
+ ice->vtbl.populate_tes_key(ice, &ish->nir->info, last_vue_stage(ice), &key);
struct iris_compiled_shader *old = ice->shaders.prog[IRIS_CACHE_TES];
struct iris_compiled_shader *shader =
nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir);
+ if (key->nr_userclip_plane_consts) {
+ nir_function_impl *impl = nir_shader_get_entrypoint(nir);
+ nir_lower_clip_gs(nir, (1 << key->nr_userclip_plane_consts) - 1);
+ nir_lower_io_to_temporaries(nir, impl, true, false);
+ nir_lower_global_vars_to_local(nir);
+ nir_lower_vars_to_ssa(nir);
+ nir_shader_gather_info(nir, impl);
+ }
+
iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values,
&num_system_values, &num_cbufs);
struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen;
const struct gen_device_info *devinfo = &screen->devinfo;
struct brw_gs_prog_key key = { KEY_INIT(devinfo->gen) };
- ice->vtbl.populate_gs_key(ice, &key);
+ ice->vtbl.populate_gs_key(ice, &ish->nir->info, last_vue_stage(ice), &key);
shader =
iris_find_cached_shader(ice, IRIS_CACHE_GS, sizeof(key), &key);
}
}
-/**
- * Get the shader for the last enabled geometry stage.
- *
- * This stage is the one which will feed stream output and the rasterizer.
- */
-static gl_shader_stage
-last_vue_stage(struct iris_context *ice)
-{
- if (ice->shaders.uncompiled[MESA_SHADER_GEOMETRY])
- return MESA_SHADER_GEOMETRY;
-
- if (ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL])
- return MESA_SHADER_TESS_EVAL;
-
- return MESA_SHADER_VERTEX;
-}
-
/**
* Update the last enabled stage's VUE map.
*
struct iris_uncompiled_shader *ish = iris_create_shader_state(ctx, state);
struct shader_info *info = &ish->nir->info;
+ /* User clip planes */
+ if (ish->nir->info.clip_distance_array_size == 0)
+ ish->nos |= (1ull << IRIS_NOS_RASTERIZER);
+
if (screen->precompile) {
const struct gen_device_info *devinfo = &screen->devinfo;
struct brw_tes_prog_key key = {
struct iris_screen *screen = (void *) ctx->screen;
struct iris_uncompiled_shader *ish = iris_create_shader_state(ctx, state);
+ /* User clip planes */
+ if (ish->nir->info.clip_distance_array_size == 0)
+ ish->nos |= (1ull << IRIS_NOS_RASTERIZER);
+
if (screen->precompile) {
const struct gen_device_info *devinfo = &screen->devinfo;
struct brw_gs_prog_key key = { KEY_INIT(devinfo->gen) };
static void
iris_bind_vs_state(struct pipe_context *ctx, void *state)
{
+ struct iris_context *ice = (struct iris_context *)ctx;
+ struct iris_uncompiled_shader *new_ish = state;
+
+ if (new_ish &&
+ ice->state.window_space_position !=
+ new_ish->nir->info.vs.window_space_position) {
+ ice->state.window_space_position =
+ new_ish->nir->info.vs.window_space_position;
+
+ ice->state.dirty |= IRIS_DIRTY_CLIP |
+ IRIS_DIRTY_RASTER |
+ IRIS_DIRTY_CC_VIEWPORT;
+ }
+
bind_shader_state((void *) ctx, state, MESA_SHADER_VERTEX);
}