[Mesa-dev] [PATCH 2/4] gallium: set frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX explicitly
Luca Barbieri
luca at luca-barbieri.com
Mon Aug 16 04:30:06 PDT 2010
All these places already zero-initialize the structure, so this is not
strictly necessary, but is consistent with the general coding style.
---
src/gallium/auxiliary/util/u_blit.c | 1 +
src/gallium/auxiliary/util/u_blitter.c | 1 +
src/gallium/auxiliary/util/u_gen_mipmap.c | 1 +
src/gallium/state_trackers/vega/polygon.c | 1 +
src/gallium/state_trackers/vega/vg_context.c | 1 +
src/gallium/state_trackers/xorg/xorg_renderer.c | 1 +
src/gallium/tests/graw/tri-instanced.c | 2 ++
src/gallium/tests/trivial/quad-tex.c | 2 ++
src/gallium/tests/trivial/tri.c | 2 ++
src/mesa/state_tracker/st_context.c | 1 +
src/mesa/state_tracker/st_draw.c | 2 ++
11 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 97fa99e..96cdc05 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -116,6 +116,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
for (i = 0; i < 2; i++) {
ctx->velem[i].src_offset = i * 4 * sizeof(float);
+ ctx->velem[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
ctx->velem[i].instance_divisor = 0;
ctx->velem[i].vertex_buffer_index = 0;
ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index b5b86b7..0244bf1 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -203,6 +203,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
memset(&velem[0], 0, sizeof(velem[0]) * 2);
for (i = 0; i < 2; i++) {
velem[i].src_offset = i * 4 * sizeof(float);
+ velem[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
velem[i].instance_divisor = 0;
velem[i].vertex_buffer_index = 0;
velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index b7fe2d3..e64428c 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1310,6 +1310,7 @@ util_create_gen_mipmap(struct pipe_context *pipe,
memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
for (i = 0; i < 2; i++) {
ctx->velem[i].src_offset = i * 4 * sizeof(float);
+ ctx->velem[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
ctx->velem[i].instance_divisor = 0;
ctx->velem[i].vertex_buffer_index = 0;
ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c
index bc94170..c966503 100644
--- a/src/gallium/state_trackers/vega/polygon.c
+++ b/src/gallium/state_trackers/vega/polygon.c
@@ -295,6 +295,7 @@ static void draw_polygon(struct vg_context *ctx,
/* tell pipe about the vertex attributes */
memset(&velement, 0, sizeof(velement));
velement.src_offset = 0;
+ velement.frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
velement.instance_divisor = 0;
velement.vertex_buffer_index = 0;
velement.src_format = PIPE_FORMAT_R32G32_FLOAT;
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 5cb2590..4ace894 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -142,6 +142,7 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
for (i = 0; i < 2; i++) {
ctx->velems[i].src_offset = i * 4 * sizeof(float);
+ ctx->velems[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
ctx->velems[i].instance_divisor = 0;
ctx->velems[i].vertex_buffer_index = 0;
ctx->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 92f1cc5..fed96b3 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -112,6 +112,7 @@ renderer_init_state(struct xorg_renderer *r)
memset(&r->velems[0], 0, sizeof(r->velems[0]) * 3);
for (i = 0; i < 3; i++) {
r->velems[i].src_offset = i * 4 * sizeof(float);
+ r->velems[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
r->velems[i].instance_divisor = 0;
r->velems[i].vertex_buffer_index = 0;
r->velems[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/tests/graw/tri-instanced.c b/src/gallium/tests/graw/tri-instanced.c
index db5647e..688466d 100644
--- a/src/gallium/tests/graw/tri-instanced.c
+++ b/src/gallium/tests/graw/tri-instanced.c
@@ -113,11 +113,13 @@ static void set_vertices( void )
/* pos */
ve[0].src_offset = Offset(struct vertex, position);
ve[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ ve[0].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
ve[0].vertex_buffer_index = 0;
/* color */
ve[1].src_offset = Offset(struct vertex, color);
ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ ve[1].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
ve[1].vertex_buffer_index = 0;
/* per-instance info */
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index cf88edc..ba38996 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -249,11 +249,13 @@ static void init_prog(struct program *p)
/* vertex elements state */
memset(p->velem, 0, sizeof(p->velem));
p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem[0].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
p->velem[0].instance_divisor = 0;
p->velem[0].vertex_buffer_index = 0;
p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem[1].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
p->velem[1].instance_divisor = 0;
p->velem[1].vertex_buffer_index = 0;
p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index 667a27b..4084c44 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -189,11 +189,13 @@ static void init_prog(struct program *p)
/* vertex elements state */
memset(p->velem, 0, sizeof(p->velem));
p->velem[0].src_offset = 0 * 4 * sizeof(float); /* offset 0, first element */
+ p->velem[0].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
p->velem[0].instance_divisor = 0;
p->velem[0].vertex_buffer_index = 0;
p->velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
p->velem[1].src_offset = 1 * 4 * sizeof(float); /* offset 16, second element */
+ p->velem[1].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
p->velem[1].instance_divisor = 0;
p->velem[1].vertex_buffer_index = 0;
p->velem[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 2ce5f08..e326ee1 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -131,6 +131,7 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
for (i = 0; i < 3; i++) {
memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element));
st->velems_util_draw[i].src_offset = i * 4 * sizeof(float);
+ st->velems_util_draw[i].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
st->velems_util_draw[i].instance_divisor = 0;
st->velems_util_draw[i].vertex_buffer_index = 0;
st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 5b05489..2fe242b 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -388,6 +388,7 @@ setup_interleaved_attribs(GLcontext *ctx,
velements[attr].src_offset =
(unsigned) (arrays[mesaAttr]->Ptr - offset0);
+ velements[attr].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = 0;
velements[attr].src_format =
@@ -483,6 +484,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
/* common-case setup */
vbuffer[attr].stride = stride; /* in bytes */
vbuffer[attr].max_index = max_index;
+ velements[attr].frequency = PIPE_ELEMENT_FREQUENCY_PER_VERTEX;
velements[attr].instance_divisor = 0;
velements[attr].vertex_buffer_index = attr;
velements[attr].src_format
--
1.7.0.4
More information about the mesa-dev
mailing list