anv: Stop recording sample locations per-sample-count
The only reason why we recorded them per-sample-count is because Intel hardware is weird starting with Broadwell. The API, requires that the dynamic sample pattern be reset every time the sample count changes so we only need to record the pattern for the current sample count. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17564>
This commit is contained in:

committed by
Marge Bot

parent
36417bd05b
commit
18868f1c76
@@ -110,17 +110,6 @@ void
|
||||
anv_dynamic_state_init(struct anv_dynamic_state *state)
|
||||
{
|
||||
*state = default_dynamic_state;
|
||||
|
||||
#define INIT_LOCATIONS(idx) \
|
||||
memcpy(state->sample_locations.locations_##idx, \
|
||||
intel_sample_positions_##idx##x, \
|
||||
sizeof(state->sample_locations.locations_##idx))
|
||||
INIT_LOCATIONS(1);
|
||||
INIT_LOCATIONS(2);
|
||||
INIT_LOCATIONS(4);
|
||||
INIT_LOCATIONS(8);
|
||||
INIT_LOCATIONS(16);
|
||||
#undef INIT_LOCATIONS
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,26 +203,17 @@ anv_dynamic_state_copy(struct anv_dynamic_state *dest,
|
||||
ANV_CMP_COPY(logic_op, ANV_CMD_DIRTY_DYNAMIC_LOGIC_OP);
|
||||
|
||||
if (copy_mask & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS) {
|
||||
#define ANV_CMP_COPY_LOCATIONS(idx) \
|
||||
if (memcmp(dest->sample_locations.locations_##idx, \
|
||||
src->sample_locations.locations_##idx, \
|
||||
sizeof(src->sample_locations.locations_##idx))) { \
|
||||
typed_memcpy(dest->sample_locations.locations_##idx, \
|
||||
src->sample_locations.locations_##idx, \
|
||||
ARRAY_SIZE(src->sample_locations.locations_##idx)); \
|
||||
changed |= ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS; \
|
||||
ANV_CMP_COPY(sample_locations.samples,
|
||||
ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS);
|
||||
if (memcmp(dest->sample_locations.locations,
|
||||
src->sample_locations.locations,
|
||||
src->sample_locations.samples *
|
||||
sizeof(*src->sample_locations.locations))) {
|
||||
typed_memcpy(dest->sample_locations.locations,
|
||||
src->sample_locations.locations,
|
||||
src->sample_locations.samples);
|
||||
changed |= ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
|
||||
}
|
||||
|
||||
switch (src->sample_locations.pipeline_samples) {
|
||||
case 1: ANV_CMP_COPY_LOCATIONS(1); break;
|
||||
case 2: ANV_CMP_COPY_LOCATIONS(2); break;
|
||||
case 4: ANV_CMP_COPY_LOCATIONS(4); break;
|
||||
case 8: ANV_CMP_COPY_LOCATIONS(8); break;
|
||||
case 16: ANV_CMP_COPY_LOCATIONS(16); break;
|
||||
default: unreachable("invalid sample count");
|
||||
}
|
||||
|
||||
#undef ANV_CMP_COPY_LOCATIONS
|
||||
}
|
||||
|
||||
ANV_CMP_COPY(color_writes, ANV_CMD_DIRTY_DYNAMIC_COLOR_BLEND_STATE);
|
||||
@@ -888,7 +868,13 @@ void anv_CmdSetSampleLocationsEXT(
|
||||
struct anv_dynamic_state *dyn_state = &cmd_buffer->state.gfx.dynamic;
|
||||
uint32_t samples = pSampleLocationsInfo->sampleLocationsPerPixel;
|
||||
struct intel_sample_position *positions =
|
||||
anv_dynamic_state_get_sample_locations(dyn_state, samples);
|
||||
dyn_state->sample_locations.locations;
|
||||
|
||||
if (dyn_state->sample_locations.samples != samples) {
|
||||
dyn_state->sample_locations.samples = samples;
|
||||
cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < samples; i++) {
|
||||
if (positions[i].x != pSampleLocationsInfo->pSampleLocations[i].x ||
|
||||
positions[i].y != pSampleLocationsInfo->pSampleLocations[i].y) {
|
||||
|
Reference in New Issue
Block a user