mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 23:20:14 +01:00
r300: use point sprite coordinates only when drawing points (v5)
Fixes piglit arb_point_sprite-interactions Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/364 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/370 Reviewed-by: Emma Anholt <emma@anholt.net> Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14389>
This commit is contained in:
parent
3e5f4cebe8
commit
66ea0f84c2
4 changed files with 24 additions and 5 deletions
|
|
@ -576,6 +576,8 @@ struct r300_context {
|
|||
unsigned char blitter_saved_skip_rendering;
|
||||
/* Point sprites texcoord index, 1 bit per texcoord */
|
||||
int sprite_coord_enable;
|
||||
/* Whether we are drawing points, to disable sprite coord if not */
|
||||
boolean is_point;
|
||||
/* Whether two-sided color selection is enabled (AKA light_twoside). */
|
||||
boolean two_sided_color;
|
||||
boolean flatshade;
|
||||
|
|
|
|||
|
|
@ -807,6 +807,12 @@ static void r300_draw_vbo(struct pipe_context* pipe,
|
|||
return;
|
||||
}
|
||||
|
||||
if (r300->sprite_coord_enable != 0)
|
||||
if ((info.mode == PIPE_PRIM_POINTS) != r300->is_point) {
|
||||
r300->is_point = !r300->is_point;
|
||||
r300_mark_atom_dirty(r300, &r300->rs_block_state);
|
||||
}
|
||||
|
||||
r300_update_derived_state(r300);
|
||||
|
||||
/* Draw. */
|
||||
|
|
@ -884,6 +890,12 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
|
|||
info->index_size, ~0);
|
||||
}
|
||||
|
||||
if (r300->sprite_coord_enable != 0)
|
||||
if ((info->mode == PIPE_PRIM_POINTS) != r300->is_point) {
|
||||
r300->is_point = !r300->is_point;
|
||||
r300_mark_atom_dirty(r300, &r300->rs_block_state);
|
||||
}
|
||||
|
||||
r300_update_derived_state(r300);
|
||||
|
||||
draw_vbo(r300->draw, info, drawid_offset, NULL, &draw, 1, 0);
|
||||
|
|
@ -1150,6 +1162,7 @@ void r300_blitter_draw_rectangle(struct blitter_context *blitter,
|
|||
{
|
||||
struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter));
|
||||
unsigned last_sprite_coord_enable = r300->sprite_coord_enable;
|
||||
unsigned last_is_point = r300->is_point;
|
||||
unsigned width = x2 - x1;
|
||||
unsigned height = y2 - y1;
|
||||
unsigned vertex_size =
|
||||
|
|
@ -1176,8 +1189,10 @@ void r300_blitter_draw_rectangle(struct blitter_context *blitter,
|
|||
r300->context.bind_vertex_elements_state(&r300->context, vertex_elements_cso);
|
||||
r300->context.bind_vs_state(&r300->context, get_vs(blitter));
|
||||
|
||||
if (type == UTIL_BLITTER_ATTRIB_TEXCOORD_XY)
|
||||
if (type == UTIL_BLITTER_ATTRIB_TEXCOORD_XY) {
|
||||
r300->sprite_coord_enable = 1;
|
||||
r300->is_point = true;
|
||||
}
|
||||
|
||||
r300_update_derived_state(r300);
|
||||
|
||||
|
|
@ -1235,6 +1250,7 @@ done:
|
|||
r300_mark_atom_dirty(r300, &r300->viewport_state);
|
||||
|
||||
r300->sprite_coord_enable = last_sprite_coord_enable;
|
||||
r300->is_point = last_is_point;
|
||||
}
|
||||
|
||||
void r300_init_render_functions(struct r300_context *r300)
|
||||
|
|
|
|||
|
|
@ -1162,6 +1162,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
|
|||
|
||||
rs->rs.sprite_coord_enable = state->point_quad_rasterization *
|
||||
state->sprite_coord_enable;
|
||||
r300_context(pipe)->is_point = false;
|
||||
|
||||
/* Override some states for Draw. */
|
||||
rs->rs_draw.sprite_coord_enable = 0; /* We can do this in HW. */
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static void r300_draw_emit_all_attribs(struct r300_context* r300)
|
|||
gen_count = 0;
|
||||
for (i = 0; i < ATTR_GENERIC_COUNT && gen_count < 8; i++) {
|
||||
if (vs_outputs->generic[i] != ATTR_UNUSED &&
|
||||
!(r300->sprite_coord_enable & (1U << i))) {
|
||||
(!(r300->sprite_coord_enable & (1U << i)) || !r300->is_point)) {
|
||||
r300_draw_emit_attrib(r300, EMIT_4F, vs_outputs->generic[i]);
|
||||
gen_count++;
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ static void r300_update_rs_block(struct r300_context *r300)
|
|||
for (i = 0; i < ATTR_GENERIC_COUNT && col_count < 2; i++) {
|
||||
/* Cannot use color varyings for sprite coords. */
|
||||
if (fs_inputs->generic[i] != ATTR_UNUSED &&
|
||||
(r300->sprite_coord_enable & (1U << i))) {
|
||||
(r300->sprite_coord_enable & (1U << i)) && r300->is_point) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -486,7 +486,7 @@ static void r300_update_rs_block(struct r300_context *r300)
|
|||
boolean sprite_coord = false;
|
||||
|
||||
if (fs_inputs->generic[i] != ATTR_UNUSED) {
|
||||
sprite_coord = !!(r300->sprite_coord_enable & (1 << i));
|
||||
sprite_coord = !!(r300->sprite_coord_enable & (1 << i)) && r300->is_point;
|
||||
}
|
||||
|
||||
if (vs_outputs->generic[i] != ATTR_UNUSED || sprite_coord) {
|
||||
|
|
@ -625,7 +625,7 @@ static void r300_update_rs_block(struct r300_context *r300)
|
|||
rs.inst_count = count - 1;
|
||||
|
||||
/* set the GB enable flags */
|
||||
if (r300->sprite_coord_enable)
|
||||
if (r300->sprite_coord_enable && r300->is_point)
|
||||
stuffing_enable |= R300_GB_POINT_STUFF_ENABLE;
|
||||
|
||||
rs.gb_enable = stuffing_enable;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue