mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-05 06:00:36 +02:00
freedreno/a6xx: Add dual_color_blend_by_location
Needed by unigine heaven. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27969>
This commit is contained in:
parent
c82edb4e8f
commit
850267ef99
10 changed files with 46 additions and 0 deletions
|
|
@ -72,6 +72,9 @@ struct ir3_compiler_options {
|
|||
bool lower_base_vertex;
|
||||
|
||||
bool shared_push_consts;
|
||||
|
||||
/* "dual_color_blend_by_location" workaround is enabled: */
|
||||
bool dual_color_blend_by_location;
|
||||
};
|
||||
|
||||
struct ir3_compiler {
|
||||
|
|
|
|||
|
|
@ -167,6 +167,21 @@ ir3_context_init(struct ir3_compiler *compiler, struct ir3_shader *shader,
|
|||
|
||||
ir3_ibo_mapping_init(&so->image_mapping, ctx->s->info.num_textures);
|
||||
|
||||
/* Implement the "dual_color_blend_by_location" workaround for Unigine Heaven
|
||||
* and Unigine Valley, by remapping FRAG_RESULT_DATA1 to be the 2nd color
|
||||
* channel of FRAG_RESULT_DATA0.
|
||||
*/
|
||||
if ((so->type == MESA_SHADER_FRAGMENT) && so->key.force_dual_color_blend) {
|
||||
nir_variable *var = nir_find_variable_with_location(
|
||||
ctx->s, nir_var_shader_out, FRAG_RESULT_DATA1);
|
||||
if (var) {
|
||||
var->data.location = FRAG_RESULT_DATA0;
|
||||
var->data.index = 1;
|
||||
nir_shader_gather_info(ctx->s, nir_shader_get_entrypoint(ctx->s));
|
||||
so->dual_src_blend = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -523,6 +523,11 @@ ir3_setup_used_key(struct ir3_shader *shader)
|
|||
SYSTEM_VALUE_BARYCENTRIC_PERSP_CENTROID) ||
|
||||
BITSET_TEST(info->system_values_read,
|
||||
SYSTEM_VALUE_BARYCENTRIC_LINEAR_CENTROID)));
|
||||
|
||||
/* Only enable this shader key bit if "dual_color_blend_by_location" is
|
||||
* enabled:
|
||||
*/
|
||||
key->force_dual_color_blend = shader->compiler->options.dual_color_blend_by_location;
|
||||
} else if (info->stage == MESA_SHADER_COMPUTE) {
|
||||
key->fastc_srgb = ~0;
|
||||
key->fsamples = ~0;
|
||||
|
|
|
|||
|
|
@ -358,6 +358,11 @@ struct ir3_shader_key {
|
|||
* the limit:
|
||||
*/
|
||||
unsigned safe_constlen : 1;
|
||||
|
||||
/* Whether driconf "dual_color_blend_by_location" workaround is
|
||||
* enabled
|
||||
*/
|
||||
unsigned force_dual_color_blend : 1;
|
||||
};
|
||||
uint32_t global;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -170,6 +170,10 @@ setup_state_map(struct fd_context *ctx)
|
|||
BIT(FD6_GROUP_PROG) | BIT(FD6_GROUP_PROG_KEY));
|
||||
fd_context_add_map(ctx, FD_DIRTY_RASTERIZER | FD_DIRTY_MIN_SAMPLES | FD_DIRTY_FRAMEBUFFER,
|
||||
BIT(FD6_GROUP_PROG_KEY));
|
||||
if (ctx->screen->driconf.dual_color_blend_by_location) {
|
||||
fd_context_add_map(ctx, FD_DIRTY_BLEND_DUAL,
|
||||
BIT(FD6_GROUP_PROG_KEY));
|
||||
}
|
||||
fd_context_add_map(ctx, FD_DIRTY_RASTERIZER, BIT(FD6_GROUP_RASTERIZER));
|
||||
fd_context_add_map(ctx,
|
||||
FD_DIRTY_FRAMEBUFFER | FD_DIRTY_RASTERIZER_DISCARD |
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include "freedreno_state.h"
|
||||
|
||||
#include "fd6_barrier.h"
|
||||
#include "fd6_blend.h"
|
||||
#include "fd6_blitter.h"
|
||||
#include "fd6_context.h"
|
||||
#include "fd6_draw.h"
|
||||
|
|
@ -235,6 +236,11 @@ get_program_state(struct fd_context *ctx, const struct pipe_draw_info *info)
|
|||
key.key.msaa = (ctx->framebuffer.samples > 1);
|
||||
key.key.rasterflat = ctx->rasterizer->flatshade;
|
||||
|
||||
if (unlikely(ctx->screen->driconf.dual_color_blend_by_location)) {
|
||||
struct fd6_blend_stateobj *blend = fd6_blend_stateobj(ctx->blend);
|
||||
key.key.force_dual_color_blend = blend->use_dual_src_blend;
|
||||
}
|
||||
|
||||
if (PIPELINE == HAS_TESS_GS) {
|
||||
if (info->mode == MESA_PRIM_PATCHES) {
|
||||
struct shader_info *gs_info =
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ DRI_CONF_SECTION_END
|
|||
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
DRI_CONF_DISABLE_THROTTLING(false)
|
||||
DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
|
|
|||
|
|
@ -1176,6 +1176,8 @@ fd_screen_create(int fd,
|
|||
!driQueryOptionb(config->options, "disable_conservative_lrz");
|
||||
screen->driconf.enable_throttling =
|
||||
!driQueryOptionb(config->options, "disable_throttling");
|
||||
screen->driconf.dual_color_blend_by_location =
|
||||
driQueryOptionb(config->options, "dual_color_blend_by_location");
|
||||
|
||||
struct sysinfo si;
|
||||
sysinfo(&si);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@ struct fd_screen {
|
|||
/* Enable EGL throttling (default true).
|
||||
*/
|
||||
bool enable_throttling;
|
||||
|
||||
/* If "dual_color_blend_by_location" workaround is enabled
|
||||
*/
|
||||
bool dual_color_blend_by_location;
|
||||
} driconf;
|
||||
|
||||
struct fd_dev_info dev_info;
|
||||
|
|
|
|||
|
|
@ -582,6 +582,7 @@ ir3_screen_init(struct pipe_screen *pscreen)
|
|||
ir3_shader_descriptor_set(PIPE_SHADER_FRAGMENT),
|
||||
.bindless_fb_read_slot = IR3_BINDLESS_IMAGE_OFFSET +
|
||||
IR3_BINDLESS_IMAGE_COUNT - 1 - screen->max_rts,
|
||||
.dual_color_blend_by_location = screen->driconf.dual_color_blend_by_location,
|
||||
};
|
||||
|
||||
if (screen->gen >= 6) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue