summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2013-02-23 08:28:18 -0800
committerPaul Berry <[email protected]>2013-03-15 09:25:57 -0700
commit10a131211ef18fa1d368dee394045df945dcbb6e (patch)
tree843962c13b6282be5fa0b9b3fa7f952d115887a6 /src/mesa/drivers
parent827c074fb1e3c138363673896777009f96a76bd8 (diff)
Get rid of _mesa_vert_result_to_frag_attrib().
Now that there is no difference between the enums that represent vertex outputs and fragment inputs, there's no need for a conversion function. But we still need to be able to detect when a given vertex output has no corresponding fragment input. So it is replaced by a new function, _mesa_varying_slot_in_fs(), which tells whether the given varying slot exists as an FS input or not. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Tested-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_constval.c13
2 files changed, 9 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e5c0536d478..3d6a8f5a602 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1265,16 +1265,14 @@ fs_visitor::calculate_urb_setup()
continue;
if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) {
- int fp_index = _mesa_vert_result_to_frag_attrib((gl_varying_slot) i);
-
/* The back color slot is skipped when the front color is
* also written to. In addition, some slots can be
* written in the vertex shader and not read in the
* fragment shader. So the register number must always be
* incremented, mapped or not.
*/
- if (fp_index >= 0)
- urb_setup[fp_index] = urb_next;
+ if (_mesa_varying_slot_in_fs((gl_varying_slot) i))
+ urb_setup[i] = urb_next;
urb_next++;
}
}
@@ -3001,10 +2999,8 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
key.proj_attrib_mask |= BITFIELD64_BIT(i);
if (intel->gen < 6) {
- int vp_index = _mesa_vert_result_to_frag_attrib((gl_varying_slot) i);
-
- if (vp_index >= 0)
- key.vp_outputs_written |= BITFIELD64_BIT(vp_index);
+ if (_mesa_varying_slot_in_fs((gl_varying_slot) i))
+ key.vp_outputs_written |= BITFIELD64_BIT(i);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c
index e623b4c5e9f..782f9d734d8 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_constval.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c
@@ -144,17 +144,14 @@ static void calc_sizes( struct tracker *t )
* which describes the fragment program input sizes.
*/
for (vertRes = 0; vertRes < VARYING_SLOT_MAX; vertRes++) {
-
- /* map vertex program output index to fragment program input index */
- GLint fragAttrib = _mesa_vert_result_to_frag_attrib(vertRes);
- if (fragAttrib < 0)
+ if (!_mesa_varying_slot_in_fs(vertRes))
continue;
switch (get_output_size(t, vertRes)) {
- case 4: t->size_masks[4-1] |= BITFIELD64_BIT(fragAttrib);
- case 3: t->size_masks[3-1] |= BITFIELD64_BIT(fragAttrib);
- case 2: t->size_masks[2-1] |= BITFIELD64_BIT(fragAttrib);
- case 1: t->size_masks[1-1] |= BITFIELD64_BIT(fragAttrib);
+ case 4: t->size_masks[4-1] |= BITFIELD64_BIT(vertRes);
+ case 3: t->size_masks[3-1] |= BITFIELD64_BIT(vertRes);
+ case 2: t->size_masks[2-1] |= BITFIELD64_BIT(vertRes);
+ case 1: t->size_masks[1-1] |= BITFIELD64_BIT(vertRes);
break;
}
}