broadcom/compiler: track if the fragment shader forces per-sample MSAA
For example, regarding gl_SampleID, the GLSL spec states: "Any static use of this variable in a fragment shader causes the entire shader to be evaluated per-sample." So we need to track if the fragment shader does anything that implicitly enables per-sample shading in the compiler for the driver to auto-enable sample rate shading if needed. v2: - Instead of tracking reads of gl_SampleID, check SYSTEM_BIT_SAMPLE_ID and SYSTEM_BIT_SAMPLE_POS as well as the sample layout qualifier like other drivers are doing to activate this behavior (Eric). Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> (v1) Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:

committed by
Marge Bot

parent
5de282b50a
commit
1c4c7d95f7
@@ -2827,6 +2827,11 @@ nir_to_vir(struct v3d_compile *c)
|
||||
c->line_x = emit_fragment_varying(c, NULL, 0, 0);
|
||||
c->uses_implicit_point_line_varyings = true;
|
||||
}
|
||||
|
||||
c->force_per_sample_msaa =
|
||||
c->s->info.fs.uses_sample_qualifier ||
|
||||
(c->s->info.system_values_read & (SYSTEM_BIT_SAMPLE_ID |
|
||||
SYSTEM_BIT_SAMPLE_POS));
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
/* Set up the TSO for barriers, assuming we do some. */
|
||||
|
@@ -571,6 +571,11 @@ struct v3d_compile {
|
||||
bool writes_z;
|
||||
bool uses_implicit_point_line_varyings;
|
||||
|
||||
/* If the fragment shader does anything that requires to force
|
||||
* per-sample MSAA, such as reading gl_SampleID.
|
||||
*/
|
||||
bool force_per_sample_msaa;
|
||||
|
||||
/* Whether we are using the fallback scheduler. This will be set after
|
||||
* register allocation has failed once.
|
||||
*/
|
||||
@@ -798,6 +803,7 @@ struct v3d_fs_prog_data {
|
||||
bool uses_center_w;
|
||||
bool uses_implicit_point_line_varyings;
|
||||
bool lock_scoreboard_on_first_thrsw;
|
||||
bool force_per_sample_msaa;
|
||||
};
|
||||
|
||||
struct v3d_compute_prog_data {
|
||||
|
@@ -760,6 +760,7 @@ v3d_fs_set_prog_data(struct v3d_compile *c,
|
||||
c->uses_implicit_point_line_varyings;
|
||||
prog_data->lock_scoreboard_on_first_thrsw =
|
||||
c->lock_scoreboard_on_first_thrsw;
|
||||
prog_data->force_per_sample_msaa = c->force_per_sample_msaa;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user