gallium: explicitly specify line rasterization mode

Currently, drivers infer the line rasterization mode from the
multisampling and line_smooth rasterization state. This is always
correct for OpenGL, but is subtly incorrect for DirectX 9, 10 and
Vulkan (when VK_EXT_line_rasterization is supported).

So let's allow front-ends to choose freely between rectangle and
paralellogram rendering.

The reason why there's no added cap for this, is that the implicit
selection that drivers currently do will work just as well (or more
correclty, just as subtly wrong) as before. And there's nothing
reasonable the front-ends can do to get the correct behavior, so
there's really no fall-back code to write either.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11782>
This commit is contained in:
Erik Faye-Lund
2021-07-07 11:44:20 +02:00
committed by Marge Bot
parent e0472217b0
commit 1c2690ec20
7 changed files with 11 additions and 1 deletions

View File

@@ -815,11 +815,14 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
pipeline->line_smooth = line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
pipeline->disable_multisample = line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT ||
line_state->lineRasterizationMode == VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT;
pipeline->line_rectangular = line_state->lineRasterizationMode != VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT &&
line_state->lineRasterizationMode != VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT;
if (!dynamic_state_contains(pipeline->graphics_create_info.pDynamicState, VK_DYNAMIC_STATE_LINE_STIPPLE_EXT)) {
pipeline->line_stipple_factor = line_state->lineStippleFactor - 1;
pipeline->line_stipple_pattern = line_state->lineStipplePattern;
}
}
} else
pipeline->line_rectangular = false;
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {