mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 09:20:12 +01:00
i965: Write gl_FragCoord directly to the destination.
This patch makes emit_general_interpolation take a destination register as an argument, and write directly to that. This is simpler than the old approach of ralloc'ing a register, writing to that temporary, and then making the caller emit per-component MOVs to copy it to the actual destination. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
parent
a03812c321
commit
7ef7738a61
3 changed files with 4 additions and 10 deletions
|
|
@ -1039,12 +1039,10 @@ fs_visitor::import_uniforms(fs_visitor *v)
|
||||||
this->uniforms = v->uniforms;
|
this->uniforms = v->uniforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_reg *
|
void
|
||||||
fs_visitor::emit_fragcoord_interpolation()
|
fs_visitor::emit_fragcoord_interpolation(fs_reg wpos)
|
||||||
{
|
{
|
||||||
assert(stage == MESA_SHADER_FRAGMENT);
|
assert(stage == MESA_SHADER_FRAGMENT);
|
||||||
fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::vec4_type));
|
|
||||||
fs_reg wpos = *reg;
|
|
||||||
|
|
||||||
/* gl_FragCoord.x */
|
/* gl_FragCoord.x */
|
||||||
bld.MOV(wpos, this->pixel_x);
|
bld.MOV(wpos, this->pixel_x);
|
||||||
|
|
@ -1066,8 +1064,6 @@ fs_visitor::emit_fragcoord_interpolation()
|
||||||
|
|
||||||
/* gl_FragCoord.w: Already set up in emit_interpolation */
|
/* gl_FragCoord.w: Already set up in emit_interpolation */
|
||||||
bld.MOV(wpos, this->wpos_w);
|
bld.MOV(wpos, this->wpos_w);
|
||||||
|
|
||||||
return reg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum brw_barycentric_mode
|
static enum brw_barycentric_mode
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ public:
|
||||||
|
|
||||||
void emit_dummy_fs();
|
void emit_dummy_fs();
|
||||||
void emit_repclear_shader();
|
void emit_repclear_shader();
|
||||||
fs_reg *emit_fragcoord_interpolation();
|
void emit_fragcoord_interpolation(fs_reg wpos);
|
||||||
fs_reg *emit_frontfacing_interpolation();
|
fs_reg *emit_frontfacing_interpolation();
|
||||||
fs_reg *emit_samplepos_setup();
|
fs_reg *emit_samplepos_setup();
|
||||||
fs_reg *emit_sampleid_setup();
|
fs_reg *emit_sampleid_setup();
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,7 @@ fs_visitor::nir_setup_inputs()
|
||||||
|
|
||||||
fs_reg reg;
|
fs_reg reg;
|
||||||
if (var->data.location == VARYING_SLOT_POS) {
|
if (var->data.location == VARYING_SLOT_POS) {
|
||||||
reg = *emit_fragcoord_interpolation();
|
emit_fragcoord_interpolation(input);
|
||||||
emit_percomp(bld, fs_inst(BRW_OPCODE_MOV, bld.dispatch_width(),
|
|
||||||
input, reg), 0xF);
|
|
||||||
} else if (var->data.location == VARYING_SLOT_LAYER) {
|
} else if (var->data.location == VARYING_SLOT_LAYER) {
|
||||||
struct brw_reg reg = suboffset(interp_reg(VARYING_SLOT_LAYER, 1), 3);
|
struct brw_reg reg = suboffset(interp_reg(VARYING_SLOT_LAYER, 1), 3);
|
||||||
reg.type = BRW_REGISTER_TYPE_D;
|
reg.type = BRW_REGISTER_TYPE_D;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue