summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2016-05-18 19:25:33 +0300
committerTopi Pohjolainen <[email protected]>2016-07-04 09:05:02 +0300
commit9e3774a4606b826921f1c0ea7d8afd8f91049758 (patch)
treec727d39cc11cb653621a80c4f55a22ebc482c3e9 /src
parente762354309ec63b3e5eb053e0860a52fdf036452 (diff)
i965/blorp: Prepare for more than two vertex attributes
Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.h13
-rw-r--r--src/mesa/drivers/dri/i965/gen6_blorp.c4
-rw-r--r--src/mesa/drivers/dri/i965/gen7_blorp.c4
-rw-r--r--src/mesa/drivers/dri/i965/gen8_blorp.c4
4 files changed, 22 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index c84217006a9..751e082ccc5 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -240,6 +240,19 @@ struct brw_blorp_prog_data
uint8_t param[BRW_BLORP_NUM_PUSH_CONSTANT_DWORDS];
};
+inline unsigned
+brw_blorp_get_urb_length(const struct brw_blorp_prog_data *prog_data)
+{
+ if (prog_data == NULL)
+ return 1;
+
+ /* From the BSpec: 3D Pipeline - Strips and Fans - 3DSTATE_SBE
+ *
+ * read_length = ceiling((max_source_attr+1)/2)
+ */
+ return MAX2((prog_data->num_varying_inputs + 1) / 2, 1);
+}
+
struct brw_blorp_params
{
uint32_t x0;
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.c b/src/mesa/drivers/dri/i965/gen6_blorp.c
index 2f26fa1a51f..8b6b8f92cc3 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.c
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.c
@@ -649,11 +649,13 @@ gen6_blorp_emit_sf_config(struct brw_context *brw,
{
const unsigned num_varyings =
params->wm_prog_data ? params->wm_prog_data->num_varying_inputs : 0;
+ const unsigned urb_read_length =
+ brw_blorp_get_urb_length(params->wm_prog_data);
BEGIN_BATCH(20);
OUT_BATCH(_3DSTATE_SF << 16 | (20 - 2));
OUT_BATCH(num_varyings << GEN6_SF_NUM_OUTPUTS_SHIFT |
- 1 << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
+ urb_read_length << GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT |
BRW_SF_URB_ENTRY_READ_OFFSET <<
GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT);
OUT_BATCH(0); /* dw2 */
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.c b/src/mesa/drivers/dri/i965/gen7_blorp.c
index e4cae1f6ca1..42157754d96 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.c
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.c
@@ -445,6 +445,8 @@ gen7_blorp_emit_sf_config(struct brw_context *brw,
{
const unsigned num_varyings =
params->wm_prog_data ? params->wm_prog_data->num_varying_inputs : 0;
+ const unsigned urb_read_length =
+ brw_blorp_get_urb_length(params->wm_prog_data);
BEGIN_BATCH(14);
OUT_BATCH(_3DSTATE_SBE << 16 | (14 - 2));
@@ -457,7 +459,7 @@ gen7_blorp_emit_sf_config(struct brw_context *brw,
* than one vec4 worth of vertex attributes are needed.
*/
OUT_BATCH(num_varyings << GEN7_SBE_NUM_OUTPUTS_SHIFT |
- 1 << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
+ urb_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
BRW_SF_URB_ENTRY_READ_OFFSET <<
GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT);
for (int i = 0; i < 9; ++i)
diff --git a/src/mesa/drivers/dri/i965/gen8_blorp.c b/src/mesa/drivers/dri/i965/gen8_blorp.c
index 13dda928575..553c6373153 100644
--- a/src/mesa/drivers/dri/i965/gen8_blorp.c
+++ b/src/mesa/drivers/dri/i965/gen8_blorp.c
@@ -295,6 +295,8 @@ gen8_blorp_emit_sbe_state(struct brw_context *brw,
const struct brw_blorp_params *params)
{
const unsigned num_varyings = params->wm_prog_data->num_varying_inputs;
+ const unsigned urb_read_length =
+ brw_blorp_get_urb_length(params->wm_prog_data);
/* 3DSTATE_SBE */
{
@@ -310,7 +312,7 @@ gen8_blorp_emit_sbe_state(struct brw_context *brw,
* than one vec4 worth of vertex attributes are needed.
*/
OUT_BATCH(num_varyings << GEN7_SBE_NUM_OUTPUTS_SHIFT |
- 1 << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
+ urb_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT |
BRW_SF_URB_ENTRY_READ_OFFSET <<
GEN8_SBE_URB_ENTRY_READ_OFFSET_SHIFT |
GEN8_SBE_FORCE_URB_ENTRY_READ_LENGTH |