[Mesa-dev] [PATCH v5 09/11] anv: Optimized the emission of the default locations on Gen8+

Jason Ekstrand jason at jlekstrand.net
Fri Mar 15 00:08:28 UTC 2019


From: Eleni Maria Stea <estea at igalia.com>

We only emit sample locations when the extension is enabled by the user.
In all other cases the default locations are emitted once when the device
is initialized to increase performance.
---
 src/intel/vulkan/genX_cmd_buffer.c | 1 +
 src/intel/vulkan/genX_pipeline.c   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 5d2b17cf8ae..ca684f6aa72 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -2797,6 +2797,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
       gen7_cmd_buffer_emit_scissor(cmd_buffer);
 
    if (cmd_buffer->state.gfx.dynamic.sample_locations.valid) {
+      assert(cmd_buffer->device->enabled_extensions.EXT_sample_locations);
       uint32_t samples = cmd_buffer->state.gfx.dynamic.sample_locations.samples;
       const VkSampleLocationEXT *locations =
          cmd_buffer->state.gfx.dynamic.sample_locations.locations;
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 828fcb17fcc..ffd5c7c6409 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -580,7 +580,8 @@ emit_ms_state(struct anv_pipeline *pipeline,
    }
 
 #if GEN_GEN >= 8
-   genX(emit_sample_pattern)(&pipeline->batch, samples, locations);
+   if (pipeline->device->enabled_extensions.EXT_sample_locations)
+      genX(emit_sample_pattern)(&pipeline->batch, samples, locations);
 #endif
 
    genX(emit_multisample)(&pipeline->batch, samples, locations);
-- 
2.20.1



More information about the mesa-dev mailing list