Lines Matching defs:vao
38 _mesa_glthread_reset_vao(struct glthread_vao *vao)
49 vao->CurrentElementBufferName = 0;
50 vao->UserEnabled = 0;
51 vao->Enabled = 0;
52 vao->BufferEnabled = 0;
53 vao->UserPointerMask = 0;
54 vao->NonZeroDivisorMask = 0;
56 for (unsigned i = 0; i < ARRAY_SIZE(vao->Attrib); i++) {
61 vao->Attrib[i].ElementSize = elem_size;
62 vao->Attrib[i].RelativeOffset = 0;
63 vao->Attrib[i].BufferIndex = i;
64 vao->Attrib[i].Stride = elem_size;
65 vao->Attrib[i].Divisor = 0;
66 vao->Attrib[i].EnabledAttribCount = 0;
67 vao->Attrib[i].Pointer = NULL;
75 struct glthread_vao *vao;
81 vao = glthread->LastLookedUpVAO;
83 vao = _mesa_HashLookupLocked(glthread->VAOs, id);
84 if (!vao)
87 glthread->LastLookedUpVAO = vao;
90 return vao;
101 struct glthread_vao *vao = lookup_vao(ctx, id);
103 if (vao)
104 glthread->CurrentVAO = vao;
122 struct glthread_vao *vao = lookup_vao(ctx, ids[i]);
123 if (!vao)
130 if (glthread->CurrentVAO == vao)
133 if (glthread->LastLookedUpVAO == vao)
137 _mesa_HashRemoveLocked(glthread->VAOs, vao->Name);
138 free(vao);
154 struct glthread_vao *vao;
156 vao = calloc(1, sizeof(*vao));
157 if (!vao)
160 vao->Name = id;
161 _mesa_glthread_reset_vao(vao);
162 _mesa_HashInsertLocked(glthread->VAOs, id, vao, true);
217 enable_buffer(struct glthread_vao *vao, unsigned binding_index)
219 int attrib_count = ++vao->Attrib[binding_index].EnabledAttribCount;
222 vao->BufferEnabled |= 1 << binding_index;
224 vao->BufferInterleaved |= 1 << binding_index;
228 disable_buffer(struct glthread_vao *vao, unsigned binding_index)
230 int attrib_count = --vao->Attrib[binding_index].EnabledAttribCount;
233 vao->BufferEnabled &= ~(1 << binding_index);
235 vao->BufferInterleaved &= ~(1 << binding_index);
254 struct glthread_vao *vao = get_vao(ctx, vaobj);
255 if (!vao)
260 if (enable && !(vao->UserEnabled & attrib_bit)) {
261 vao->UserEnabled |= attrib_bit;
267 if (!(vao->UserEnabled & VERT_BIT_GENERIC0))
268 enable_buffer(vao, vao->Attrib[VERT_ATTRIB_POS].BufferIndex);
270 enable_buffer(vao, vao->Attrib[attrib].BufferIndex);
272 if (attrib == VERT_ATTRIB_GENERIC0 && vao->UserEnabled & VERT_BIT_POS)
273 disable_buffer(vao, vao->Attrib[VERT_ATTRIB_POS].BufferIndex);
275 } else if (!enable && (vao->UserEnabled & attrib_bit)) {
276 vao->UserEnabled &= ~attrib_bit;
282 if (!(vao->UserEnabled & VERT_BIT_GENERIC0))
283 disable_buffer(vao, vao->Attrib[VERT_ATTRIB_POS].BufferIndex);
285 disable_buffer(vao, vao->Attrib[attrib].BufferIndex);
287 if (attrib == VERT_ATTRIB_GENERIC0 && vao->UserEnabled & VERT_BIT_POS)
288 enable_buffer(vao, vao->Attrib[VERT_ATTRIB_POS].BufferIndex);
293 vao->Enabled = vao->UserEnabled;
294 if (vao->Enabled & VERT_BIT_GENERIC0)
295 vao->Enabled &= ~VERT_BIT_POS;
299 set_attrib_binding(struct glthread_state *glthread, struct glthread_vao *vao,
302 unsigned old_binding_index = vao->Attrib[attrib].BufferIndex;
305 vao->Attrib[attrib].BufferIndex = new_binding_index;
307 if (vao->Enabled & (1u << attrib)) {
309 enable_buffer(vao, new_binding_index);
310 disable_buffer(vao, old_binding_index);
321 struct glthread_vao *vao = get_vao(ctx, vaobj);
322 if (!vao)
325 vao->Attrib[attrib].Divisor = divisor;
327 set_attrib_binding(&ctx->GLThread, vao, attrib, attrib);
330 vao->NonZeroDivisorMask |= 1u << attrib;
332 vao->NonZeroDivisorMask &= ~(1u << attrib);
345 attrib_pointer(struct glthread_state *glthread, struct glthread_vao *vao,
355 vao->Attrib[attrib].ElementSize = elem_size;
356 vao->Attrib[attrib].Stride = stride ? stride : elem_size;
357 vao->Attrib[attrib].Pointer = pointer;
358 vao->Attrib[attrib].RelativeOffset = 0;
360 set_attrib_binding(glthread, vao, attrib, attrib);
363 vao->UserPointerMask &= ~(1u << attrib);
365 vao->UserPointerMask |= 1u << attrib;
387 struct glthread_vao *vao;
389 vao = lookup_vao(ctx, vaobj);
390 if (!vao)
393 attrib_pointer(glthread, vao, buffer, attrib, size, type, stride,
398 attrib_format(struct glthread_state *glthread, struct glthread_vao *vao,
408 vao->Attrib[i].ElementSize = elem_size;
409 vao->Attrib[i].RelativeOffset = relativeoffset;
428 struct glthread_vao *vao = lookup_vao(ctx, vaobj);
430 if (vao)
431 attrib_format(glthread, vao, attribindex, size, type, relativeoffset);
435 bind_vertex_buffer(struct glthread_state *glthread, struct glthread_vao *vao,
443 vao->Attrib[i].Pointer = (const void*)offset;
444 vao->Attrib[i].Stride = stride;
447 vao->UserPointerMask &= ~(1u << i);
449 vao->UserPointerMask |= 1u << i;
468 struct glthread_vao *vao = lookup_vao(ctx, vaobj);
470 if (vao)
471 bind_vertex_buffer(glthread, vao, bindingindex, buffer, offset, stride);
482 struct glthread_vao *vao;
484 vao = lookup_vao(ctx, vaobj);
485 if (!vao)
489 bind_vertex_buffer(glthread, vao, first + i, buffers[i], offsets[i],
495 binding_divisor(struct glthread_state *glthread, struct glthread_vao *vao,
502 vao->Attrib[i].Divisor = divisor;
505 vao->NonZeroDivisorMask |= 1u << i;
507 vao->NonZeroDivisorMask &= ~(1u << i);
524 struct glthread_vao *vao = lookup_vao(ctx, vaobj);
526 if (vao)
527 binding_divisor(glthread, vao, bindingindex, divisor);
555 struct glthread_vao *vao = lookup_vao(ctx, vaobj);
556 if (vao) {
557 set_attrib_binding(glthread, vao,
567 struct glthread_vao *vao = lookup_vao(ctx, vaobj);
569 if (vao)
570 vao->CurrentElementBufferName = buffer;
620 struct glthread_vao *vao = NULL;
622 vao = lookup_vao(ctx, top->VAO.Name);
623 if (!vao)
634 if (!vao)
635 vao = &glthread->DefaultVAO;
637 assert(top->VAO.Name == vao->Name);
638 *vao = top->VAO; /* Copy all fields. */
639 glthread->CurrentVAO = vao;