vrend: make shader interpinfo a fixed size array

Use a bitfield to declare vrend_interp_info and make it a fixed size array.

One one hand this avoids all the hassles with allocating and freeing memory,
and it will make it possible to shrink the size of the data that is passed
from the sinfo to the shader key.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
macos/master
Gert Wollny 4 years ago
parent c35df49c42
commit 4663b0b108
  1. 1
      src/vrend_renderer.c
  2. 18
      src/vrend_shader.c
  3. 10
      src/vrend_shader.h

@ -1139,7 +1139,6 @@ static void vrend_destroy_shader_selector(struct vrend_shader_selector *sel)
free(sel->sinfo.so_names[i]);
free(sel->tmp_buf);
free(sel->sinfo.so_names);
free(sel->sinfo.interpinfo);
free(sel->sinfo.sampler_arrays);
free(sel->sinfo.image_arrays);
free(sel->tokens);

@ -6775,26 +6775,12 @@ static boolean fill_fragment_interpolants(const struct dump_ctx *ctx, struct vre
static boolean fill_interpolants(const struct dump_ctx *ctx, struct vrend_shader_info *sinfo)
{
boolean ret;
if (!ctx->num_interps)
return true;
if (ctx->prog_type == TGSI_PROCESSOR_VERTEX || ctx->prog_type == TGSI_PROCESSOR_GEOMETRY)
return true;
free(sinfo->interpinfo);
sinfo->interpinfo = calloc(ctx->num_interps, sizeof(struct vrend_interp_info));
if (!sinfo->interpinfo)
return false;
ret = fill_fragment_interpolants(ctx, sinfo);
if (ret == false)
goto out_fail;
return true;
out_fail:
free(sinfo->interpinfo);
return false;
return fill_fragment_interpolants(ctx, sinfo);
}
static boolean analyze_instruction(struct tgsi_iterate_context *iter,
@ -7128,7 +7114,7 @@ static bool vrend_patch_vertex_shader_interpolants(MAYBE_UNUSED const struct vre
if (!vs_info || !fs_info)
return true;
if (!fs_info->interpinfo)
if (!fs_info->num_interps)
return true;
if (fs_info->has_sample_input) {

@ -54,10 +54,10 @@ enum gl_advanced_blend_mode
/* need to store patching info for interpolation */
struct vrend_interp_info {
int semantic_name;
int semantic_index;
int interpolate;
unsigned location;
unsigned semantic_name : 6;
unsigned semantic_index : 16;
unsigned interpolate : 3;
unsigned location : 3;
};
struct vrend_array {
@ -112,7 +112,7 @@ struct vrend_shader_info {
struct pipe_stream_output_info so_info;
struct vrend_interp_info *interpinfo;
struct vrend_interp_info interpinfo[PIPE_MAX_SHADER_INPUTS];
char **so_names;
uint64_t invariant_outputs;
};

Loading…
Cancel
Save