Mesa (master): i965/vs: Handle vertex color clamping in emit_urb_slot().
Kenneth Graunke
kwg at kemper.freedesktop.org
Wed Dec 3 01:01:12 UTC 2014
Module: Mesa
Branch: master
Commit: 169b6c1955deee7333d61f9ff149b7124bdea7d1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=169b6c1955deee7333d61f9ff149b7124bdea7d1
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Mon Dec 1 00:53:02 2014 -0800
i965/vs: Handle vertex color clamping in emit_urb_slot().
Vertex color clamping only applies to a few specific built-ins: COL0/1
and BFC0/1 (aka gl_[Secondary]{Front,Back}Color). It seems weird to
handle special cases in a function called emit_generic_urb_slot().
emit_urb_slot() is all about handling special cases, so it makes more
sense to handle this there.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
---
src/mesa/drivers/dri/i965/brw_vec4.h | 2 +-
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 500ec79..d94c323 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -502,7 +502,7 @@ public:
void emit_ndc_computation();
void emit_psiz_and_flags(dst_reg reg);
void emit_clip_distances(dst_reg reg, int offset);
- void emit_generic_urb_slot(dst_reg reg, int varying);
+ vec4_instruction *emit_generic_urb_slot(dst_reg reg, int varying);
void emit_urb_slot(dst_reg reg, int varying);
void emit_shader_time_begin();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 417dcb1..96816b6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3055,22 +3055,14 @@ vec4_visitor::emit_clip_distances(dst_reg reg, int offset)
}
}
-void
+vec4_instruction *
vec4_visitor::emit_generic_urb_slot(dst_reg reg, int varying)
{
assert (varying < VARYING_SLOT_MAX);
reg.type = output_reg[varying].type;
current_annotation = output_reg_annotation[varying];
/* Copy the register, saturating if necessary */
- vec4_instruction *inst = emit(MOV(reg,
- src_reg(output_reg[varying])));
- if ((varying == VARYING_SLOT_COL0 ||
- varying == VARYING_SLOT_COL1 ||
- varying == VARYING_SLOT_BFC0 ||
- varying == VARYING_SLOT_BFC1) &&
- key->clamp_vertex_color) {
- inst->saturate = true;
- }
+ return emit(MOV(reg, src_reg(output_reg[varying])));
}
void
@@ -3108,6 +3100,16 @@ vec4_visitor::emit_urb_slot(dst_reg reg, int varying)
case BRW_VARYING_SLOT_PAD:
/* No need to write to this slot */
break;
+ case VARYING_SLOT_COL0:
+ case VARYING_SLOT_COL1:
+ case VARYING_SLOT_BFC0:
+ case VARYING_SLOT_BFC1: {
+ vec4_instruction *inst = emit_generic_urb_slot(reg, varying);
+ if (key->clamp_vertex_color)
+ inst->saturate = true;
+ break;
+ }
+
default:
emit_generic_urb_slot(reg, varying);
break;
More information about the mesa-commit
mailing list