draw_vertex.c File Reference

Include dependency graph for draw_vertex.c:

Go to the source code of this file.

Functions

void draw_compute_vertex_size (struct vertex_info *vinfo)
 Compute the size of a vertex, in dwords/floats, to update the vinfo->size field.
void draw_dump_emitted_vertex (const struct vertex_info *vinfo, const uint8_t *data)


Function Documentation

void draw_compute_vertex_size ( struct vertex_info vinfo  ) 

Compute the size of a vertex, in dwords/floats, to update the vinfo->size field.

Definition at line 46 of file draw_vertex.c.

References assert, vertex_info::attrib, vertex_info::emit, EMIT_1F, EMIT_1F_PSIZE, EMIT_2F, EMIT_3F, EMIT_4F, EMIT_4UB, EMIT_OMIT, vertex_info::num_attribs, and vertex_info::size.

00047 {
00048    uint i;
00049 
00050    vinfo->size = 0;
00051    for (i = 0; i < vinfo->num_attribs; i++) {
00052       switch (vinfo->attrib[i].emit) {
00053       case EMIT_OMIT:
00054          break;
00055       case EMIT_4UB:
00056          /* fall-through */
00057       case EMIT_1F_PSIZE:
00058          /* fall-through */
00059       case EMIT_1F:
00060          vinfo->size += 1;
00061          break;
00062       case EMIT_2F:
00063          vinfo->size += 2;
00064          break;
00065       case EMIT_3F:
00066          vinfo->size += 3;
00067          break;
00068       case EMIT_4F:
00069          vinfo->size += 4;
00070          break;
00071       default:
00072          assert(0);
00073       }
00074    }
00075 }

void draw_dump_emitted_vertex ( const struct vertex_info vinfo,
const uint8_t *  data 
)

Definition at line 79 of file draw_vertex.c.

References assert, vertex_info::attrib, debug_printf(), vertex_info::emit, EMIT_1F, EMIT_1F_PSIZE, EMIT_2F, EMIT_3F, EMIT_4F, EMIT_4UB, EMIT_OMIT, vertex_info::num_attribs, and vertex_info::src_index.

00080 {
00081    unsigned i, j;
00082 
00083    for (i = 0; i < vinfo->num_attribs; i++) {
00084       j = vinfo->attrib[i].src_index;
00085       switch (vinfo->attrib[i].emit) {
00086       case EMIT_OMIT:
00087          debug_printf("EMIT_OMIT:");
00088          break;
00089       case EMIT_1F:
00090          debug_printf("EMIT_1F:\t");
00091          debug_printf("%f ", *(float *)data); data += sizeof(float);
00092          break;
00093       case EMIT_1F_PSIZE:
00094          debug_printf("EMIT_1F_PSIZE:\t");
00095          debug_printf("%f ", *(float *)data); data += sizeof(float);
00096          break;
00097       case EMIT_2F:
00098          debug_printf("EMIT_2F:\t");
00099          debug_printf("%f ", *(float *)data); data += sizeof(float);
00100          debug_printf("%f ", *(float *)data); data += sizeof(float);
00101          break;
00102       case EMIT_3F:
00103          debug_printf("EMIT_3F:\t");
00104          debug_printf("%f ", *(float *)data); data += sizeof(float);
00105          debug_printf("%f ", *(float *)data); data += sizeof(float);
00106          debug_printf("%f ", *(float *)data); data += sizeof(float);
00107          data += sizeof(float);
00108          break;
00109       case EMIT_4F:
00110          debug_printf("EMIT_4F:\t");
00111          debug_printf("%f ", *(float *)data); data += sizeof(float);
00112          debug_printf("%f ", *(float *)data); data += sizeof(float);
00113          debug_printf("%f ", *(float *)data); data += sizeof(float);
00114          debug_printf("%f ", *(float *)data); data += sizeof(float);
00115          break;
00116       case EMIT_4UB:
00117          debug_printf("EMIT_4UB:\t");
00118          debug_printf("%u ", *data++);
00119          debug_printf("%u ", *data++);
00120          debug_printf("%u ", *data++);
00121          debug_printf("%u ", *data++);
00122          break;
00123       default:
00124          assert(0);
00125       }
00126       debug_printf("\n");
00127    }
00128    debug_printf("\n");
00129 }


Generated on Tue Sep 29 06:25:21 2009 for Gallium3D by  doxygen 1.5.4