mesa/st: move st_vertex_program to gl_vertex_program in mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
This commit is contained in:
parent
5730772e36
commit
afce8654df
|
@ -706,6 +706,20 @@ struct gl_program
|
|||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* State/IR translators needs to store some extra vp info.
|
||||
*/
|
||||
struct gl_vertex_program
|
||||
{
|
||||
struct gl_program Base;
|
||||
|
||||
uint32_t vert_attrib_mask; /**< mask of sourced vertex attribs */
|
||||
ubyte num_inputs;
|
||||
|
||||
/** Maps VARYING_SLOT_x to slot */
|
||||
ubyte result_to_output[VARYING_SLOT_MAX];
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure that represents a reference to an atomic buffer from some
|
||||
* shader program.
|
||||
|
|
|
@ -41,7 +41,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
struct st_context;
|
||||
struct st_vertex_program;
|
||||
struct gl_vertex_program;
|
||||
struct st_common_variant;
|
||||
struct pipe_vertex_buffer;
|
||||
struct pipe_vertex_element;
|
||||
|
@ -66,7 +66,7 @@ void st_update_edgeflags(struct st_context *st, bool per_vertex_edgeflags);
|
|||
|
||||
void
|
||||
st_setup_arrays(struct st_context *st,
|
||||
const struct st_vertex_program *vp,
|
||||
const struct gl_vertex_program *vp,
|
||||
const struct st_common_variant *vp_variant,
|
||||
struct cso_velems_state *velements,
|
||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers,
|
||||
|
@ -74,7 +74,7 @@ st_setup_arrays(struct st_context *st,
|
|||
|
||||
void
|
||||
st_setup_current_user(struct st_context *st,
|
||||
const struct st_vertex_program *vp,
|
||||
const struct gl_vertex_program *vp,
|
||||
const struct st_common_variant *vp_variant,
|
||||
struct cso_velems_state *velements,
|
||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers);
|
||||
|
|
|
@ -180,7 +180,7 @@ setup_arrays(struct st_context *st,
|
|||
/* Only used by the select/feedback mode. */
|
||||
void
|
||||
st_setup_arrays(struct st_context *st,
|
||||
const struct st_vertex_program *vp,
|
||||
const struct gl_vertex_program *vp,
|
||||
const struct st_common_variant *vp_variant,
|
||||
struct cso_velems_state *velements,
|
||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers,
|
||||
|
@ -203,7 +203,7 @@ st_setup_arrays(struct st_context *st,
|
|||
*/
|
||||
template<util_popcnt POPCNT, st_update_flag UPDATE> void ALWAYS_INLINE
|
||||
st_setup_current(struct st_context *st,
|
||||
const struct st_vertex_program *vp,
|
||||
const struct gl_vertex_program *vp,
|
||||
const struct st_common_variant *vp_variant,
|
||||
struct cso_velems_state *velements,
|
||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
||||
|
@ -267,7 +267,7 @@ st_setup_current(struct st_context *st,
|
|||
/* Only used by the select/feedback mode. */
|
||||
void
|
||||
st_setup_current_user(struct st_context *st,
|
||||
const struct st_vertex_program *vp,
|
||||
const struct gl_vertex_program *vp,
|
||||
const struct st_common_variant *vp_variant,
|
||||
struct cso_velems_state *velements,
|
||||
struct pipe_vertex_buffer *vbuffer, unsigned *num_vbuffers)
|
||||
|
@ -303,7 +303,7 @@ st_update_array_templ(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 gl_vertex_program *vp = (struct gl_vertex_program *)st->vp;
|
||||
const struct st_common_variant *vp_variant = st->vp_variant;
|
||||
|
||||
struct pipe_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
|
||||
|
|
|
@ -87,7 +87,7 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
|
|||
const struct vertex_header *v)
|
||||
{
|
||||
const struct st_context *st = st_context(ctx);
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)st->vp;
|
||||
struct gl_vertex_program *stvp = (struct gl_vertex_program *)st->vp;
|
||||
GLfloat win[4];
|
||||
const GLfloat *color, *texcoord;
|
||||
ubyte slot;
|
||||
|
|
|
@ -61,7 +61,7 @@ st_new_program(struct gl_context *ctx, gl_shader_stage stage, GLuint id,
|
|||
|
||||
switch (stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
prog = (struct gl_program*)rzalloc(NULL, struct st_vertex_program);
|
||||
prog = (struct gl_program*)rzalloc(NULL, struct gl_vertex_program);
|
||||
break;
|
||||
default:
|
||||
prog = rzalloc(NULL, struct gl_program);
|
||||
|
|
|
@ -142,7 +142,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim)
|
|||
struct gl_context *ctx = rs->ctx;
|
||||
struct st_context *st = st_context(ctx);
|
||||
const GLfloat height = (GLfloat) ctx->DrawBuffer->Height;
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)st->vp;
|
||||
struct gl_vertex_program *stvp = (struct gl_vertex_program *)st->vp;
|
||||
const ubyte *outputMapping = stvp->result_to_output;
|
||||
const GLfloat *pos;
|
||||
GLuint i;
|
||||
|
|
|
@ -107,7 +107,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
|
|||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct draw_context *draw = st_get_draw_context(st);
|
||||
const struct st_vertex_program *vp;
|
||||
const struct gl_vertex_program *vp;
|
||||
struct st_common_variant *vp_variant;
|
||||
struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS];
|
||||
unsigned num_vbuffers = 0;
|
||||
|
@ -144,7 +144,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
|
|||
memcpy(&key, &st->vp_variant->key, sizeof(key));
|
||||
key.is_draw_shader = true;
|
||||
|
||||
vp = (struct st_vertex_program *)st->vp;
|
||||
vp = (struct gl_vertex_program *)st->vp;
|
||||
vp_variant = st_get_common_variant(st, st->vp, &key);
|
||||
|
||||
/*
|
||||
|
|
|
@ -424,7 +424,7 @@ st_translate_prog_to_nir(struct st_context *st, struct gl_program *prog,
|
|||
void
|
||||
st_prepare_vertex_program(struct gl_program *prog, uint8_t *out_attrib_to_index)
|
||||
{
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)prog;
|
||||
struct gl_vertex_program *stvp = (struct gl_vertex_program *)prog;
|
||||
uint8_t attrib_to_index[VERT_ATTRIB_MAX] = {0};
|
||||
|
||||
stvp->num_inputs = 0;
|
||||
|
@ -652,7 +652,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||
debug_printf("\n");
|
||||
}
|
||||
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)prog;
|
||||
struct gl_vertex_program *vp = (struct gl_vertex_program *)prog;
|
||||
|
||||
error = st_translate_program(st->ctx,
|
||||
PIPE_SHADER_VERTEX,
|
||||
|
@ -660,7 +660,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||
prog->glsl_to_tgsi,
|
||||
prog,
|
||||
/* inputs */
|
||||
stvp->num_inputs,
|
||||
vp->num_inputs,
|
||||
input_to_index,
|
||||
NULL, /* inputSlotToAttr */
|
||||
NULL, /* input semantic name */
|
||||
|
@ -668,7 +668,7 @@ st_translate_vertex_program(struct st_context *st,
|
|||
NULL, /* interp mode */
|
||||
/* outputs */
|
||||
num_outputs,
|
||||
stvp->result_to_output,
|
||||
vp->result_to_output,
|
||||
output_semantic_name,
|
||||
output_semantic_index);
|
||||
|
||||
|
@ -976,10 +976,10 @@ st_get_common_variant(struct st_context *st,
|
|||
v->base.st = key->st;
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)prog;
|
||||
struct gl_vertex_program *vp = (struct gl_vertex_program *)prog;
|
||||
|
||||
v->vert_attrib_mask =
|
||||
stvp->vert_attrib_mask |
|
||||
vp->vert_attrib_mask |
|
||||
(key->passthrough_edgeflags ? VERT_BIT_EDGEFLAG : 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -247,17 +247,6 @@ struct st_common_variant
|
|||
GLbitfield vert_attrib_mask;
|
||||
};
|
||||
|
||||
struct st_vertex_program
|
||||
{
|
||||
struct gl_program Base;
|
||||
|
||||
uint32_t vert_attrib_mask; /**< mask of sourced vertex attribs */
|
||||
ubyte num_inputs;
|
||||
|
||||
/** Maps VARYING_SLOT_x to slot */
|
||||
ubyte result_to_output[VARYING_SLOT_MAX];
|
||||
};
|
||||
|
||||
static inline struct st_common_variant *
|
||||
st_common_variant(struct st_variant *v)
|
||||
{
|
||||
|
|
|
@ -94,12 +94,12 @@ st_serialise_ir_program(struct gl_context *ctx, struct gl_program *prog,
|
|||
blob_init(&blob);
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)prog;
|
||||
struct gl_vertex_program *vp = (struct gl_vertex_program *)prog;
|
||||
|
||||
blob_write_uint32(&blob, stvp->num_inputs);
|
||||
blob_write_uint32(&blob, stvp->vert_attrib_mask);
|
||||
blob_write_bytes(&blob, stvp->result_to_output,
|
||||
sizeof(stvp->result_to_output));
|
||||
blob_write_uint32(&blob, vp->num_inputs);
|
||||
blob_write_uint32(&blob, vp->vert_attrib_mask);
|
||||
blob_write_bytes(&blob, vp->result_to_output,
|
||||
sizeof(vp->result_to_output));
|
||||
}
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX ||
|
||||
|
@ -189,11 +189,11 @@ st_deserialise_ir_program(struct gl_context *ctx,
|
|||
st_release_variants(st, prog);
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX) {
|
||||
struct st_vertex_program *stvp = (struct st_vertex_program *)prog;
|
||||
stvp->num_inputs = blob_read_uint32(&blob_reader);
|
||||
stvp->vert_attrib_mask = blob_read_uint32(&blob_reader);
|
||||
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->result_to_output,
|
||||
sizeof(stvp->result_to_output));
|
||||
struct gl_vertex_program *vp = (struct gl_vertex_program *)prog;
|
||||
vp->num_inputs = blob_read_uint32(&blob_reader);
|
||||
vp->vert_attrib_mask = blob_read_uint32(&blob_reader);
|
||||
blob_copy_bytes(&blob_reader, (uint8_t *) vp->result_to_output,
|
||||
sizeof(vp->result_to_output));
|
||||
}
|
||||
|
||||
if (prog->info.stage == MESA_SHADER_VERTEX ||
|
||||
|
|
Loading…
Reference in New Issue