glsl_get_natural_size_align_bytes);
NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
- if (ctx->stage == MESA_SHADER_VERTEX)
+ if (ctx->stage == MESA_SHADER_VERTEX) {
agx_remap_varyings(nir);
+ /* Lower from OpenGL [-1, 1] to [0, 1] if half-z is not set */
+ if (!key->vs.clip_halfz)
+ NIR_PASS_V(nir, nir_lower_clip_halfz);
+ }
+
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, nir_lower_var_copies);
unsigned vbuf_strides[AGX_MAX_VBUFS];
struct agx_attribute attributes[AGX_MAX_ATTRIBS];
+
+ /* Set to true for clip coordinates to range [0, 1] instead of [-1, 1] */
+ bool clip_halfz : 1;
};
struct agx_fs_shader_key {
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
+ case PIPE_CAP_CLIP_HALFZ:
return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
agx_update_vs(struct agx_context *ctx)
{
struct agx_vs_shader_key key = {
- .num_vbufs = util_last_bit(ctx->vb_mask)
+ .num_vbufs = util_last_bit(ctx->vb_mask),
+ .clip_halfz = ctx->rast->base.clip_halfz,
};
memcpy(key.attributes, ctx->attributes,