[virglrenderer-devel] [PATCH 2/2] shader: merge array types
Dave Airlie
airlied at gmail.com
Mon Jul 30 18:50:47 UTC 2018
From: Dave Airlie <airlied at redhat.com>
This just merges the sampler and image array types.
---
src/vrend_renderer.c | 2 +-
src/vrend_shader.c | 12 ++++++------
src/vrend_shader.h | 11 +++--------
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 4397f98..fc82ee1 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -1150,7 +1150,7 @@ static void bind_image_locs(struct vrend_linked_shader_program *sprog,
if (sprog->ss[id]->sel->sinfo.num_image_arrays) {
int idx;
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++) {
snprintf(name, 32, "%simg%d[%d]", prefix, img_array->first, j);
sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name);
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 658a830..42ebe11 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -156,10 +156,10 @@ struct dump_ctx {
struct vrend_shader_image images[32];
uint32_t images_used_mask;
- struct vrend_image_array *image_arrays;
+ struct vrend_array *image_arrays;
uint32_t num_image_arrays;
- struct vrend_sampler_array *sampler_arrays;
+ struct vrend_array *sampler_arrays;
uint32_t num_sampler_arrays;
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->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,
* 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 */
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)
return -1;
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;
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)
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->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) &&
ctx->samplers[last_array->first].tgsi_sampler_type == sview_type &&
ctx->samplers[last_array->first].tgsi_sampler_return == sview_rtype) {
diff --git a/src/vrend_shader.h b/src/vrend_shader.h
index 54e4ec6..04e92e6 100644
--- a/src/vrend_shader.h
+++ b/src/vrend_shader.h
@@ -36,12 +36,7 @@ struct vrend_interp_info {
unsigned location;
};
-struct vrend_sampler_array {
- int first;
- int array_size;
-};
-
-struct vrend_image_array {
+struct vrend_array {
int first;
int array_size;
};
@@ -73,10 +68,10 @@ struct vrend_shader_info {
bool tes_point_mode;
uint32_t attrib_input_mask;
- struct vrend_sampler_array *sampler_arrays;
+ struct vrend_array *sampler_arrays;
int num_sampler_arrays;
- struct vrend_image_array *image_arrays;
+ struct vrend_array *image_arrays;
int num_image_arrays;
struct pipe_stream_output_info so_info;
--
2.14.3
More information about the virglrenderer-devel
mailing list