From: Paul Berry Date: Tue, 3 Sep 2013 00:24:19 +0000 (-0700) Subject: i965/fs: Expose "urb_setup" as part of brw_wm_prog_data. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=58f01bd17d5587c21d7f543b8f3769f3405dc420;p=mesa.git i965/fs: Expose "urb_setup" as part of brw_wm_prog_data. At the moment, for Gen6+, the FS assumes that all varying inputs are delivered to it in the order in which they appear in the gl_program::InputsRead bitfield, and the SF/SBE setup code ensures that they are delivered in this order. When we add support for more than 64 varying components, this will no longer always be possible, because the Gen6+ SF/SBE stage is only capable of performing arbitrary reorderings of 16 varying slots. To allow extra flexibility in the ordering of FS varyings, this patch causes the FS to advertise exactly what ordering it expects. Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 108e98ca514..988e9fbf656 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -336,6 +336,13 @@ struct brw_wm_prog_data { */ uint32_t barycentric_interp_modes; + /** + * Map from gl_varying_slot to the position within the FS setup data + * payload where the varying's attribute vertex deltas should be delivered. + * For varying slots that are not used by the FS, the value is -1. + */ + int urb_setup[VARYING_SLOT_MAX]; + /* Pointers to tracked values (only valid once * _mesa_load_state_parameters has been called at runtime). * diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index daa23b4ad24..e788196aeb9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1004,7 +1004,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) int location = ir->location; for (unsigned int i = 0; i < array_elements; i++) { for (unsigned int j = 0; j < type->matrix_columns; j++) { - if (urb_setup[location] == -1) { + if (c->prog_data.urb_setup[location] == -1) { /* If there's no incoming setup data for this slot, don't * emit interpolation for it. */ @@ -1231,7 +1231,7 @@ void fs_visitor::calculate_urb_setup() { for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) { - urb_setup[i] = -1; + c->prog_data.urb_setup[i] = -1; } int urb_next = 0; @@ -1239,7 +1239,7 @@ fs_visitor::calculate_urb_setup() if (brw->gen >= 6) { for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) { if (fp->Base.InputsRead & BITFIELD64_BIT(i)) { - urb_setup[i] = urb_next++; + c->prog_data.urb_setup[i] = urb_next++; } } } else { @@ -1257,7 +1257,7 @@ fs_visitor::calculate_urb_setup() * incremented, mapped or not. */ if (_mesa_varying_slot_in_fs((gl_varying_slot) i)) - urb_setup[i] = urb_next; + c->prog_data.urb_setup[i] = urb_next; urb_next++; } } @@ -1269,7 +1269,7 @@ fs_visitor::calculate_urb_setup() * See compile_sf_prog() for more info. */ if (fp->Base.InputsRead & BITFIELD64_BIT(VARYING_SLOT_PNTC)) - urb_setup[VARYING_SLOT_PNTC] = urb_next++; + c->prog_data.urb_setup[VARYING_SLOT_PNTC] = urb_next++; } /* Each attribute is 4 setup channels, each of which is half a reg. */ diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index cb4ac3b455f..b77d4def80a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -454,7 +454,6 @@ public: int first_non_payload_grf; /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */ int max_grf; - int urb_setup[VARYING_SLOT_MAX]; fs_reg *fp_temp_regs; fs_reg *fp_input_regs; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index d935c7b26e3..8b505a07cad 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2171,10 +2171,10 @@ fs_visitor::emit_dummy_fs() struct brw_reg fs_visitor::interp_reg(int location, int channel) { - int regnr = urb_setup[location] * 2 + channel / 2; + int regnr = c->prog_data.urb_setup[location] * 2 + channel / 2; int stride = (channel & 1) * 4; - assert(urb_setup[location] != -1); + assert(c->prog_data.urb_setup[location] != -1); return brw_vec1_grf(regnr, stride); }