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())
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(),
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];
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)
{