mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
i965: Add support for texturing with bias to i965 FS backend.
Fixes 5 piglit tests for bias. Note that LOD is a 1.30 feature and not yet supported.
This commit is contained in:
parent
f3eebb8465
commit
40aadafa91
2 changed files with 60 additions and 17 deletions
|
|
@ -686,6 +686,9 @@
|
||||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5 1
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5 1
|
||||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5 2
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5 2
|
||||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5 3
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5 3
|
||||||
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_DERIVS_GEN5 4
|
||||||
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5 5
|
||||||
|
#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE_GEN5 6
|
||||||
|
|
||||||
/* for GEN5 only */
|
/* for GEN5 only */
|
||||||
#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0
|
#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,8 @@ enum fs_opcodes {
|
||||||
FS_OPCODE_DDY,
|
FS_OPCODE_DDY,
|
||||||
FS_OPCODE_LINTERP,
|
FS_OPCODE_LINTERP,
|
||||||
FS_OPCODE_TEX,
|
FS_OPCODE_TEX,
|
||||||
|
FS_OPCODE_TXB,
|
||||||
|
FS_OPCODE_TXL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int using_new_fs = -1;
|
static int using_new_fs = -1;
|
||||||
|
|
@ -921,15 +923,24 @@ fs_visitor::visit(ir_texture *ir)
|
||||||
* performance relevant?
|
* performance relevant?
|
||||||
*/
|
*/
|
||||||
fs_reg dst = fs_reg(this, glsl_type::vec4_type);
|
fs_reg dst = fs_reg(this, glsl_type::vec4_type);
|
||||||
this->result = dst;
|
|
||||||
|
|
||||||
switch (ir->op) {
|
switch (ir->op) {
|
||||||
case ir_tex:
|
case ir_tex:
|
||||||
inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf)));
|
inst = emit(fs_inst(FS_OPCODE_TEX, dst, fs_reg(MRF, base_mrf)));
|
||||||
break;
|
break;
|
||||||
case ir_txb:
|
case ir_txb:
|
||||||
|
ir->lod_info.bias->accept(this);
|
||||||
|
emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
|
||||||
|
mlen++;
|
||||||
|
|
||||||
|
inst = emit(fs_inst(FS_OPCODE_TXB, dst, fs_reg(MRF, base_mrf)));
|
||||||
|
break;
|
||||||
case ir_txl:
|
case ir_txl:
|
||||||
assert(!"FINISHME");
|
ir->lod_info.lod->accept(this);
|
||||||
|
emit(fs_inst(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result));
|
||||||
|
mlen++;
|
||||||
|
|
||||||
|
inst = emit(fs_inst(FS_OPCODE_TXL, dst, fs_reg(MRF, base_mrf)));
|
||||||
break;
|
break;
|
||||||
case ir_txd:
|
case ir_txd:
|
||||||
case ir_txf:
|
case ir_txf:
|
||||||
|
|
@ -937,6 +948,8 @@ fs_visitor::visit(ir_texture *ir)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->result = dst;
|
||||||
|
|
||||||
if (ir->shadow_comparitor)
|
if (ir->shadow_comparitor)
|
||||||
inst->shadow_compare = true;
|
inst->shadow_compare = true;
|
||||||
inst->mlen = mlen;
|
inst->mlen = mlen;
|
||||||
|
|
@ -1382,24 +1395,49 @@ fs_visitor::generate_math(fs_inst *inst,
|
||||||
void
|
void
|
||||||
fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
|
fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
|
||||||
{
|
{
|
||||||
int msg_type;
|
int msg_type = -1;
|
||||||
|
int rlen = 4;
|
||||||
|
|
||||||
if (intel->gen == 5) {
|
if (intel->gen == 5) {
|
||||||
if (inst->shadow_compare)
|
switch (inst->opcode) {
|
||||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5;
|
case FS_OPCODE_TEX:
|
||||||
else
|
if (inst->shadow_compare) {
|
||||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5;
|
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5;
|
||||||
|
} else {
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case FS_OPCODE_TXB:
|
||||||
|
if (inst->shadow_compare) {
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5;
|
||||||
|
} else {
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Note that G45 and older determines shadow compare and dispatch width
|
switch (inst->opcode) {
|
||||||
* from message length for most messages.
|
case FS_OPCODE_TEX:
|
||||||
*/
|
/* Note that G45 and older determines shadow compare and dispatch width
|
||||||
if (inst->shadow_compare)
|
* from message length for most messages.
|
||||||
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE;
|
*/
|
||||||
else
|
if (inst->shadow_compare) {
|
||||||
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE;
|
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE;
|
||||||
|
} else {
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE;
|
||||||
|
}
|
||||||
|
case FS_OPCODE_TXB:
|
||||||
|
if (inst->shadow_compare) {
|
||||||
|
assert(!"FINISHME: shadow compare with bias.");
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
|
||||||
|
} else {
|
||||||
|
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
|
||||||
|
rlen = 8;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
assert(msg_type != -1);
|
||||||
int response_length = 4;
|
|
||||||
|
|
||||||
/* g0 header. */
|
/* g0 header. */
|
||||||
src.nr--;
|
src.nr--;
|
||||||
|
|
@ -1412,7 +1450,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src)
|
||||||
inst->sampler,
|
inst->sampler,
|
||||||
WRITEMASK_XYZW,
|
WRITEMASK_XYZW,
|
||||||
msg_type,
|
msg_type,
|
||||||
response_length,
|
rlen,
|
||||||
inst->mlen + 1,
|
inst->mlen + 1,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
|
|
@ -1649,6 +1687,8 @@ fs_visitor::generate_code()
|
||||||
generate_linterp(inst, dst, src);
|
generate_linterp(inst, dst, src);
|
||||||
break;
|
break;
|
||||||
case FS_OPCODE_TEX:
|
case FS_OPCODE_TEX:
|
||||||
|
case FS_OPCODE_TXB:
|
||||||
|
case FS_OPCODE_TXL:
|
||||||
generate_tex(inst, dst, src[0]);
|
generate_tex(inst, dst, src[0]);
|
||||||
break;
|
break;
|
||||||
case FS_OPCODE_FB_WRITE:
|
case FS_OPCODE_FB_WRITE:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue