anv: rework sample location

On Gfx7 we can only give the sample location for a given multisample
number. This means everytime the multisampling value changes, we have
to re-emit the locations. It's fine because it's also where
(3DSTATE_MULTISAMPLE) the number of samples is stored.

On Gfx8+ though, 3DSTATE_MULTISAMPLE only holds the number of samples
and all the sample locations for all number of samples are located in
3DSTATE_SAMPLE_PATTERN. So to be more effecient there, we need to
track the locations for all sample numbers and compare new values with
the relevant sample count when touching the dynamic state.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16220>
This commit is contained in:
Lionel Landwerlin
2022-04-27 23:44:40 +03:00
committed by Marge Bot
parent 810518fda7
commit 168b13364f
9 changed files with 153 additions and 121 deletions

View File

@@ -49,6 +49,7 @@
#include "common/intel_gem.h"
#include "common/intel_l3_config.h"
#include "common/intel_measure.h"
#include "common/intel_sample_positions.h"
#include "dev/intel_device_info.h"
#include "blorp/blorp.h"
#include "compiler/brw_compiler.h"
@@ -2707,7 +2708,13 @@ struct anv_dynamic_state {
} line_stipple;
struct {
VkSampleLocationEXT locations[MAX_SAMPLE_LOCATIONS];
struct intel_sample_position locations_1[1];
struct intel_sample_position locations_2[2];
struct intel_sample_position locations_4[4];
struct intel_sample_position locations_8[8];
struct intel_sample_position locations_16[16];
/* Only valid on the pipeline dynamic state */
unsigned pipeline_samples;
} sample_locations;
struct {
@@ -2736,10 +2743,25 @@ struct anv_dynamic_state {
extern const struct anv_dynamic_state default_dynamic_state;
void anv_dynamic_state_init(struct anv_dynamic_state *state);
uint32_t anv_dynamic_state_copy(struct anv_dynamic_state *dest,
const struct anv_dynamic_state *src,
uint32_t copy_mask);
static inline struct intel_sample_position *
anv_dynamic_state_get_sample_locations(struct anv_dynamic_state *state,
unsigned samples)
{
switch (samples) {
case 1: return state->sample_locations.locations_1; break;
case 2: return state->sample_locations.locations_2; break;
case 4: return state->sample_locations.locations_4; break;
case 8: return state->sample_locations.locations_8; break;
case 16: return state->sample_locations.locations_16; break;
default: unreachable("invalid sample count");
}
}
struct anv_surface_state {
struct anv_state state;
/** Address of the surface referred to by this state