diff options
Diffstat (limited to 'src/asahi')
-rw-r--r-- | src/asahi/lib/agx_linker.h | 20 | ||||
-rw-r--r-- | src/asahi/lib/agx_nir_prolog_epilog.c | 22 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/asahi/lib/agx_linker.h b/src/asahi/lib/agx_linker.h index fe2e40afbc0..c28036c25bb 100644 --- a/src/asahi/lib/agx_linker.h +++ b/src/asahi/lib/agx_linker.h @@ -85,13 +85,25 @@ struct agx_fs_prolog_key { unsigned cf_base; }; +struct agx_blend_rt_key { + enum pipe_blend_func rgb_func : 3; + enum pipe_blendfactor rgb_src_factor : 5; + enum pipe_blendfactor rgb_dst_factor : 5; + enum pipe_blend_func alpha_func : 3; + enum pipe_blendfactor alpha_src_factor : 5; + enum pipe_blendfactor alpha_dst_factor : 5; + unsigned colormask : 4; + unsigned pad : 2; +}; +static_assert(sizeof(struct agx_blend_rt_key) == 4, "packed"); + struct agx_blend_key { - nir_lower_blend_rt rt[8]; - unsigned logicop_func; + struct agx_blend_rt_key rt[8]; + uint8_t logicop_func; bool alpha_to_coverage, alpha_to_one; - bool padding[2]; + bool padding; }; -static_assert(sizeof(struct agx_blend_key) == 232, "packed"); +static_assert(sizeof(struct agx_blend_key) == 36, "packed"); struct agx_fs_epilog_link_info { /* Base index of spilled render targets in the binding table */ diff --git a/src/asahi/lib/agx_nir_prolog_epilog.c b/src/asahi/lib/agx_nir_prolog_epilog.c index a6f4bd2cd9c..c40b1043387 100644 --- a/src/asahi/lib/agx_nir_prolog_epilog.c +++ b/src/asahi/lib/agx_nir_prolog_epilog.c @@ -258,13 +258,13 @@ lower_tests_zs(nir_shader *s, bool value) } static inline bool -blend_uses_2src(nir_lower_blend_rt rt) +blend_uses_2src(struct agx_blend_rt_key rt) { enum pipe_blendfactor factors[] = { - rt.rgb.src_factor, - rt.rgb.dst_factor, - rt.alpha.src_factor, - rt.alpha.dst_factor, + rt.rgb_src_factor, + rt.rgb_dst_factor, + rt.alpha_src_factor, + rt.alpha_dst_factor, }; for (unsigned i = 0; i < ARRAY_SIZE(factors); ++i) { @@ -337,10 +337,20 @@ agx_nir_fs_epilog(nir_builder *b, const void *key_) }; static_assert(ARRAY_SIZE(opts.format) == 8, "max RTs out of sync"); - memcpy(opts.rt, key->blend.rt, sizeof(opts.rt)); for (unsigned i = 0; i < 8; ++i) { opts.format[i] = key->rt_formats[i]; + opts.rt[i] = (nir_lower_blend_rt){ + .rgb.src_factor = key->blend.rt[i].rgb_src_factor, + .rgb.dst_factor = key->blend.rt[i].rgb_dst_factor, + .rgb.func = key->blend.rt[i].rgb_func, + + .alpha.src_factor = key->blend.rt[i].alpha_src_factor, + .alpha.dst_factor = key->blend.rt[i].alpha_dst_factor, + .alpha.func = key->blend.rt[i].alpha_func, + + .colormask = key->blend.rt[i].colormask, + }; } /* It's more efficient to use masked stores (with |