summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2022-03-15 23:35:24 +0200
committerMarge Bot <emma+marge@anholt.net>2022-03-24 10:49:07 +0000
commit8cdd5647c6c3c52a0ff046791d39afb1ad6beac9 (patch)
treea3ad661f321a5c131bd284f4127b8965092350c2
parent6f5f817c0fa414d23b7e843fc27237053b072a2c (diff)
anv: don't store sample location sample count
This information should match the current pipeline sample count. 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/15310>
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c4
-rw-r--r--src/intel/vulkan/anv_pipeline.c24
-rw-r--r--src/intel/vulkan/anv_private.h1
-rw-r--r--src/intel/vulkan/genX_pipeline.c6
-rw-r--r--src/intel/vulkan/gfx7_cmd_buffer.c2
-rw-r--r--src/intel/vulkan/gfx8_cmd_buffer.c2
6 files changed, 15 insertions, 24 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index fc0e10c3a7a..bbc2de808b6 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -199,10 +199,9 @@ 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) {
- dest->sample_locations.samples = src->sample_locations.samples;
typed_memcpy(dest->sample_locations.locations,
src->sample_locations.locations,
- dest->sample_locations.samples);
+ ARRAY_SIZE(src->sample_locations.locations));
changed |= ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
}
@@ -857,7 +856,6 @@ void anv_CmdSetSampleLocationsEXT(
struct anv_dynamic_state *dyn_state = &cmd_buffer->state.gfx.dynamic;
uint32_t samples = pSampleLocationsInfo->sampleLocationsPerPixel;
- dyn_state->sample_locations.samples = samples;
typed_memcpy(dyn_state->sample_locations.locations,
pSampleLocationsInfo->pSampleLocations, samples);
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 7c6c0d4419f..c0b147e0587 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -2292,27 +2292,21 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
const VkPipelineSampleLocationsStateCreateInfoEXT *sl_info = ms_info ?
vk_find_struct_const(ms_info, PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT) : NULL;
+ uint32_t samples = ms_info ? ms_info->rasterizationSamples : 1;
if (sl_info) {
- dynamic->sample_locations.samples =
- sl_info->sampleLocationsInfo.sampleLocationsCount;
const VkSampleLocationEXT *positions =
sl_info->sampleLocationsInfo.pSampleLocations;
- for (uint32_t i = 0; i < dynamic->sample_locations.samples; i++) {
+ for (uint32_t i = 0; i < samples; i++) {
+ dynamic->sample_locations.locations[i].x = positions[i].x;
+ dynamic->sample_locations.locations[i].y = positions[i].y;
+ }
+ } else {
+ const struct intel_sample_position *positions =
+ intel_get_sample_positions(samples);
+ for (uint32_t i = 0; i < samples; i++) {
dynamic->sample_locations.locations[i].x = positions[i].x;
dynamic->sample_locations.locations[i].y = positions[i].y;
}
- }
- }
- /* Ensure we always have valid values for sample_locations. */
- if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations &&
- dynamic->sample_locations.samples == 0) {
- dynamic->sample_locations.samples =
- ms_info ? ms_info->rasterizationSamples : 1;
- const struct intel_sample_position *positions =
- intel_get_sample_positions(dynamic->sample_locations.samples);
- for (uint32_t i = 0; i < dynamic->sample_locations.samples; i++) {
- dynamic->sample_locations.locations[i].x = positions[i].x;
- dynamic->sample_locations.locations[i].y = positions[i].y;
}
}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 7e95f240635..412c9e430ce 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2738,7 +2738,6 @@ struct anv_dynamic_state {
} line_stipple;
struct {
- uint32_t samples;
VkSampleLocationEXT locations[MAX_SAMPLE_LOCATIONS];
} sample_locations;
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 1816e45a6c4..bc0157dbec5 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -925,7 +925,7 @@ emit_ms_state(struct anv_graphics_pipeline *pipeline,
#if GFX_VER >= 8
/* On Gfx8+ 3DSTATE_MULTISAMPLE only holds the number of samples. */
genX(emit_multisample)(&pipeline->base.batch,
- info ? info->rasterizationSamples : 1,
+ pipeline->rasterization_samples,
NULL);
#endif
@@ -938,11 +938,11 @@ emit_ms_state(struct anv_graphics_pipeline *pipeline,
!(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
#if GFX_VER >= 8
genX(emit_sample_pattern)(&pipeline->base.batch,
- pipeline->dynamic_state.sample_locations.samples,
+ pipeline->rasterization_samples,
pipeline->dynamic_state.sample_locations.locations);
#else
genX(emit_multisample)(&pipeline->base.batch,
- pipeline->dynamic_state.sample_locations.samples,
+ pipeline->rasterization_samples,
pipeline->dynamic_state.sample_locations.locations);
#endif
}
diff --git a/src/intel/vulkan/gfx7_cmd_buffer.c b/src/intel/vulkan/gfx7_cmd_buffer.c
index e75dd890f4f..9d9ead4b695 100644
--- a/src/intel/vulkan/gfx7_cmd_buffer.c
+++ b/src/intel/vulkan/gfx7_cmd_buffer.c
@@ -305,7 +305,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
if (anv_cmd_buffer_needs_dynamic_state(cmd_buffer,
ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
genX(emit_multisample)(&cmd_buffer->batch,
- d->sample_locations.samples,
+ pipeline->rasterization_samples,
d->sample_locations.locations);
}
diff --git a/src/intel/vulkan/gfx8_cmd_buffer.c b/src/intel/vulkan/gfx8_cmd_buffer.c
index 623cdd4bcfa..8c36251b07c 100644
--- a/src/intel/vulkan/gfx8_cmd_buffer.c
+++ b/src/intel/vulkan/gfx8_cmd_buffer.c
@@ -633,7 +633,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
if (anv_cmd_buffer_needs_dynamic_state(cmd_buffer,
ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
genX(emit_sample_pattern)(&cmd_buffer->batch,
- d->sample_locations.samples,
+ pipeline->rasterization_samples,
d->sample_locations.locations);
}