void visit(ir_emit_vertex *);
void visit(ir_end_primitive *);
- uint32_t gather_channel(ir_texture *ir, int sampler);
- void swizzle_result(ir_texture *ir, fs_reg orig_val, int sampler);
+ uint32_t gather_channel(ir_texture *ir, uint32_t sampler);
+ void swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler);
fs_inst *emit(fs_inst *inst);
void emit(exec_list list);
void emit_interpolation_setup_gen6();
void compute_sample_position(fs_reg dst, fs_reg int_sample_pos);
fs_reg rescale_texcoord(ir_texture *ir, fs_reg coordinate,
- bool is_rect, int sampler, int texunit);
+ bool is_rect, uint32_t sampler, int texunit);
fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
- fs_reg shadow_comp, fs_reg lod, fs_reg lod2);
+ fs_reg shadow_comp, fs_reg lod, fs_reg lod2,
+ uint32_t sampler);
fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate,
fs_reg shadow_comp, fs_reg lod, fs_reg lod2,
- fs_reg sample_index);
+ fs_reg sample_index, uint32_t sampler);
fs_inst *emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
fs_reg shadow_comp, fs_reg lod, fs_reg lod2,
- fs_reg sample_index, fs_reg mcs, int sampler);
- fs_reg emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, int sampler);
+ fs_reg sample_index, fs_reg mcs, uint32_t sampler);
+ fs_reg emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, uint32_t sampler);
void emit_gen6_gather_wa(uint8_t wa, fs_reg dst);
fs_reg fix_math_operand(fs_reg src);
fs_inst *emit_math(enum opcode op, fs_reg dst, fs_reg src0);
if (brw->gen >= 7) {
inst = emit_texture_gen7(ir, dst, coordinate, shadow_c, lod, dpdy, sample_index, fs_reg(0u), fpi->TexSrcUnit);
} else if (brw->gen >= 5) {
- inst = emit_texture_gen5(ir, dst, coordinate, shadow_c, lod, dpdy, sample_index);
+ inst = emit_texture_gen5(ir, dst, coordinate, shadow_c, lod, dpdy, sample_index, fpi->TexSrcUnit);
} else {
- inst = emit_texture_gen4(ir, dst, coordinate, shadow_c, lod, dpdy);
+ inst = emit_texture_gen4(ir, dst, coordinate, shadow_c, lod, dpdy, fpi->TexSrcUnit);
}
inst->sampler = fpi->TexSrcUnit;
fs_inst *
fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
- fs_reg shadow_c, fs_reg lod, fs_reg dPdy)
+ fs_reg shadow_c, fs_reg lod, fs_reg dPdy,
+ uint32_t sampler)
{
int mlen;
int base_mrf = 1;
unreachable("not reached");
}
- fs_inst *inst = emit(opcode, dst, reg_undef);
+ fs_inst *inst = emit(opcode, dst, reg_undef, fs_reg(sampler));
inst->base_mrf = base_mrf;
inst->mlen = mlen;
inst->header_present = true;
fs_inst *
fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate,
fs_reg shadow_c, fs_reg lod, fs_reg lod2,
- fs_reg sample_index)
+ fs_reg sample_index, uint32_t sampler)
{
int mlen = 0;
int base_mrf = 2;
unreachable("not reached");
}
- fs_inst *inst = emit(opcode, dst, reg_undef);
+ fs_inst *inst = emit(opcode, dst, reg_undef, fs_reg(sampler));
inst->base_mrf = base_mrf;
inst->mlen = mlen;
inst->header_present = header_present;
fs_inst *
fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
fs_reg shadow_c, fs_reg lod, fs_reg lod2,
- fs_reg sample_index, fs_reg mcs, int sampler)
+ fs_reg sample_index, fs_reg mcs, uint32_t sampler)
{
int reg_width = dispatch_width / 8;
bool header_present = false;
default:
unreachable("not reached");
}
- fs_inst *inst = emit(opcode, dst, src_payload);
+ fs_inst *inst = emit(opcode, dst, src_payload, fs_reg(sampler));
inst->base_mrf = -1;
if (reg_width == 2)
inst->mlen = length * reg_width - header_present;
fs_reg
fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
- bool is_rect, int sampler, int texunit)
+ bool is_rect, uint32_t sampler, int texunit)
{
fs_inst *inst = NULL;
bool needs_gl_clamp = true;
/* Sample from the MCS surface attached to this multisample texture. */
fs_reg
-fs_visitor::emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, int sampler)
+fs_visitor::emit_mcs_fetch(ir_texture *ir, fs_reg coordinate, uint32_t sampler)
{
int reg_width = dispatch_width / 8;
int length = ir->coordinate->type->vector_elements;
emit(LOAD_PAYLOAD(payload, sources, length));
- fs_inst *inst = emit(SHADER_OPCODE_TXF_MCS, dest, payload);
+ fs_inst *inst = emit(SHADER_OPCODE_TXF_MCS, dest, payload, fs_reg(sampler));
inst->base_mrf = -1;
inst->mlen = length * reg_width;
inst->header_present = false;
{
fs_inst *inst = NULL;
- int sampler =
+ uint32_t sampler =
_mesa_get_sampler_uniform_value(ir->sampler, shader_prog, prog);
/* FINISHME: We're failing to recompile our programs when the sampler is
* updated. This only matters for the texture rectangle scale parameters
lod, lod2, sample_index, mcs, sampler);
} else if (brw->gen >= 5) {
inst = emit_texture_gen5(ir, dst, coordinate, shadow_comparitor,
- lod, lod2, sample_index);
+ lod, lod2, sample_index, sampler);
} else {
inst = emit_texture_gen4(ir, dst, coordinate, shadow_comparitor,
- lod, lod2);
+ lod, lod2, sampler);
}
if (ir->offset != NULL && ir->op != ir_txf)
* Set up the gather channel based on the swizzle, for gather4.
*/
uint32_t
-fs_visitor::gather_channel(ir_texture *ir, int sampler)
+fs_visitor::gather_channel(ir_texture *ir, uint32_t sampler)
{
ir_constant *chan = ir->lod_info.component->as_constant();
int swiz = GET_SWZ(key->tex.swizzles[sampler], chan->value.i[0]);
* EXT_texture_swizzle as well as DEPTH_TEXTURE_MODE for shadow comparisons.
*/
void
-fs_visitor::swizzle_result(ir_texture *ir, fs_reg orig_val, int sampler)
+fs_visitor::swizzle_result(ir_texture *ir, fs_reg orig_val, uint32_t sampler)
{
if (ir->op == ir_query_levels) {
/* # levels is in .w */