mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
draw: fix pstipple and aaline stages wrt sampler_views/samplers
Those stages only really work for OGL-style texturing (so number of samplers and views mostly the same, certainly for the max values). These get often set up all at once, thus there might be max number of both even if all of them are just NULL. We must not set the max number of samplers and views to the same value since that will lead to terrible things if a driver supports more views than samplers (and the state tracker set up all the views). (This will not make these stages magically work if a shader uses dx10-style texturing, they might still replace an actually used sview in that case.) Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
6723b61753
commit
44e87b7b7b
2 changed files with 9 additions and 7 deletions
|
|
@ -646,6 +646,7 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
|
|||
struct pipe_context *pipe = draw->pipe;
|
||||
const struct pipe_rasterizer_state *rast = draw->rasterizer;
|
||||
uint num_samplers;
|
||||
uint num_sampler_views;
|
||||
void *r;
|
||||
|
||||
assert(draw->rasterizer->line_smooth);
|
||||
|
|
@ -667,9 +668,9 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
|
|||
draw_aaline_prepare_outputs(draw, draw->pipeline.aaline);
|
||||
|
||||
/* how many samplers? */
|
||||
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
|
||||
num_samplers = MAX2(aaline->num_sampler_views, aaline->num_samplers);
|
||||
num_samplers = MAX2(num_samplers, aaline->fs->sampler_unit + 1);
|
||||
/* we'll use sampler/texture[aaline->sampler_unit] for the alpha texture */
|
||||
num_samplers = MAX2(aaline->num_samplers, aaline->fs->sampler_unit + 1);
|
||||
num_sampler_views = MAX2(num_samplers, aaline->num_sampler_views);
|
||||
|
||||
aaline->state.sampler[aaline->fs->sampler_unit] = aaline->sampler_cso;
|
||||
pipe_sampler_view_reference(&aaline->state.sampler_views[aaline->fs->sampler_unit],
|
||||
|
|
@ -681,7 +682,7 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header)
|
|||
num_samplers, aaline->state.sampler);
|
||||
|
||||
aaline->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||
num_samplers, aaline->state.sampler_views);
|
||||
num_sampler_views, aaline->state.sampler_views);
|
||||
|
||||
/* Disable triangle culling, stippling, unfilled mode etc. */
|
||||
r = draw_get_rasterizer_no_cull(draw, rast->scissor, rast->flatshade);
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
|
|||
struct pipe_context *pipe = pstip->pipe;
|
||||
struct draw_context *draw = stage->draw;
|
||||
uint num_samplers;
|
||||
uint num_sampler_views;
|
||||
|
||||
assert(stage->draw->rasterizer->poly_stipple_enable);
|
||||
|
||||
|
|
@ -490,8 +491,8 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
|
|||
|
||||
/* how many samplers? */
|
||||
/* we'll use sampler/texture[pstip->sampler_unit] for the stipple */
|
||||
num_samplers = MAX2(pstip->num_sampler_views, pstip->num_samplers);
|
||||
num_samplers = MAX2(num_samplers, pstip->fs->sampler_unit + 1);
|
||||
num_samplers = MAX2(pstip->num_samplers, pstip->fs->sampler_unit + 1);
|
||||
num_sampler_views = MAX2(pstip->num_sampler_views, num_samplers);
|
||||
|
||||
/* plug in our sampler, texture */
|
||||
pstip->state.samplers[pstip->fs->sampler_unit] = pstip->sampler_cso;
|
||||
|
|
@ -506,7 +507,7 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header)
|
|||
num_samplers, pstip->state.samplers);
|
||||
|
||||
pstip->driver_set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
|
||||
num_samplers, pstip->state.sampler_views);
|
||||
num_sampler_views, pstip->state.sampler_views);
|
||||
|
||||
draw->suspend_flushing = FALSE;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue