shader: merge array types

This just merges the sampler and image array types.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Dave Airlie 6 years ago
parent 64d0f1230d
commit 33f0170b03
  1. 2
      src/vrend_renderer.c
  2. 12
      src/vrend_shader.c
  3. 11
      src/vrend_shader.h

@ -1150,7 +1150,7 @@ static void bind_image_locs(struct vrend_linked_shader_program *sprog,
if (sprog->ss[id]->sel->sinfo.num_image_arrays) { if (sprog->ss[id]->sel->sinfo.num_image_arrays) {
int idx; int idx;
for (i = 0; i < sprog->ss[id]->sel->sinfo.num_image_arrays; i++) { for (i = 0; i < sprog->ss[id]->sel->sinfo.num_image_arrays; i++) {
struct vrend_image_array *img_array = &sprog->ss[id]->sel->sinfo.image_arrays[i]; struct vrend_array *img_array = &sprog->ss[id]->sel->sinfo.image_arrays[i];
for (int j = 0; j < img_array->array_size; j++) { for (int j = 0; j < img_array->array_size; j++) {
snprintf(name, 32, "%simg%d[%d]", prefix, img_array->first, j); snprintf(name, 32, "%simg%d[%d]", prefix, img_array->first, j);
sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name); sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name);

@ -156,10 +156,10 @@ struct dump_ctx {
struct vrend_shader_image images[32]; struct vrend_shader_image images[32];
uint32_t images_used_mask; uint32_t images_used_mask;
struct vrend_image_array *image_arrays; struct vrend_array *image_arrays;
uint32_t num_image_arrays; uint32_t num_image_arrays;
struct vrend_sampler_array *sampler_arrays; struct vrend_array *sampler_arrays;
uint32_t num_sampler_arrays; uint32_t num_sampler_arrays;
int num_consts; int num_consts;
@ -533,7 +533,7 @@ static int add_images(struct dump_ctx *ctx, int first, int last,
if (ctx->info.indirect_files & (1 << TGSI_FILE_IMAGE)) { if (ctx->info.indirect_files & (1 << TGSI_FILE_IMAGE)) {
if (ctx->num_image_arrays) { if (ctx->num_image_arrays) {
struct vrend_image_array *last_array = &ctx->image_arrays[ctx->num_image_arrays - 1]; struct vrend_array *last_array = &ctx->image_arrays[ctx->num_image_arrays - 1];
/* /*
* If this set of images is consecutive to the last array, * If this set of images is consecutive to the last array,
* and has compatible return and decls, then increase the array size. * and has compatible return and decls, then increase the array size.
@ -548,7 +548,7 @@ static int add_images(struct dump_ctx *ctx, int first, int last,
/* allocate a new image array for this range of images */ /* allocate a new image array for this range of images */
ctx->num_image_arrays++; ctx->num_image_arrays++;
ctx->image_arrays = realloc(ctx->image_arrays, sizeof(struct vrend_image_array) * ctx->num_image_arrays); ctx->image_arrays = realloc(ctx->image_arrays, sizeof(struct vrend_array) * ctx->num_image_arrays);
if (!ctx->image_arrays) if (!ctx->image_arrays)
return -1; return -1;
ctx->image_arrays[ctx->num_image_arrays - 1].first = first; ctx->image_arrays[ctx->num_image_arrays - 1].first = first;
@ -561,7 +561,7 @@ static int add_sampler_array(struct dump_ctx *ctx, int first, int last)
{ {
int idx = ctx->num_sampler_arrays; int idx = ctx->num_sampler_arrays;
ctx->num_sampler_arrays++; ctx->num_sampler_arrays++;
ctx->sampler_arrays = realloc(ctx->sampler_arrays, sizeof(struct vrend_sampler_array) * ctx->num_sampler_arrays); ctx->sampler_arrays = realloc(ctx->sampler_arrays, sizeof(struct vrend_array) * ctx->num_sampler_arrays);
if (!ctx->sampler_arrays) if (!ctx->sampler_arrays)
return -1; return -1;
@ -609,7 +609,7 @@ static int add_samplers(struct dump_ctx *ctx, int first, int last, int sview_typ
if (ctx->info.indirect_files & (1 << TGSI_FILE_SAMPLER)) { if (ctx->info.indirect_files & (1 << TGSI_FILE_SAMPLER)) {
if (ctx->num_sampler_arrays) { if (ctx->num_sampler_arrays) {
struct vrend_sampler_array *last_array = &ctx->sampler_arrays[ctx->num_sampler_arrays - 1]; struct vrend_array *last_array = &ctx->sampler_arrays[ctx->num_sampler_arrays - 1];
if ((last_array->first + last_array->array_size == first) && if ((last_array->first + last_array->array_size == first) &&
ctx->samplers[last_array->first].tgsi_sampler_type == sview_type && ctx->samplers[last_array->first].tgsi_sampler_type == sview_type &&
ctx->samplers[last_array->first].tgsi_sampler_return == sview_rtype) { ctx->samplers[last_array->first].tgsi_sampler_return == sview_rtype) {

@ -36,12 +36,7 @@ struct vrend_interp_info {
unsigned location; unsigned location;
}; };
struct vrend_sampler_array { struct vrend_array {
int first;
int array_size;
};
struct vrend_image_array {
int first; int first;
int array_size; int array_size;
}; };
@ -73,10 +68,10 @@ struct vrend_shader_info {
bool tes_point_mode; bool tes_point_mode;
uint32_t attrib_input_mask; uint32_t attrib_input_mask;
struct vrend_sampler_array *sampler_arrays; struct vrend_array *sampler_arrays;
int num_sampler_arrays; int num_sampler_arrays;
struct vrend_image_array *image_arrays; struct vrend_array *image_arrays;
int num_image_arrays; int num_image_arrays;
struct pipe_stream_output_info so_info; struct pipe_stream_output_info so_info;

Loading…
Cancel
Save