diff options
author | Kenneth Graunke <[email protected]> | 2015-08-28 00:29:05 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-09-03 22:31:03 -0700 |
commit | 323962182547aeafcdb3bac28434ef81f70eb785 (patch) | |
tree | da5b88f17f8921000cf9f2bab98e5aa047a2ce4a /src/mesa/drivers | |
parent | 27e83b62bb52de7a681ed82679a707555023f43d (diff) |
i965: Virtualize vec4_visitor::emit_urb_slot().
This avoids a downcast of key, which won't exist in the base class soon.
I'm not a huge fan of this patch, but given that we're currently using
inheritance, this seems like the "right" way to do it. The alternative
is to make key a void pointer in the parent class and continue
downcasting.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 1 |
4 files changed, 28 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h index 10439f21af5..7df87b5d841 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.h +++ b/src/mesa/drivers/dri/i965/brw_vec4.h @@ -360,7 +360,7 @@ public: void emit_ndc_computation(); void emit_psiz_and_flags(dst_reg reg); vec4_instruction *emit_generic_urb_slot(dst_reg reg, int varying); - void emit_urb_slot(dst_reg reg, int varying); + virtual void emit_urb_slot(dst_reg reg, int varying); void emit_shader_time_begin(); void emit_shader_time_end(); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index f85f2f95a02..034286fbf2e 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -3233,21 +3233,6 @@ 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: { - /* These built-in varyings are only supported in compatibility mode, - * and we only support GS in core profile. So, this must be a vertex - * shader. - */ - assert(stage == MESA_SHADER_VERTEX); - vec4_instruction *inst = emit_generic_urb_slot(reg, varying); - if (((struct brw_vs_prog_key *) key)->clamp_vertex_color) - inst->saturate = true; - break; - } - default: emit_generic_urb_slot(reg, varying); break; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp index f81ee4e5bc0..442cefd6c43 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_vs_visitor.cpp @@ -202,6 +202,32 @@ vec4_vs_visitor::emit_urb_write_opcode(bool complete) void +vec4_vs_visitor::emit_urb_slot(dst_reg reg, int varying) +{ + reg.type = BRW_REGISTER_TYPE_F; + output_reg[varying].type = reg.type; + + switch (varying) { + case VARYING_SLOT_COL0: + case VARYING_SLOT_COL1: + case VARYING_SLOT_BFC0: + case VARYING_SLOT_BFC1: { + /* These built-in varyings are only supported in compatibility mode, + * and we only support GS in core profile. So, this must be a vertex + * shader. + */ + vec4_instruction *inst = emit_generic_urb_slot(reg, varying); + if (key->clamp_vertex_color) + inst->saturate = true; + break; + } + default: + return vec4_visitor::emit_urb_slot(reg, varying); + } +} + + +void vec4_vs_visitor::emit_clip_distances(dst_reg reg, int offset) { /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special Variables): diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index e98679affc1..3a847fcd28a 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -103,6 +103,7 @@ protected: virtual void emit_program_code(); virtual void emit_thread_end(); virtual void emit_urb_write_header(int mrf); + virtual void emit_urb_slot(dst_reg reg, int varying); virtual vec4_instruction *emit_urb_write_opcode(bool complete); private: |