00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "draw/draw_private.h"
00038 #include "draw/draw_vertex.h"
00039
00040
00045 void
00046 draw_compute_vertex_size(struct vertex_info *vinfo)
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
00057 case EMIT_1F_PSIZE:
00058
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 }
00076
00077
00078 void
00079 draw_dump_emitted_vertex(const struct vertex_info *vinfo, const uint8_t *data)
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 }