st/mesa: remove struct st_vp_variant in favor of st_common_variant
Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
struct st_context;
|
struct st_context;
|
||||||
struct st_vertex_program;
|
struct st_vertex_program;
|
||||||
struct st_vp_variant;
|
struct st_common_variant;
|
||||||
struct pipe_vertex_buffer;
|
struct pipe_vertex_buffer;
|
||||||
struct pipe_vertex_element;
|
struct pipe_vertex_element;
|
||||||
|
|
||||||
@@ -61,21 +61,21 @@ GLuint st_compare_func_to_pipe(GLenum func);
|
|||||||
void
|
void
|
||||||
st_setup_arrays(struct st_context *st,
|
st_setup_arrays(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
||||||
|
|
||||||
void
|
void
|
||||||
st_setup_current(struct st_context *st,
|
st_setup_current(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
||||||
|
|
||||||
void
|
void
|
||||||
st_setup_current_user(struct st_context *st,
|
st_setup_current_user(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
||||||
|
|
||||||
|
@@ -386,7 +386,7 @@ set_vertex_attribs(struct st_context *st,
|
|||||||
void
|
void
|
||||||
st_setup_arrays(struct st_context *st,
|
st_setup_arrays(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
||||||
{
|
{
|
||||||
@@ -456,7 +456,7 @@ st_setup_arrays(struct st_context *st,
|
|||||||
void
|
void
|
||||||
st_setup_current(struct st_context *st,
|
st_setup_current(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
||||||
{
|
{
|
||||||
@@ -516,7 +516,7 @@ st_setup_current(struct st_context *st,
|
|||||||
void
|
void
|
||||||
st_setup_current_user(struct st_context *st,
|
st_setup_current_user(struct st_context *st,
|
||||||
const struct st_vertex_program *vp,
|
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_element *velements,
|
||||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
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 */
|
/* vertex program validation must be done before this */
|
||||||
/* _NEW_PROGRAM, ST_NEW_VS_STATE */
|
/* _NEW_PROGRAM, ST_NEW_VS_STATE */
|
||||||
const struct st_vertex_program *vp = (struct st_vertex_program *)st->vp;
|
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];
|
struct pipe_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
|
||||||
unsigned num_vbuffers = 0, first_upload_vbuffer;
|
unsigned num_vbuffers = 0, first_upload_vbuffer;
|
||||||
|
@@ -187,8 +187,8 @@ st_update_vp( struct st_context *st )
|
|||||||
|
|
||||||
if (st->shader_has_one_variant[MESA_SHADER_VERTEX] &&
|
if (st->shader_has_one_variant[MESA_SHADER_VERTEX] &&
|
||||||
stvp->variants &&
|
stvp->variants &&
|
||||||
st_vp_variant(stvp->variants)->key.passthrough_edgeflags == st->vertdata_edgeflags) {
|
st_common_variant(stvp->variants)->key.passthrough_edgeflags == st->vertdata_edgeflags) {
|
||||||
st->vp_variant = st_vp_variant(stvp->variants);
|
st->vp_variant = st_common_variant(stvp->variants);
|
||||||
} else {
|
} else {
|
||||||
struct st_common_variant_key key;
|
struct st_common_variant_key key;
|
||||||
|
|
||||||
|
@@ -259,7 +259,7 @@ struct st_context
|
|||||||
struct gl_program *current_program[MESA_SHADER_STAGES];
|
struct gl_program *current_program[MESA_SHADER_STAGES];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct st_vp_variant *vp_variant;
|
struct st_common_variant *vp_variant;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct pipe_resource *pixelmap_texture;
|
struct pipe_resource *pixelmap_texture;
|
||||||
|
@@ -108,7 +108,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
|
|||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
struct draw_context *draw = st_get_draw_context(st);
|
struct draw_context *draw = st_get_draw_context(st);
|
||||||
const struct st_vertex_program *vp;
|
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];
|
struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS];
|
||||||
unsigned num_vbuffers = 0;
|
unsigned num_vbuffers = 0;
|
||||||
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
|
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
|
||||||
|
@@ -568,12 +568,12 @@ st_translate_vertex_program(struct st_context *st,
|
|||||||
static const gl_state_index16 depth_range_state[STATE_LENGTH] =
|
static const gl_state_index16 depth_range_state[STATE_LENGTH] =
|
||||||
{ STATE_DEPTH_RANGE };
|
{ STATE_DEPTH_RANGE };
|
||||||
|
|
||||||
static struct st_vp_variant *
|
static struct st_common_variant *
|
||||||
st_create_vp_variant(struct st_context *st,
|
st_create_vp_variant(struct st_context *st,
|
||||||
struct st_program *stvp,
|
struct st_program *stvp,
|
||||||
const struct st_common_variant_key *key)
|
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_context *pipe = st->pipe;
|
||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
struct pipe_shader_state state = {0};
|
struct pipe_shader_state state = {0};
|
||||||
@@ -700,17 +700,17 @@ st_create_vp_variant(struct st_context *st,
|
|||||||
/**
|
/**
|
||||||
* Find/create a vertex program variant.
|
* Find/create a vertex program variant.
|
||||||
*/
|
*/
|
||||||
struct st_vp_variant *
|
struct st_common_variant *
|
||||||
st_get_vp_variant(struct st_context *st,
|
st_get_vp_variant(struct st_context *st,
|
||||||
struct st_program *stp,
|
struct st_program *stp,
|
||||||
const struct st_common_variant_key *key)
|
const struct st_common_variant_key *key)
|
||||||
{
|
{
|
||||||
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
struct st_vertex_program *stvp = (struct st_vertex_program *)stp;
|
||||||
struct st_vp_variant *vpv;
|
struct st_common_variant *vpv;
|
||||||
|
|
||||||
/* Search for existing variant */
|
/* Search for existing variant */
|
||||||
for (vpv = st_vp_variant(stp->variants); vpv;
|
for (vpv = st_common_variant(stp->variants); vpv;
|
||||||
vpv = st_vp_variant(vpv->base.next)) {
|
vpv = st_common_variant(vpv->base.next)) {
|
||||||
if (memcmp(&vpv->key, key, sizeof(*key)) == 0) {
|
if (memcmp(&vpv->key, key, sizeof(*key)) == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -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.
|
* Common shader variant.
|
||||||
*/
|
*/
|
||||||
@@ -225,6 +207,11 @@ struct st_common_variant
|
|||||||
|
|
||||||
/* Parameters which generated this variant. */
|
/* Parameters which generated this variant. */
|
||||||
struct st_common_variant_key key;
|
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;
|
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 *
|
static inline struct st_fp_variant *
|
||||||
st_fp_variant(struct st_variant *v)
|
st_fp_variant(struct st_variant *v)
|
||||||
{
|
{
|
||||||
@@ -308,7 +289,7 @@ st_get_generic_varying_index(struct st_context *st, GLuint attr)
|
|||||||
extern void
|
extern void
|
||||||
st_set_prog_affected_state_flags(struct gl_program *prog);
|
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,
|
st_get_vp_variant(struct st_context *st,
|
||||||
struct st_program *stvp,
|
struct st_program *stvp,
|
||||||
const struct st_common_variant_key *key);
|
const struct st_common_variant_key *key);
|
||||||
|
Reference in New Issue
Block a user