asahi: Expose PIPE_CAP_CLIP_HALFZ
Use the Zink lowering pass to handle the non-halfz case. Metal, like Vulkan, uses half-z (and Metal is not configurable, making r/e tricky). Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11084>
This commit is contained in:

committed by
Marge Bot

parent
acfeba4010
commit
5de49375ec
@@ -1080,9 +1080,14 @@ agx_compile_shader_nir(nir_shader *nir,
|
|||||||
glsl_get_natural_size_align_bytes);
|
glsl_get_natural_size_align_bytes);
|
||||||
NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
|
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);
|
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_split_var_copies);
|
||||||
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
|
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
|
||||||
NIR_PASS_V(nir, nir_lower_var_copies);
|
NIR_PASS_V(nir, nir_lower_var_copies);
|
||||||
|
@@ -116,6 +116,9 @@ struct agx_vs_shader_key {
|
|||||||
unsigned vbuf_strides[AGX_MAX_VBUFS];
|
unsigned vbuf_strides[AGX_MAX_VBUFS];
|
||||||
|
|
||||||
struct agx_attribute attributes[AGX_MAX_ATTRIBS];
|
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 {
|
struct agx_fs_shader_key {
|
||||||
|
@@ -595,6 +595,7 @@ agx_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
|||||||
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
|
case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
|
||||||
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
|
case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
|
||||||
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
|
||||||
|
case PIPE_CAP_CLIP_HALFZ:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PIPE_CAP_MAX_RENDER_TARGETS:
|
case PIPE_CAP_MAX_RENDER_TARGETS:
|
||||||
|
@@ -752,7 +752,8 @@ static bool
|
|||||||
agx_update_vs(struct agx_context *ctx)
|
agx_update_vs(struct agx_context *ctx)
|
||||||
{
|
{
|
||||||
struct agx_vs_shader_key key = {
|
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,
|
memcpy(key.attributes, ctx->attributes,
|
||||||
|
Reference in New Issue
Block a user