panfrost: Scalarize nir_load_blend_const_color_rgba
Bifrost is a scalar architecture, which means we can't load all components of the blend constant at once. We could add a lowering pass to scalarize nir_load_blend_const_color_rgba, but it's easier to handle that at when lowering the blend equations. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
This commit is contained in:
parent
8d707cd918
commit
6d3fce5680
|
@ -266,7 +266,19 @@ nir_blend(
|
|||
return nir_blend_logicop(b, options, src, dst);
|
||||
|
||||
/* Grab the blend constant ahead of time */
|
||||
nir_ssa_def *bconst = nir_load_blend_const_color_rgba(b);
|
||||
nir_ssa_def *bconst;
|
||||
if (options.is_bifrost) {
|
||||
/* Bifrost is a scalar architecture, so let's split loads now to avoid a
|
||||
* lowering pass.
|
||||
*/
|
||||
bconst = nir_vec4(b,
|
||||
nir_load_blend_const_color_r_float(b),
|
||||
nir_load_blend_const_color_g_float(b),
|
||||
nir_load_blend_const_color_b_float(b),
|
||||
nir_load_blend_const_color_a_float(b));
|
||||
} else {
|
||||
bconst = nir_load_blend_const_color_rgba(b);
|
||||
}
|
||||
|
||||
if (options.half)
|
||||
bconst = nir_f2f16(b, bconst);
|
||||
|
|
|
@ -56,6 +56,7 @@ typedef struct {
|
|||
/* Use fp16 instead of fp32 */
|
||||
bool half;
|
||||
|
||||
bool is_bifrost;
|
||||
nir_ssa_def *src1;
|
||||
} nir_lower_blend_options;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <stdio.h>
|
||||
#include "pan_blend_shaders.h"
|
||||
#include "pan_util.h"
|
||||
#include "panfrost-quirks.h"
|
||||
#include "midgard/midgard_compile.h"
|
||||
#include "compiler/nir/nir_builder.h"
|
||||
#include "nir/nir_lower_blend.h"
|
||||
|
@ -134,6 +135,7 @@ panfrost_create_blend_shader(struct panfrost_context *ctx,
|
|||
struct panfrost_blend_state *state,
|
||||
const struct panfrost_blend_shader_key *key)
|
||||
{
|
||||
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
||||
struct panfrost_blend_shader *res = rzalloc(ctx, struct panfrost_blend_shader);
|
||||
|
||||
res->ctx = ctx;
|
||||
|
@ -201,6 +203,7 @@ panfrost_create_blend_shader(struct panfrost_context *ctx,
|
|||
|
||||
nir_lower_blend_options options = nir_make_options(&state->base, key->rt);
|
||||
options.format = key->format;
|
||||
options.is_bifrost = !!(dev->quirks & IS_BIFROST);
|
||||
options.src1 = s_src[1];
|
||||
|
||||
if (T == nir_type_float16)
|
||||
|
|
Loading…
Reference in New Issue