From: Marek Olšák Date: Thu, 28 Nov 2019 03:37:35 +0000 (-0500) Subject: st/mesa: remove struct st_vp_variant in favor of st_common_variant X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a90f4453fedc414e7f31003b131abc90196effaa;p=mesa.git st/mesa: remove struct st_vp_variant in favor of st_common_variant Reviewed-by: Dave Airlie --- diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index ffc64bd83f1..0208fec4e54 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -38,7 +38,7 @@ struct st_context; struct st_vertex_program; -struct st_vp_variant; +struct st_common_variant; struct pipe_vertex_buffer; struct pipe_vertex_element; @@ -61,21 +61,21 @@ GLuint st_compare_func_to_pipe(GLenum func); void st_setup_arrays(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers); void st_setup_current(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers); void st_setup_current_user(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers); diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index 96b9bd33291..59023d80e3c 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -386,7 +386,7 @@ set_vertex_attribs(struct st_context *st, void st_setup_arrays(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers) { @@ -456,7 +456,7 @@ st_setup_arrays(struct st_context *st, void st_setup_current(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers) { @@ -516,7 +516,7 @@ st_setup_current(struct st_context *st, void st_setup_current_user(struct st_context *st, const struct st_vertex_program *vp, - const struct st_vp_variant *vp_variant, + const struct st_common_variant *vp_variant, struct pipe_vertex_element *velements, struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers) { @@ -549,7 +549,7 @@ st_update_array(struct st_context *st) /* vertex program validation must be done before this */ /* _NEW_PROGRAM, ST_NEW_VS_STATE */ const struct st_vertex_program *vp = (struct st_vertex_program *)st->vp; - const struct st_vp_variant *vp_variant = st->vp_variant; + const struct st_common_variant *vp_variant = st->vp_variant; struct pipe_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS]; unsigned num_vbuffers = 0, first_upload_vbuffer; diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 10d21905780..e47124b122f 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -187,8 +187,8 @@ st_update_vp( struct st_context *st ) if (st->shader_has_one_variant[MESA_SHADER_VERTEX] && stvp->variants && - st_vp_variant(stvp->variants)->key.passthrough_edgeflags == st->vertdata_edgeflags) { - st->vp_variant = st_vp_variant(stvp->variants); + st_common_variant(stvp->variants)->key.passthrough_edgeflags == st->vertdata_edgeflags) { + st->vp_variant = st_common_variant(stvp->variants); } else { struct st_common_variant_key key; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index bf77f3e7757..054a9e9317e 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -259,7 +259,7 @@ struct st_context struct gl_program *current_program[MESA_SHADER_STAGES]; }; - struct st_vp_variant *vp_variant; + struct st_common_variant *vp_variant; struct { struct pipe_resource *pixelmap_texture; diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index f03063dc7c8..aa8450a71a6 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -108,7 +108,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, struct pipe_context *pipe = st->pipe; struct draw_context *draw = st_get_draw_context(st); const struct st_vertex_program *vp; - struct st_vp_variant *vp_variant; + struct st_common_variant *vp_variant; struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS]; unsigned num_vbuffers = 0; struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS]; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 28ee36efeef..81d6e16fefa 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -568,12 +568,12 @@ st_translate_vertex_program(struct st_context *st, static const gl_state_index16 depth_range_state[STATE_LENGTH] = { STATE_DEPTH_RANGE }; -static struct st_vp_variant * +static struct st_common_variant * st_create_vp_variant(struct st_context *st, struct st_program *stvp, const struct st_common_variant_key *key) { - struct st_vp_variant *vpv = CALLOC_STRUCT(st_vp_variant); + struct st_common_variant *vpv = CALLOC_STRUCT(st_common_variant); struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct pipe_shader_state state = {0}; @@ -700,17 +700,17 @@ st_create_vp_variant(struct st_context *st, /** * Find/create a vertex program variant. */ -struct st_vp_variant * +struct st_common_variant * st_get_vp_variant(struct st_context *st, struct st_program *stp, const struct st_common_variant_key *key) { struct st_vertex_program *stvp = (struct st_vertex_program *)stp; - struct st_vp_variant *vpv; + struct st_common_variant *vpv; /* Search for existing variant */ - for (vpv = st_vp_variant(stp->variants); vpv; - vpv = st_vp_variant(vpv->base.next)) { + for (vpv = st_common_variant(stp->variants); vpv; + vpv = st_common_variant(vpv->base.next)) { if (memcmp(&vpv->key, key, sizeof(*key)) == 0) { break; } diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index d4d37b1ebab..e5c6ac0a96a 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -198,24 +198,6 @@ struct st_common_variant_key }; -/** - * This represents a vertex program, especially translated to match - * the inputs of a particular fragment shader. - */ -struct st_vp_variant -{ - struct st_variant base; - - /* Parameters which generated this translated version of a vertex - * shader: - */ - struct st_common_variant_key key; - - /** Bitfield of VERT_BIT_* bits of mesa vertex processing inputs */ - GLbitfield vert_attrib_mask; -}; - - /** * Common shader variant. */ @@ -225,6 +207,11 @@ struct st_common_variant /* Parameters which generated this variant. */ struct st_common_variant_key key; + + /* Bitfield of VERT_BIT_* bits matching vertex shader inputs, + * but not include the high part of doubles. + */ + GLbitfield vert_attrib_mask; }; @@ -283,12 +270,6 @@ st_common_variant(struct st_variant *v) return (struct st_common_variant*)v; } -static inline struct st_vp_variant * -st_vp_variant(struct st_variant *v) -{ - return (struct st_vp_variant*)v; -} - static inline struct st_fp_variant * st_fp_variant(struct st_variant *v) { @@ -308,7 +289,7 @@ st_get_generic_varying_index(struct st_context *st, GLuint attr) extern void st_set_prog_affected_state_flags(struct gl_program *prog); -extern struct st_vp_variant * +extern struct st_common_variant * st_get_vp_variant(struct st_context *st, struct st_program *stvp, const struct st_common_variant_key *key);