mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 07:10:15 +01:00
radv: fix guardband if the polygon mode is points or lines
If points or lines are drawn using the polygon mode, the guardband
should be adjusted for large points/lines.
Cc: 22.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20185>
(cherry picked from commit 12f26b5e6d)
This commit is contained in:
parent
5f387adc02
commit
7fa84a47df
4 changed files with 34 additions and 7 deletions
|
|
@ -3226,7 +3226,7 @@
|
|||
"description": "radv: fix guardband if the polygon mode is points or lines",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2980,7 +2980,7 @@ radv_emit_guardband_state(struct radv_cmd_buffer *cmd_buffer)
|
|||
}
|
||||
|
||||
si_write_guardband(cmd_buffer->cs, d->viewport.count, d->viewport.viewports, rast_prim,
|
||||
d->line_width);
|
||||
d->polygon_mode, d->line_width);
|
||||
|
||||
cmd_buffer->state.dirty &= ~RADV_CMD_DIRTY_GUARDBAND;
|
||||
}
|
||||
|
|
@ -6009,8 +6009,13 @@ radv_CmdSetPolygonModeEXT(VkCommandBuffer commandBuffer, VkPolygonMode polygonMo
|
|||
{
|
||||
RADV_FROM_HANDLE(radv_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
struct radv_cmd_state *state = &cmd_buffer->state;
|
||||
unsigned polygon_mode = si_translate_fill(polygonMode);
|
||||
|
||||
state->dynamic.polygon_mode = si_translate_fill(polygonMode);
|
||||
if (radv_polygon_mode_is_points_or_lines(state->dynamic.polygon_mode) !=
|
||||
radv_polygon_mode_is_points_or_lines(polygon_mode))
|
||||
state->dirty |= RADV_CMD_DIRTY_GUARDBAND;
|
||||
|
||||
state->dynamic.polygon_mode = polygon_mode;
|
||||
|
||||
state->dirty |= RADV_CMD_DIRTY_DYNAMIC_POLYGON_MODE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1733,7 +1733,7 @@ void si_write_scissors(struct radeon_cmdbuf *cs, int count, const VkRect2D *scis
|
|||
const VkViewport *viewports);
|
||||
|
||||
void si_write_guardband(struct radeon_cmdbuf *cs, int count, const VkViewport *viewports,
|
||||
unsigned rast_prim, float line_width);
|
||||
unsigned rast_prim, unsigned polygon_mode, float line_width);
|
||||
|
||||
uint32_t si_get_ia_multi_vgt_param(struct radv_cmd_buffer *cmd_buffer, bool instanced_draw,
|
||||
bool indirect_draw, bool count_from_stream_output,
|
||||
|
|
@ -3027,6 +3027,24 @@ radv_rast_prim_is_points_or_lines(unsigned rast_prim)
|
|||
return radv_rast_prim_is_point(rast_prim) || radv_rast_prim_is_line(rast_prim);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
radv_polygon_mode_is_point(unsigned polygon_mode)
|
||||
{
|
||||
return polygon_mode == V_028814_X_DRAW_POINTS;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
radv_polygon_mode_is_line(unsigned polygon_mode)
|
||||
{
|
||||
return polygon_mode == V_028814_X_DRAW_LINES;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
radv_polygon_mode_is_points_or_lines(unsigned polygon_mode)
|
||||
{
|
||||
return radv_polygon_mode_is_point(polygon_mode) || radv_polygon_mode_is_line(polygon_mode);
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
radv_get_num_vertices_per_prim(const struct radv_pipeline_key *pipeline_key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -745,8 +745,12 @@ si_write_scissors(struct radeon_cmdbuf *cs, int count, const VkRect2D *scissors,
|
|||
|
||||
void
|
||||
si_write_guardband(struct radeon_cmdbuf *cs, int count, const VkViewport *viewports,
|
||||
unsigned rast_prim, float line_width)
|
||||
unsigned rast_prim, unsigned polygon_mode, float line_width)
|
||||
{
|
||||
const bool draw_points =
|
||||
radv_rast_prim_is_point(rast_prim) || radv_polygon_mode_is_point(polygon_mode);
|
||||
const bool draw_lines =
|
||||
radv_rast_prim_is_line(rast_prim) || radv_polygon_mode_is_line(polygon_mode);
|
||||
int i;
|
||||
float scale[3], translate[3], guardband_x = INFINITY, guardband_y = INFINITY;
|
||||
float discard_x = 1.0f, discard_y = 1.0f;
|
||||
|
|
@ -767,12 +771,12 @@ si_write_guardband(struct radeon_cmdbuf *cs, int count, const VkViewport *viewpo
|
|||
guardband_x = MIN2(guardband_x, (max_range - fabsf(translate[0])) / scale[0]);
|
||||
guardband_y = MIN2(guardband_y, (max_range - fabsf(translate[1])) / scale[1]);
|
||||
|
||||
if (radv_rast_prim_is_points_or_lines(rast_prim)) {
|
||||
if (draw_points || draw_lines) {
|
||||
/* When rendering wide points or lines, we need to be more conservative about when to
|
||||
* discard them entirely. */
|
||||
float pixels;
|
||||
|
||||
if (rast_prim == V_028A6C_POINTLIST) {
|
||||
if (draw_points) {
|
||||
pixels = 8191.875f;
|
||||
} else {
|
||||
pixels = line_width;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue