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:
Iago Toral Quiroga
2020-08-04 08:37:07 +02:00
committed by Marge Bot
parent 5de282b50a
commit 1c4c7d95f7
3 changed files with 12 additions and 0 deletions

View File

@@ -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 {