mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
draw: fix PIPE_MAX_SAMPLER/PIPE_MAX_SHADER_SAMPLER_VIEWS issues
pstipple/aaline stages used PIPE_MAX_SAMPLER instead of PIPE_MAX_SHADER_SAMPLER_VIEWS when dealing with sampler views. Now these stages can't actually handle sampler_unit != texture_unit anyway (they cannot work with d3d10 shaders at all due to using tex not sample opcodes as "mixed mode" shaders are impossible) but this leads to crashes if a driver just installs these stages and then more than PIPE_MAX_SAMPLER views are set even if the stages aren't even used. Reviewed-by: Zack Rusin <zackr@vmware.com>
This commit is contained in:
parent
f37edb5e20
commit
431e60625b
2 changed files with 6 additions and 6 deletions
|
|
@ -107,7 +107,7 @@ struct aaline_stage
|
|||
struct aaline_fragment_shader *fs;
|
||||
struct {
|
||||
void *sampler[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_view *sampler_views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||
} state;
|
||||
|
||||
/*
|
||||
|
|
@ -763,7 +763,7 @@ aaline_destroy(struct draw_stage *stage)
|
|||
struct pipe_context *pipe = stage->draw->pipe;
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
|
||||
}
|
||||
|
||||
|
|
@ -937,7 +937,7 @@ aaline_set_sampler_views(struct pipe_context *pipe,
|
|||
for (i = 0; i < num; i++) {
|
||||
pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]);
|
||||
}
|
||||
for ( ; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
for ( ; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL);
|
||||
}
|
||||
aaline->num_sampler_views = num;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ struct pstip_stage
|
|||
struct pstip_fragment_shader *fs;
|
||||
struct {
|
||||
void *samplers[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_view *sampler_views[PIPE_MAX_SHADER_SAMPLER_VIEWS];
|
||||
const struct pipe_poly_stipple *stipple;
|
||||
} state;
|
||||
|
||||
|
|
@ -592,7 +592,7 @@ pstip_destroy(struct draw_stage *stage)
|
|||
struct pstip_stage *pstip = pstip_stage(stage);
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
for (i = 0; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
|
||||
}
|
||||
|
||||
|
|
@ -731,7 +731,7 @@ pstip_set_sampler_views(struct pipe_context *pipe,
|
|||
for (i = 0; i < num; i++) {
|
||||
pipe_sampler_view_reference(&pstip->state.sampler_views[i], views[i]);
|
||||
}
|
||||
for (; i < PIPE_MAX_SAMPLERS; i++) {
|
||||
for (; i < PIPE_MAX_SHADER_SAMPLER_VIEWS; i++) {
|
||||
pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue