diff --git a/src/asahi/genxml/cmdbuf.xml b/src/asahi/genxml/cmdbuf.xml index 71ff0abfdf6..33c6607cffe 100644 --- a/src/asahi/genxml/cmdbuf.xml +++ b/src/asahi/genxml/cmdbuf.xml @@ -469,11 +469,11 @@ - + - + - + diff --git a/src/asahi/lib/agx_helpers.h b/src/asahi/lib/agx_helpers.h index 109a77913bd..38922d4c287 100644 --- a/src/asahi/lib/agx_helpers.h +++ b/src/asahi/lib/agx_helpers.h @@ -150,11 +150,17 @@ agx_translate_depth_layout(enum gl_frag_depth_layout layout) } static void -agx_ppp_fragment_face_2(struct agx_ppp_update *ppp, - enum agx_object_type object_type, - struct agx_shader_info *info) +agx_pack_fragment_face_2(struct agx_fragment_face_2_packed *out, + enum agx_object_type object_type, + struct agx_shader_info *info) { - agx_ppp_push(ppp, FRAGMENT_FACE_2, cfg) { + agx_pack(out, FRAGMENT_FACE_2, cfg) { + /* These act like disables, ANDed in the hardware. Setting them like this + * means the draw-time flag is used. + */ + cfg.disable_depth_write = true; + cfg.depth_function = AGX_ZS_FUNC_ALWAYS; + cfg.object_type = object_type; cfg.conservative_depth = info ? agx_translate_depth_layout(info->depth_layout) @@ -162,6 +168,16 @@ agx_ppp_fragment_face_2(struct agx_ppp_update *ppp, } } +static void +agx_ppp_fragment_face_2(struct agx_ppp_update *ppp, + enum agx_object_type object_type, + struct agx_shader_info *info) +{ + struct agx_fragment_face_2_packed packed; + agx_pack_fragment_face_2(&packed, object_type, info); + agx_ppp_push_packed(ppp, &packed, FRAGMENT_FACE_2); +} + static inline uint32_t agx_pack_line_width(float line_width) { diff --git a/src/asahi/vulkan/hk_cmd_draw.c b/src/asahi/vulkan/hk_cmd_draw.c index 170b93dd0db..c7aaba3bca7 100644 --- a/src/asahi/vulkan/hk_cmd_draw.c +++ b/src/asahi/vulkan/hk_cmd_draw.c @@ -2517,18 +2517,16 @@ hk_flush_ppp_state(struct hk_cmd_buffer *cmd, struct hk_cs *cs, uint8_t **out) } if (dirty.fragment_front_face_2) { - agx_pack(&fragment_face_2, FRAGMENT_FACE_2, cfg) { - cfg.object_type = gfx->object_type; + if (fs) { + agx_pack(&fragment_face_2, FRAGMENT_FACE_2, cfg) { + cfg.object_type = gfx->object_type; + } - /* TODO: flip the default? */ - if (fs) - cfg.conservative_depth = 0; - } - - if (fs) agx_merge(fragment_face_2, fs->frag_face, FRAGMENT_FACE_2); - - agx_ppp_push_packed(&ppp, &fragment_face_2, FRAGMENT_FACE_2); + agx_ppp_push_packed(&ppp, &fragment_face_2, FRAGMENT_FACE_2); + } else { + agx_ppp_fragment_face_2(&ppp, gfx->object_type, NULL); + } } if (dirty.fragment_front_stencil) { diff --git a/src/asahi/vulkan/hk_shader.c b/src/asahi/vulkan/hk_shader.c index ca243a822e7..7d481538d8d 100644 --- a/src/asahi/vulkan/hk_shader.c +++ b/src/asahi/vulkan/hk_shader.c @@ -753,10 +753,7 @@ hk_upload_shader(struct hk_device *dev, struct hk_shader *shader) } if (shader->info.stage == MESA_SHADER_FRAGMENT) { - agx_pack(&shader->frag_face, FRAGMENT_FACE_2, cfg) { - cfg.conservative_depth = - agx_translate_depth_layout(shader->b.info.depth_layout); - } + agx_pack_fragment_face_2(&shader->frag_face, 0, &shader->b.info); } agx_pack(&shader->counts, COUNTS, cfg) {