From d947e3e2c8c23dd9622c6af20d2fb887a43475f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 30 Apr 2017 14:33:03 +0200 Subject: [PATCH] st/mesa: decrease the size of st_vertex_program Tested-by: Edmondo Tommasina Reviewed-by: Brian Paul --- src/mesa/state_tracker/st_atifs_to_tgsi.c | 8 ++++---- src/mesa/state_tracker/st_atifs_to_tgsi.h | 4 ++-- src/mesa/state_tracker/st_cb_rasterpos.c | 4 ++-- src/mesa/state_tracker/st_context.h | 2 +- src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 16 ++++++++-------- src/mesa/state_tracker/st_glsl_to_tgsi.h | 8 ++++---- src/mesa/state_tracker/st_mesa_to_tgsi.c | 8 ++++---- src/mesa/state_tracker/st_mesa_to_tgsi.h | 4 ++-- src/mesa/state_tracker/st_program.c | 10 +++++----- src/mesa/state_tracker/st_program.h | 8 ++++---- 10 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.c b/src/mesa/state_tracker/st_atifs_to_tgsi.c index 90286a11153..0cba1691947 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.c +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.c @@ -45,8 +45,8 @@ struct st_translate { struct ureg_src inputs[PIPE_MAX_SHADER_INPUTS]; struct ureg_src samplers[PIPE_MAX_SAMPLERS]; - const GLuint *inputMapping; - const GLuint *outputMapping; + const ubyte *inputMapping; + const ubyte *outputMapping; unsigned current_pass; @@ -425,12 +425,12 @@ st_translate_atifs_program( struct ati_fragment_shader *atifs, struct gl_program *program, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]) { diff --git a/src/mesa/state_tracker/st_atifs_to_tgsi.h b/src/mesa/state_tracker/st_atifs_to_tgsi.h index 14227023ba0..980555c778f 100644 --- a/src/mesa/state_tracker/st_atifs_to_tgsi.h +++ b/src/mesa/state_tracker/st_atifs_to_tgsi.h @@ -43,12 +43,12 @@ st_translate_atifs_program( struct ati_fragment_shader *atifs, struct gl_program *program, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]); diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 85184540553..c55b62437a3 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -109,7 +109,7 @@ rastpos_destroy(struct draw_stage *stage) * else copy the current attrib. */ static void -update_attrib(struct gl_context *ctx, const GLuint *outputMapping, +update_attrib(struct gl_context *ctx, const ubyte *outputMapping, const struct vertex_header *vert, GLfloat *dest, GLuint result, GLuint defaultAttrib) @@ -134,7 +134,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; - const GLuint *outputMapping = st->vertex_result_to_slot; + const ubyte *outputMapping = st->vertex_result_to_slot; const GLfloat *pos; GLuint i; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 74ab43cfe9c..d02c6f805fc 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -171,7 +171,7 @@ struct st_context GLboolean edgeflag_culls_prims; /** Mapping from VARYING_SLOT_x to post-transformed vertex slot */ - const GLuint *vertex_result_to_slot; + const ubyte *vertex_result_to_slot; struct st_vertex_program *vp; /**< Currently bound vertex program */ struct st_fragment_program *fp; /**< Currently bound fragment program */ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 175ae08aee1..970e7e0f64f 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5436,8 +5436,8 @@ struct st_translate { struct inout_decl *output_decls; unsigned num_output_decls; - const GLuint *inputMapping; - const GLuint *outputMapping; + const ubyte *inputMapping; + const ubyte *outputMapping; unsigned procType; /**< PIPE_SHADER_VERTEX/FRAGMENT */ }; @@ -6172,7 +6172,7 @@ struct sort_inout_decls { return mapping[a.mesa_index] < mapping[b.mesa_index]; } - const GLuint *mapping; + const ubyte *mapping; }; /* Sort the given array of decls by the corresponding slot (TGSI file index). @@ -6183,7 +6183,7 @@ struct sort_inout_decls { static void sort_inout_decls_by_slot(struct inout_decl *decls, unsigned count, - const GLuint mapping[]) + const ubyte mapping[]) { sort_inout_decls sorter; sorter.mapping = mapping; @@ -6237,13 +6237,13 @@ st_translate_program( glsl_to_tgsi_visitor *program, const struct gl_program *proginfo, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const GLuint inputSlotToAttr[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const GLuint outputSlotToAttr[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]) @@ -7100,7 +7100,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) void st_translate_stream_output_info(glsl_to_tgsi_visitor *glsl_to_tgsi, - const GLuint outputMapping[], + const ubyte outputMapping[], struct pipe_stream_output_info *so) { if (!glsl_to_tgsi->shader_program->last_vert_prog) @@ -7113,7 +7113,7 @@ st_translate_stream_output_info(glsl_to_tgsi_visitor *glsl_to_tgsi, void st_translate_stream_output_info2(struct gl_transform_feedback_info *info, - const GLuint outputMapping[], + const ubyte outputMapping[], struct pipe_stream_output_info *so) { unsigned i; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.h b/src/mesa/state_tracker/st_glsl_to_tgsi.h index add534ce997..6e24a958d9e 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.h +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.h @@ -42,13 +42,13 @@ enum pipe_error st_translate_program( struct glsl_to_tgsi_visitor *program, const struct gl_program *proginfo, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const GLuint inputSlotToAttr[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const GLuint outputSlotToAttr[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]); @@ -59,12 +59,12 @@ GLboolean st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) void st_translate_stream_output_info(struct glsl_to_tgsi_visitor *glsl_to_tgsi, - const GLuint outputMapping[], + const ubyte outputMapping[], struct pipe_stream_output_info *so); void st_translate_stream_output_info2(struct gl_transform_feedback_info *info, - const GLuint outputMapping[], + const ubyte outputMapping[], struct pipe_stream_output_info *so); unsigned diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index f906fedae18..d7609621481 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -65,8 +65,8 @@ struct st_translate { struct ureg_src samplers[PIPE_MAX_SAMPLERS]; struct ureg_src systemValues[SYSTEM_VALUE_MAX]; - const GLuint *inputMapping; - const GLuint *outputMapping; + const ubyte *inputMapping; + const ubyte *outputMapping; unsigned procType; /**< PIPE_SHADER_VERTEX/FRAGMENT */ }; @@ -799,12 +799,12 @@ st_translate_mesa_program( struct ureg_program *ureg, const struct gl_program *program, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]) { diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 3df54ce5b87..42015fc48ae 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -51,12 +51,12 @@ st_translate_mesa_program( struct ureg_program *ureg, const struct gl_program *program, GLuint numInputs, - const GLuint inputMapping[], + const ubyte inputMapping[], const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], GLuint numOutputs, - const GLuint outputMapping[], + const ubyte outputMapping[], const ubyte outputSemanticName[], const ubyte outputSemanticIndex[]); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 09e0d86601f..f34adcd8b9e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -376,7 +376,7 @@ st_translate_vertex_program(struct st_context *st, enum pipe_error error; unsigned num_outputs = 0; unsigned attr; - unsigned input_to_index[VERT_ATTRIB_MAX] = {0}; + ubyte input_to_index[VERT_ATTRIB_MAX] = {0}; unsigned output_slot_to_attr[VARYING_SLOT_MAX] = {0}; ubyte output_semantic_name[VARYING_SLOT_MAX] = {0}; ubyte output_semantic_index[VARYING_SLOT_MAX] = {0}; @@ -716,8 +716,8 @@ bool st_translate_fragment_program(struct st_context *st, struct st_fragment_program *stfp) { - GLuint outputMapping[2 * FRAG_RESULT_MAX]; - GLuint inputMapping[VARYING_SLOT_MAX]; + ubyte outputMapping[2 * FRAG_RESULT_MAX]; + ubyte inputMapping[VARYING_SLOT_MAX]; GLuint inputSlotToAttr[VARYING_SLOT_MAX]; GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ GLuint attr; @@ -1349,9 +1349,9 @@ st_translate_program_common(struct st_context *st, struct pipe_shader_state *out_state) { GLuint inputSlotToAttr[VARYING_SLOT_TESS_MAX]; - GLuint inputMapping[VARYING_SLOT_TESS_MAX]; + ubyte inputMapping[VARYING_SLOT_TESS_MAX]; GLuint outputSlotToAttr[VARYING_SLOT_TESS_MAX]; - GLuint outputMapping[VARYING_SLOT_TESS_MAX]; + ubyte outputMapping[VARYING_SLOT_TESS_MAX]; GLuint attr; ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index 92dfe2545f0..e2607a870bc 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -47,7 +47,7 @@ extern "C" { #endif -#define ST_DOUBLE_ATTRIB_PLACEHOLDER 0xffffffff +#define ST_DOUBLE_ATTRIB_PLACEHOLDER 0xff struct st_external_sampler_key { @@ -214,11 +214,11 @@ struct st_vertex_program /** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */ /** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */ - GLuint index_to_input[PIPE_MAX_SHADER_INPUTS]; - GLuint num_inputs; + ubyte index_to_input[PIPE_MAX_ATTRIBS]; + ubyte num_inputs; /** Maps VARYING_SLOT_x to slot */ - GLuint result_to_output[VARYING_SLOT_MAX]; + ubyte result_to_output[VARYING_SLOT_MAX]; /** List of translated variants of this vertex program. */ -- 2.30.2