summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/intel/blorp/blorp_blit.c8
-rw-r--r--src/intel/blorp/blorp_clear.c6
-rw-r--r--src/intel/blorp/blorp_priv.h14
3 files changed, 17 insertions, 11 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 893a4bc4b16..27af21f2548 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -67,13 +67,7 @@ brw_blorp_blit_vars_init(nir_builder *b, struct brw_blorp_blit_vars *v,
assert(!key->use_kill || !(key->blend && key->blit_scaled));
#define LOAD_INPUT(name, type)\
- v->v_##name = nir_variable_create(b->shader, nir_var_shader_in, \
- type, #name); \
- v->v_##name->data.interpolation = INTERP_MODE_FLAT; \
- v->v_##name->data.location = VARYING_SLOT_VAR0 + \
- offsetof(struct brw_blorp_wm_inputs, name) / (4 * sizeof(float)); \
- v->v_##name->data.location_frac = \
- (offsetof(struct brw_blorp_wm_inputs, name) / sizeof(float)) % 4;
+ v->v_##name = BLORP_CREATE_NIR_INPUT(b->shader, name, type);
LOAD_INPUT(discard_rect, glsl_vec4_type())
LOAD_INPUT(rect_grid, glsl_vec4_type())
diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c
index 2b8af18019d..e4a4acb1f08 100644
--- a/src/intel/blorp/blorp_clear.c
+++ b/src/intel/blorp/blorp_clear.c
@@ -60,10 +60,8 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp,
nir_builder_init_simple_shader(&b, mem_ctx, MESA_SHADER_FRAGMENT, NULL);
b.shader->info->name = ralloc_strdup(b.shader, "BLORP-clear");
- nir_variable *v_color = nir_variable_create(b.shader, nir_var_shader_in,
- glsl_vec4_type(), "v_color");
- v_color->data.location = VARYING_SLOT_VAR0;
- v_color->data.interpolation = INTERP_MODE_FLAT;
+ nir_variable *v_color =
+ BLORP_CREATE_NIR_INPUT(b.shader, clear_color, glsl_vec4_type());
nir_variable *frag_color = nir_variable_create(b.shader, nir_var_shader_out,
glsl_vec4_type(),
diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h
index 1258fa96f1a..04aa152193d 100644
--- a/src/intel/blorp/blorp_priv.h
+++ b/src/intel/blorp/blorp_priv.h
@@ -122,6 +122,8 @@ struct blorp_surf_offset {
struct brw_blorp_wm_inputs
{
+ uint32_t clear_color[4];
+
struct brw_blorp_discard_rect discard_rect;
struct brw_blorp_rect_grid rect_grid;
struct brw_blorp_coord_transform coord_transform[2];
@@ -138,6 +140,18 @@ struct brw_blorp_wm_inputs
uint32_t pad[1];
};
+#define BLORP_CREATE_NIR_INPUT(shader, name, type) ({ \
+ nir_variable *input = nir_variable_create((shader), nir_var_shader_in, \
+ type, #name); \
+ if ((shader)->stage == MESA_SHADER_FRAGMENT) \
+ input->data.interpolation = INTERP_MODE_FLAT; \
+ input->data.location = VARYING_SLOT_VAR0 + \
+ offsetof(struct brw_blorp_wm_inputs, name) / (4 * sizeof(float)); \
+ input->data.location_frac = \
+ (offsetof(struct brw_blorp_wm_inputs, name) / sizeof(float)) % 4; \
+ input; \
+})
+
static inline unsigned
brw_blorp_get_urb_length(const struct brw_wm_prog_data *prog_data)
{