st/mesa: replace st_context::state::constants with a mask
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6946>
This commit is contained in:
parent
96fc1ab647
commit
f94c190581
|
@ -185,14 +185,11 @@ st_upload_constants(struct st_context *st, struct gl_program *prog)
|
|||
}
|
||||
}
|
||||
|
||||
st->state.constants[shader_type].ptr = params->ParameterValues;
|
||||
st->state.constants[shader_type].size = paramBytes;
|
||||
}
|
||||
else if (st->state.constants[shader_type].ptr) {
|
||||
st->state.constbuf0_enabled_shader_mask |= 1 << shader_type;
|
||||
} else if (st->state.constbuf0_enabled_shader_mask & (1 << shader_type)) {
|
||||
/* Unbind. */
|
||||
st->state.constants[shader_type].ptr = NULL;
|
||||
st->state.constants[shader_type].size = 0;
|
||||
cso_set_constant_buffer(st->cso_context, shader_type, 0, NULL);
|
||||
st->state.constbuf0_enabled_shader_mask &= ~(1 << shader_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,10 +202,7 @@ struct st_context
|
|||
struct pipe_sampler_view *frag_sampler_views[PIPE_MAX_SAMPLERS];
|
||||
GLuint num_sampler_views[PIPE_SHADER_TYPES];
|
||||
struct pipe_clip_state clip;
|
||||
struct {
|
||||
void *ptr;
|
||||
unsigned size;
|
||||
} constants[PIPE_SHADER_TYPES];
|
||||
unsigned constbuf0_enabled_shader_mask;
|
||||
unsigned fb_width;
|
||||
unsigned fb_height;
|
||||
unsigned fb_num_samples;
|
||||
|
|
|
@ -237,8 +237,8 @@ st_feedback_draw_vbo(struct gl_context *ctx,
|
|||
_mesa_load_state_parameters(st->ctx, params);
|
||||
|
||||
draw_set_mapped_constant_buffer(draw, PIPE_SHADER_VERTEX, 0,
|
||||
st->state.constants[PIPE_SHADER_VERTEX].ptr,
|
||||
st->state.constants[PIPE_SHADER_VERTEX].size);
|
||||
params->ParameterValues,
|
||||
params->NumParameterValues * 4);
|
||||
|
||||
/* set uniform buffers */
|
||||
const struct gl_program *prog = &vp->Base.Base;
|
||||
|
|
Loading…
Reference in New Issue