vc4: let st lower rect tex

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8898>
This commit is contained in:
Christian Gmeiner
2021-02-06 21:14:49 +01:00
committed by Marge Bot
parent 9c67324542
commit 337ba88293
2 changed files with 12 additions and 16 deletions

View File

@@ -473,17 +473,6 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
};
uint32_t next_texture_u = 0;
/* There is no native support for GL texture rectangle coordinates, so
* we have to rescale from ([0, width], [0, height]) to ([0, 1], [0,
* 1]).
*/
if (instr->sampler_dim == GLSL_SAMPLER_DIM_RECT) {
s = qir_FMUL(c, s,
qir_uniform(c, QUNIFORM_TEXRECT_SCALE_X, unit));
t = qir_FMUL(c, t,
qir_uniform(c, QUNIFORM_TEXRECT_SCALE_Y, unit));
}
if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE || is_txl) {
texture_u[2] = qir_uniform(c, QUNIFORM_TEXTURE_CONFIG_P2,
unit | (is_txl << 16));
@@ -1877,6 +1866,17 @@ ntq_emit_intrinsic(struct vc4_compile *c, nir_intrinsic_instr *instr)
break;
}
case nir_intrinsic_load_texture_rect_scaling: {
assert(nir_src_is_const(instr->src[0]));
int sampler = nir_src_as_int(instr->src[0]);
ntq_store_dest(c, &instr->dest, 0,
qir_uniform(c, QUNIFORM_TEXRECT_SCALE_X, sampler));
ntq_store_dest(c, &instr->dest, 1,
qir_uniform(c, QUNIFORM_TEXRECT_SCALE_Y, sampler));
break;
}
default:
fprintf(stderr, "Unknown intrinsic: ");
nir_print_instr(&instr->instr, stderr);
@@ -2258,11 +2258,6 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
}
struct nir_lower_tex_options tex_options = {
/* We would need to implement txs, but we don't want the
* int/float conversions
*/
.lower_rect = false,
.lower_txp = ~0,
/* Apply swizzles to all samplers. */