mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
mesa: Move the advanced blend bitmask to shader_info.
For drivers that don't lower advanced blend to FBFETCH, we need the bitmask to be in the NIR shader so that it gets carried over to TGSI successfully. Reviewed-by: Rob Clark <robdclark@chromium.org> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12813>
This commit is contained in:
parent
a45c84f226
commit
91dc863921
9 changed files with 15 additions and 25 deletions
|
|
@ -256,6 +256,7 @@ glsl_to_nir(struct gl_context *ctx,
|
|||
if (shader->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
shader->info.fs.pixel_center_integer = sh->Program->info.fs.pixel_center_integer;
|
||||
shader->info.fs.origin_upper_left = sh->Program->info.fs.origin_upper_left;
|
||||
shader->info.fs.advanced_blend_modes = sh->Program->info.fs.advanced_blend_modes;
|
||||
}
|
||||
|
||||
return shader;
|
||||
|
|
|
|||
|
|
@ -2126,7 +2126,7 @@ link_fs_inout_layout_qualifiers(struct gl_shader_program *prog,
|
|||
shader->SampleInterlockOrdered;
|
||||
linked_shader->Program->info.fs.sample_interlock_unordered |=
|
||||
shader->SampleInterlockUnordered;
|
||||
linked_shader->Program->sh.fs.BlendSupport |= shader->BlendSupport;
|
||||
linked_shader->Program->info.fs.advanced_blend_modes |= shader->BlendSupport;
|
||||
}
|
||||
|
||||
linked_shader->Program->info.fs.pixel_center_integer = pixel_center_integer;
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@ get_main(gl_linked_shader *sh)
|
|||
bool
|
||||
lower_blend_equation_advanced(struct gl_linked_shader *sh, bool coherent)
|
||||
{
|
||||
if (sh->Program->sh.fs.BlendSupport == 0)
|
||||
if (sh->Program->info.fs.advanced_blend_modes == 0)
|
||||
return false;
|
||||
|
||||
/* Lower early returns in main() so there's a single exit point
|
||||
|
|
@ -548,7 +548,7 @@ lower_blend_equation_advanced(struct gl_linked_shader *sh, bool coherent)
|
|||
|
||||
ir_variable *result_dest =
|
||||
calc_blend_result(f, mode, fb, blend_source,
|
||||
sh->Program->sh.fs.BlendSupport);
|
||||
sh->Program->info.fs.advanced_blend_modes);
|
||||
|
||||
/* Copy the result back to the original values. It would be simpler
|
||||
* to demote the program's output variables, and create a new vec4
|
||||
|
|
|
|||
|
|
@ -1127,9 +1127,6 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader)
|
|||
sizeof(struct gl_bindless_image) - ptr_size);
|
||||
}
|
||||
|
||||
blob_write_bytes(metadata, &glprog->sh.fs.BlendSupport,
|
||||
sizeof(glprog->sh.fs.BlendSupport));
|
||||
|
||||
write_shader_parameters(metadata, glprog->Parameters);
|
||||
|
||||
assert((glprog->driver_cache_blob == NULL) ==
|
||||
|
|
@ -1194,9 +1191,6 @@ read_shader_metadata(struct blob_reader *metadata,
|
|||
}
|
||||
}
|
||||
|
||||
blob_copy_bytes(metadata, (uint8_t *) &glprog->sh.fs.BlendSupport,
|
||||
sizeof(glprog->sh.fs.BlendSupport));
|
||||
|
||||
glprog->Parameters = _mesa_new_parameter_list();
|
||||
read_shader_parameters(metadata, glprog->Parameters);
|
||||
|
||||
|
|
|
|||
|
|
@ -410,6 +410,11 @@ typedef struct shader_info {
|
|||
unsigned color1_interp:3; /* glsl_interp_mode */
|
||||
bool color1_sample:1;
|
||||
bool color1_centroid:1;
|
||||
|
||||
/* Bitmask of gl_advanced_blend_mode values that may be used with this
|
||||
* shader.
|
||||
*/
|
||||
unsigned advanced_blend_modes;
|
||||
} fs;
|
||||
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -2350,6 +2350,11 @@ ureg_setup_fragment_shader(struct ureg_program *ureg,
|
|||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->fs.advanced_blend_modes) {
|
||||
ureg_property(ureg, TGSI_PROPERTY_FS_BLEND_EQUATION_ADVANCED,
|
||||
info->fs.advanced_blend_modes);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
|
|||
*/
|
||||
const struct gl_program *prog =
|
||||
ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
|
||||
const GLbitfield blend_support = !prog ? 0 : prog->sh.fs.BlendSupport;
|
||||
const GLbitfield blend_support = !prog ? 0 : prog->info.fs.advanced_blend_modes;
|
||||
|
||||
if ((blend_support & BITFIELD_BIT(ctx->Color._AdvancedBlendMode)) == 0)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -2258,15 +2258,6 @@ struct gl_program
|
|||
GLuint NumBindlessImages;
|
||||
GLboolean HasBoundBindlessImage;
|
||||
struct gl_bindless_image *BindlessImages;
|
||||
|
||||
union {
|
||||
struct {
|
||||
/**
|
||||
* A bitmask of gl_advanced_blend_mode values
|
||||
*/
|
||||
GLbitfield BlendSupport;
|
||||
} fs;
|
||||
};
|
||||
} sh;
|
||||
|
||||
/** ARB assembly-style program fields */
|
||||
|
|
|
|||
|
|
@ -6858,12 +6858,6 @@ st_translate_program(
|
|||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (program->shader->Program->sh.fs.BlendSupport)
|
||||
ureg_property(ureg,
|
||||
TGSI_PROPERTY_FS_BLEND_EQUATION_ADVANCED,
|
||||
program->shader->Program->sh.fs.BlendSupport);
|
||||
|
||||
}
|
||||
else if (procType == PIPE_SHADER_VERTEX) {
|
||||
for (i = 0; i < numOutputs; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue