bool nir_lower_point_size(nir_shader *shader, float min, float max);
void nir_lower_texcoord_replace(nir_shader *s, unsigned coord_replace,
- bool point_coord_is_sysval);
+ bool point_coord_is_sysval, bool yinvert);
typedef enum {
nir_lower_interpolation_at_sample = (1 << 1),
static void
nir_lower_texcoord_replace_impl(nir_function_impl *impl,
unsigned coord_replace,
- bool point_coord_is_sysval)
+ bool point_coord_is_sysval,
+ bool yinvert)
{
nir_builder b;
*/
nir_ssa_def *zero = nir_imm_zero(&b, 1, new_coord->bit_size);
nir_ssa_def *one = nir_imm_floatN_t(&b, 1.0, new_coord->bit_size);
+ nir_ssa_def *y = nir_channel(&b, new_coord, 1);
+ if (yinvert)
+ y = nir_fsub(&b, nir_imm_float(&b, 1.0), y);
new_coord = nir_vec4(&b, nir_channel(&b, new_coord, 0),
- nir_channel(&b, new_coord, 1),
+ y,
zero, one);
nir_foreach_block(block, impl) {
void
nir_lower_texcoord_replace(nir_shader *s, unsigned coord_replace,
- bool point_coord_is_sysval)
+ bool point_coord_is_sysval, bool yinvert)
{
assert(s->info.stage == MESA_SHADER_FRAGMENT);
assert(coord_replace != 0);
nir_foreach_function(function, s) {
if (function->impl)
nir_lower_texcoord_replace_impl(function->impl, coord_replace,
- point_coord_is_sysval);
+ point_coord_is_sysval, yinvert);
}
}
if (key->lower_texcoord_replace) {
bool point_coord_is_sysval = st->ctx->Const.GLSLPointCoordIsSysVal;
NIR_PASS_V(state.ir.nir, nir_lower_texcoord_replace,
- key->lower_texcoord_replace, point_coord_is_sysval);
+ key->lower_texcoord_replace, point_coord_is_sysval, false);
finalize = true;
}