Home | History | Annotate | Download | only in vbo

Lines Matching refs:vtx

69    if (exec->vtx.prim_count == 0) {
70 exec->vtx.copied.nr = 0;
71 exec->vtx.vert_count = 0;
72 exec->vtx.buffer_ptr = exec->vtx.buffer_map;
75 GLuint last_begin = exec->vtx.prim[exec->vtx.prim_count-1].begin;
79 GLint i = exec->vtx.prim_count - 1;
81 exec->vtx.prim[i].count = (exec->vtx.vert_count -
82 exec->vtx.prim[i].start);
85 last_count = exec->vtx.prim[exec->vtx.prim_count-1].count;
89 if (exec->vtx.vert_count)
92 exec->vtx.prim_count = 0;
93 exec->vtx.copied.nr = 0;
98 assert(exec->vtx.prim_count == 0);
101 exec->vtx.prim[0].mode = exec->ctx->Driver.CurrentExecPrimitive;
102 exec->vtx.prim[0].start = 0;
103 exec->vtx.prim[0].count = 0;
104 exec->vtx.prim_count++;
106 if (exec->vtx.copied.nr == last_count)
107 exec->vtx.prim[0].begin = last_begin;
119 GLfloat *data = exec->vtx.copied.buffer;
123 * to exec->vtx.copied.
127 if (!exec->vtx.buffer_ptr) {
134 assert(exec->vtx.max_vert - exec->vtx.vert_count > exec->vtx.copied.nr);
136 for (i = 0 ; i < exec->vtx.copied.nr ; i++) {
137 memcpy( exec->vtx.buffer_ptr, data,
138 exec->vtx.vertex_size * sizeof(GLfloat));
139 exec->vtx.buffer_ptr += exec->vtx.vertex_size;
140 data += exec->vtx.vertex_size;
141 exec->vtx.vert_count++;
144 exec->vtx.copied.nr = 0;
158 if (exec->vtx.attrsz[i]) {
159 /* Note: the exec->vtx.current[i] pointers point into the
166 exec->vtx.attrsz[i],
167 exec->vtx.attrptr[i],
168 exec->vtx.attrtype[i]);
170 if (exec->vtx.attrtype[i] != vbo->currval[i].Type ||
179 vbo->currval[i].Size = exec->vtx.attrsz[i];
181 vbo->currval[i].Type = exec->vtx.attrtype[i];
183 vbo_attrtype_to_integer_flag(exec->vtx.attrtype[i]);
200 exec->vtx.attrsz[VBO_ATTRIB_COLOR0]) {
219 switch (exec->vtx.attrsz[i]) {
220 case 4: exec->vtx.attrptr[i][3] = current[3];
221 case 3: exec->vtx.attrptr[i][2] = current[2];
222 case 2: exec->vtx.attrptr[i][1] = current[1];
223 case 1: exec->vtx.attrptr[i][0] = current[0];
243 const GLint lastcount = exec->vtx.vert_count;
245 const GLuint old_vtx_size = exec->vtx.vertex_size; /* floats per vertex */
246 const GLuint oldSize = exec->vtx.attrsz[attr];
250 * to exec->vtx.copied.
254 if (unlikely(exec->vtx.copied.nr)) {
259 memcpy(old_attrptr, exec->vtx.attrptr, sizeof(old_attrptr));
274 !oldSize && lastcount > 8 && exec->vtx.vertex_size) {
281 exec->vtx.attrsz[attr] = newSize;
282 exec->vtx.vertex_size += newSize - oldSize;
283 exec->vtx.max_vert = ((VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
284 (exec->vtx.vertex_size * sizeof(GLfloat)));
285 exec->vtx.vert_count = 0;
286 exec->vtx.buffer_ptr = exec->vtx.buffer_map;
291 GLfloat *tmp = exec->vtx.vertex;
294 if (exec->vtx.attrsz[i]) {
295 exec->vtx.attrptr[i] = tmp;
296 tmp += exec->vtx.attrsz[i];
299 exec->vtx.attrptr[i] = NULL; /* will not be dereferenced */
309 exec->vtx.attrptr[attr] = exec->vtx.vertex +
310 exec->vtx.vertex_size - newSize;
318 if (unlikely(exec->vtx.copied.nr)) {
319 GLfloat *data = exec->vtx.copied.buffer;
320 GLfloat *dest = exec->vtx.buffer_ptr;
323 assert(exec->vtx.buffer_ptr == exec->vtx.buffer_map);
325 for (i = 0 ; i < exec->vtx.copied.nr ; i++) {
327 GLuint sz = exec->vtx.attrsz[j];
330 GLint old_offset = old_attrptr[j] - exec->vtx.vertex;
331 GLint new_offset = exec->vtx.attrptr[j] - exec->vtx.vertex;
338 exec->vtx.attrtype[j]);
352 dest += exec->vtx.vertex_size;
355 exec->vtx.buffer_ptr = dest;
356 exec->vtx.vert_count += exec->vtx.copied.nr;
357 exec->vtx.copied.nr = 0;
372 if (newSize > exec->vtx.attrsz[attr]) {
378 else if (newSize < exec->vtx.active_sz[attr]) {
381 vbo_get_default_vals_as_float(exec->vtx.attrtype[attr]);
386 for (i = newSize; i <= exec->vtx.attrsz[attr]; i++)
387 exec->vtx.attrptr[attr][i-1] = id[i-1];
390 exec->vtx.active_sz[attr] = newSize;
412 if (unlikely(exec->vtx.active_sz[A] != N)) \
416 GLfloat *dest = exec->vtx.attrptr[A]; \
421 exec->vtx.attrtype[A] = T; \
428 for (i = 0; i < exec->vtx.vertex_size; i++) \
429 exec->vtx.buffer_ptr[i] = exec->vtx.vertex[i]; \
431 exec->vtx.buffer_ptr += exec->vtx.vertex_size; \
437 if (++exec->vtx.vert_count >= exec->vtx.max_vert) \
555 if (exec->vtx.vert_count || unmap) {
559 if (exec->vtx.vertex_size) {
583 if (exec->vtx.active_sz[i] != exec->eval.map1[i].sz)
589 memcpy( exec->vtx.copied.buffer, exec->vtx.vertex,
590 exec->vtx.vertex_size * sizeof(GLfloat));
594 memcpy( exec->vtx.vertex, exec->vtx.copied.buffer,
595 exec->vtx.vertex_size * sizeof(GLfloat));
610 if (exec->vtx.active_sz[i] != exec->eval.map2[i].sz)
615 if (exec->vtx.active_sz[VBO_ATTRIB_NORMAL] != 3)
619 memcpy( exec->vtx.copied.buffer, exec->vtx.vertex,
620 exec->vtx.vertex_size * sizeof(GLfloat));
624 memcpy( exec->vtx.vertex, exec->vtx.copied.buffer,
625 exec->vtx.vertex_size * sizeof(GLfloat));
834 if (exec->vtx.vertex_size && !exec->vtx.attrsz[0])
837 i = exec->vtx.prim_count++;
838 exec->vtx.prim[i].mode = mode;
839 exec->vtx.prim[i].begin = 1;
840 exec->vtx.prim[i].end = 0;
841 exec->vtx.prim[i].indexed = 0;
842 exec->vtx.prim[i].weak = 0;
843 exec->vtx.prim[i].pad = 0;
844 exec->vtx.prim[i].start = exec->vtx.vert_count;
845 exec->vtx.prim[i].count = 0;
846 exec->vtx.prim[i].num_instances = 1;
847 exec->vtx.prim[i].base_instance = 0;
867 if (exec->vtx.prim_count > 0) {
869 int idx = exec->vtx.vert_count;
870 int i = exec->vtx.prim_count - 1;
872 exec->vtx.prim[i].end = 1;
873 exec->vtx.prim[i].count = idx - exec->vtx.prim[i].start;
878 if (exec->vtx.prim_count == VBO_MAX_PRIM)
1150 assert(exec->vtx.bufferobj == ctx->Shared->NullBufferObj);
1151 if (exec->vtx.buffer_map) {
1152 _mesa_align_free(exec->vtx.buffer_map);
1153 exec->vtx.buffer_map = NULL;
1154 exec->vtx.buffer_ptr = NULL;
1158 _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
1159 exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName, target);
1160 if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage, exec->vtx.bufferobj)) {
1191 &exec->vtx.bufferobj,
1194 ASSERT(!exec->vtx.buffer_map);
1195 exec->vtx.buffer_map = (GLfloat *)_mesa_align_malloc(VBO_VERT_BUFFER_SIZE, 64);
1196 exec->vtx.buffer_ptr = exec->vtx.buffer_map;
1206 ASSERT(i < Elements(exec->vtx.attrsz));
1207 exec->vtx.attrsz[i] = 0;
1208 ASSERT(i < Elements(exec->vtx.attrtype));
1209 exec->vtx.attrtype[i] = GL_FLOAT;
1210 ASSERT(i < Elements(exec->vtx.active_sz));
1211 exec->vtx.active_sz[i] = 0;
1214 ASSERT(i < Elements(exec->vtx.inputs));
1215 ASSERT(i < Elements(exec->vtx.arrays));
1216 exec->vtx.inputs[i] = &exec->vtx.arrays[i];
1220 struct gl_client_array *arrays = exec->vtx.arrays;
1246 exec->vtx.vertex_size = 0;
1260 if (exec->vtx.buffer_map) {
1261 ASSERT(exec->vtx.bufferobj->Name == 0 ||
1262 exec->vtx.bufferobj->Name == IMM_BUFFER_NAME);
1263 if (exec->vtx.bufferobj->Name == 0) {
1264 _mesa_align_free(exec->vtx.buffer_map);
1265 exec->vtx.buffer_map = NULL;
1266 exec->vtx.buffer_ptr = NULL;
1272 for (i = 0; i < Elements(exec->vtx.arrays); i++) {
1274 &exec->vtx.arrays[i].BufferObj,
1280 if (_mesa_bufferobj_mapped(exec->vtx.bufferobj)) {
1281 ctx->Driver.UnmapBuffer(ctx, exec->vtx.bufferobj);
1283 _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
1345 exec->vtx.attrsz[i] = 0;
1346 exec->vtx.attrtype[i] = GL_FLOAT;
1347 exec->vtx.active_sz[i] = 0;
1350 exec->vtx.vertex_size = 0;