diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-10-16 08:58:26 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-10-16 08:58:26 +0300 |
commit | 741965615dfc5a56c1e35fa5e50c3ef228471352 (patch) | |
tree | 79c02ebada08cd9a6292fdc87b2a40b2d22fc4b2 /source/blender/gpu/gawain | |
parent | a4fe823416f3907f56fb997fe1f244f9bbafc9e7 (diff) |
Gawain: new immSkipAttrib function
Now you can explicitly skip a vertex attribute -- you don't give it a value and it won't get a copy of the previous vert's value. Useful for flat interpolated per-primitive values.
This is an advanced feature. Expect garbage in the empty spaces, and copies of garbage if you rely on the attrib copy behavior after skipping.
Diffstat (limited to 'source/blender/gpu/gawain')
-rw-r--r-- | source/blender/gpu/gawain/immediate.c | 12 | ||||
-rw-r--r-- | source/blender/gpu/gawain/immediate.h | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/gpu/gawain/immediate.c b/source/blender/gpu/gawain/immediate.c index 6c4f3f0f38a..f8d851ea8ea 100644 --- a/source/blender/gpu/gawain/immediate.c +++ b/source/blender/gpu/gawain/immediate.c @@ -592,6 +592,17 @@ void immAttrib4ubv(unsigned attrib_id, const unsigned char data[4]) immAttrib4ub(attrib_id, data[0], data[1], data[2], data[3]); } +void immSkipAttrib(unsigned attrib_id) + { +#if TRUST_NO_ONE + assert(attrib_id < imm.vertex_format.attrib_ct); + assert(imm.vertex_idx < imm.vertex_ct); + assert(imm.primitive != PRIM_NONE); // make sure we're between a Begin/End pair +#endif + + setAttribValueBit(attrib_id); + } + static void immEndVertex(void) // and move on to the next vertex { #if TRUST_NO_ONE @@ -619,6 +630,7 @@ static void immEndVertex(void) // and move on to the next vertex GLubyte* data = imm.vertex_data + a->offset; memcpy(data, data - imm.vertex_format.stride, a->sz); + // TODO: consolidate copy of adjacent attributes } } } diff --git a/source/blender/gpu/gawain/immediate.h b/source/blender/gpu/gawain/immediate.h index d71532bcac7..e0764dc0bd6 100644 --- a/source/blender/gpu/gawain/immediate.h +++ b/source/blender/gpu/gawain/immediate.h @@ -54,6 +54,10 @@ void immAttrib4ub(unsigned attrib_id, unsigned char r, unsigned char g, unsigned void immAttrib3ubv(unsigned attrib_id, const unsigned char data[4]); void immAttrib4ubv(unsigned attrib_id, const unsigned char data[4]); +// explicitly skip an attribute +// this advanced option kills automatic value copying for this attrib_id +void immSkipAttrib(unsigned attrib_id); + // provide one last attribute value & end the current vertex // this is most often used for 2D or 3D position (similar to glVertex) |