summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2021-12-14 11:55:06 -0600
committerMarge Bot <emma+marge@anholt.net>2021-12-14 18:09:03 +0000
commitb05d228695b0c8219d37188792224f9cb026b0f5 (patch)
tree15bb685522c40c64892e1a949df629ed2a882e8c
parentae4065f0b2d7aa47c22f1241b6ba6fdc0a440fd2 (diff)
Revert "anv: Stop doing too much per-sample shading"
This reverts commit 1f559930b6b7a633d93cd4e9cc4965b3f5e7c607. Turns out, this approach won't work. Fixes: 1f559930b6b7 ("anv: Stop doing too much per-sample shading") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14196>
-rw-r--r--src/intel/vulkan/anv_pipeline.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 08b4a495c62..b9db1c06d6a 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -497,13 +497,6 @@ pipeline_has_coarse_pixel(const struct anv_graphics_pipeline *pipeline,
return true;
}
-static bool
-is_sample_shading(const VkPipelineMultisampleStateCreateInfo *ms_info)
-{
- return ms_info->sampleShadingEnable &&
- (ms_info->minSampleShading * ms_info->rasterizationSamples) > 1;
-}
-
static void
populate_wm_prog_key(const struct anv_graphics_pipeline *pipeline,
VkPipelineShaderStageCreateFlags flags,
@@ -549,8 +542,14 @@ populate_wm_prog_key(const struct anv_graphics_pipeline *pipeline,
key->alpha_test_replicate_alpha = false;
if (ms_info) {
- key->persample_interp = is_sample_shading(ms_info);
- key->multisample_fbo = ms_info->rasterizationSamples > 1;
+ /* We should probably pull this out of the shader, but it's fairly
+ * harmless to compute it and then let dead-code take care of it.
+ */
+ if (ms_info->rasterizationSamples > 1) {
+ key->persample_interp = ms_info->sampleShadingEnable &&
+ (ms_info->minSampleShading * ms_info->rasterizationSamples) > 1;
+ key->multisample_fbo = true;
+ }
}
key->coarse_pixel =
@@ -2430,16 +2429,10 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT);
pipeline->depth_clip_enable = clip_info ? clip_info->depthClipEnable : !pipeline->depth_clamp_enable;
- /* If rasterization is not enabled, ms_info must be ignored. */
- const bool raster_enabled =
- !pCreateInfo->pRasterizationState->rasterizerDiscardEnable ||
- (pipeline->dynamic_states &
- ANV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE);
-
- const VkPipelineMultisampleStateCreateInfo *ms_info =
- raster_enabled ? pCreateInfo->pMultisampleState : NULL;
-
- pipeline->sample_shading_enable = ms_info && is_sample_shading(ms_info);
+ pipeline->sample_shading_enable =
+ !pCreateInfo->pRasterizationState->rasterizerDiscardEnable &&
+ pCreateInfo->pMultisampleState &&
+ pCreateInfo->pMultisampleState->sampleShadingEnable;
result = anv_pipeline_compile_graphics(pipeline, cache, pCreateInfo);
if (result != VK_SUCCESS) {
@@ -2521,6 +2514,15 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
pipeline->topology = vk_to_intel_primitive_type[ia_info->topology];
}
+ /* If rasterization is not enabled, ms_info must be ignored. */
+ const bool raster_enabled =
+ !pCreateInfo->pRasterizationState->rasterizerDiscardEnable ||
+ (pipeline->dynamic_states &
+ ANV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE);
+
+ const VkPipelineMultisampleStateCreateInfo *ms_info =
+ raster_enabled ? pCreateInfo->pMultisampleState : NULL;
+
const VkPipelineRasterizationLineStateCreateInfoEXT *line_info =
vk_find_struct_const(pCreateInfo->pRasterizationState->pNext,
PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT);