diff options
author | Paul Berry <stereotype441@gmail.com> | 2013-07-13 07:09:54 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2013-08-23 11:02:47 -0700 |
commit | 626495d269e2c2df9dae5c46c086ffff93c77a19 (patch) | |
tree | 46530432672a636fd52e5fd7bfbe98793e045da8 /src/mesa/drivers/dri/i965/gen6_vs_state.c | |
parent | 72168f5f0069b2a0d8a2434ba80f4446952e84c7 (diff) | |
download | external_mesa3d-626495d269e2c2df9dae5c46c086ffff93c77a19.zip external_mesa3d-626495d269e2c2df9dae5c46c086ffff93c77a19.tar.gz external_mesa3d-626495d269e2c2df9dae5c46c086ffff93c77a19.tar.bz2 |
i965/vec4: Allow for dispatch_grf_start_reg to vary.
Both 3DSTATE_VS and 3DSTATE_GS have a dispatch_grf_start_reg control,
which determines the register where the hardware delivers data sourced
from the URB (push constants followed by per-vertex input data).
For vertex shaders, we always set dispatch_grf_start_reg to 1, since
R1 is always the first register available for push constants in vertex
shaders.
For geometry shaders, we'll need the flexibility to set
dispatch_grf_start_reg to different values depending on the behvaiour
of the geometry shader; if it accesses gl_PrimitiveIDIn, we'll need to
set it to 2 to allow the primitive ID to be delivered to the thread in
R1.
This patch eliminates the assumption that dispatch_grf_start_reg is
always 1. In vec4_visitor, we record the regnum that was passed to
vec4_visitor::setup_uniforms() in prog_data for later use. In
vec4_generator, we consult this value when converting an abstract
UNIFORM register to a concrete hardware register. And in the code
that emits 3DSTATE_VS, we set dispatch_grf_start_reg based on the
value recorded in prog_data.
This will allow us to set dispatch_grf_start_reg to the appropriate
value when compiling geometry shaders. Vertex shaders will continue
to always use a dispatch_grf_start_reg of 1.
v2: Make dispatch_grf_start_reg "unsigned" rather than "GLuint".
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/gen6_vs_state.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_vs_state.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c index 4af7cda..c5f2fd0 100644 --- a/src/mesa/drivers/dri/i965/gen6_vs_state.c +++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c @@ -159,7 +159,8 @@ upload_vs_state(struct brw_context *brw) OUT_BATCH(0); } - OUT_BATCH((1 << GEN6_VS_DISPATCH_START_GRF_SHIFT) | + OUT_BATCH((brw->vs.prog_data->base.dispatch_grf_start_reg << + GEN6_VS_DISPATCH_START_GRF_SHIFT) | (brw->vs.prog_data->base.urb_read_length << GEN6_VS_URB_READ_LENGTH_SHIFT) | (0 << GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT)); |