Lines Matching refs:ctx
67 _mesa_lookup_vao(struct gl_context *ctx, GLuint id)
74 if (ctx->Array.LastLookedUpVAO &&
75 ctx->Array.LastLookedUpVAO->Name == id) {
76 vao = ctx->Array.LastLookedUpVAO;
79 _mesa_HashLookupLocked(ctx->Array.Objects, id);
81 _mesa_reference_vao(ctx, &ctx->Array.LastLookedUpVAO, vao);
94 * array object when ctx is a compatibility profile context and id is zero.
97 _mesa_lookup_vao_err(struct gl_context *ctx, GLuint id, const char *caller)
106 if (ctx->API == API_OPENGL_CORE) {
107 _mesa_error(ctx, GL_INVALID_OPERATION,
113 return ctx->Array.DefaultVAO;
117 if (ctx->Array.LastLookedUpVAO &&
118 ctx->Array.LastLookedUpVAO->Name == id) {
119 vao = ctx->Array.LastLookedUpVAO;
122 _mesa_HashLookupLocked(ctx->Array.Objects, id);
131 _mesa_error(ctx, GL_INVALID_OPERATION,
136 _mesa_reference_vao(ctx, &ctx->Array.LastLookedUpVAO, vao);
150 unbind_array_object_vbos(struct gl_context *ctx, struct gl_vertex_array_object *obj)
155 _mesa_reference_buffer_object(ctx, &obj->BufferBinding[i].BufferObj, NULL);
158 _mesa_reference_buffer_object(ctx, &obj->_VertexAttrib[i].BufferObj, NULL);
166 _mesa_new_vao(struct gl_context *ctx, GLuint name)
170 _mesa_initialize_vao(ctx, obj, name);
179 _mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj)
181 unbind_array_object_vbos(ctx, obj);
182 _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL);
194 _mesa_reference_vao_(struct gl_context *ctx,
208 _mesa_delete_vao(ctx, oldObj);
232 init_array(struct gl_context *ctx,
258 _mesa_reference_buffer_object(ctx, &binding->BufferObj,
259 ctx->Shared->NullBufferObj);
267 _mesa_initialize_vao(struct gl_context *ctx,
281 init_array(ctx, vao, VERT_ATTRIB_NORMAL, 3, GL_FLOAT);
284 init_array(ctx, vao, VERT_ATTRIB_COLOR1, 3, GL_FLOAT);
287 init_array(ctx, vao, VERT_ATTRIB_FOG, 1, GL_FLOAT);
290 init_array(ctx, vao, VERT_ATTRIB_COLOR_INDEX, 1, GL_FLOAT);
293 init_array(ctx, vao, VERT_ATTRIB_EDGEFLAG, 1, GL_BOOL);
296 init_array(ctx, vao, VERT_ATTRIB_POINT_SIZE, 1, GL_FLOAT);
299 init_array(ctx, vao, i, 4, GL_FLOAT);
304 _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj,
305 ctx->Shared->NullBufferObj);
314 _mesa_update_vao_client_arrays(struct gl_context *ctx,
327 _mesa_update_client_array(ctx, client_array, attrib_array,
405 bind_vertex_array(struct gl_context *ctx, GLuint id, bool no_error)
407 struct gl_vertex_array_object *const oldObj = ctx->Array.VAO;
422 newObj = ctx->Array.DefaultVAO;
426 newObj = _mesa_lookup_vao(ctx, id);
428 _mesa_error(ctx, GL_INVALID_OPERATION,
436 if (ctx->Array.DrawMethod == DRAW_ARRAYS) {
447 ctx->Array._DrawArrays = NULL;
448 ctx->Array.DrawMethod = DRAW_NONE;
451 ctx->NewState |= _NEW_ARRAY;
452 _mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);
459 GET_CURRENT_CONTEXT(ctx);
460 bind_vertex_array(ctx, id, true);
467 GET_CURRENT_CONTEXT(ctx);
468 bind_vertex_array(ctx, id, false);
479 delete_vertex_arrays(struct gl_context *ctx, GLsizei n, const GLuint *ids)
484 struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]);
493 if (obj == ctx->Array.VAO)
497 _mesa_HashRemoveLocked(ctx->Array.Objects, obj->Name);
499 if (ctx->Array.LastLookedUpVAO == obj)
500 _mesa_reference_vao(ctx, &ctx->Array.LastLookedUpVAO, NULL);
505 _mesa_reference_vao(ctx, &obj, NULL);
514 GET_CURRENT_CONTEXT(ctx);
515 delete_vertex_arrays(ctx, n, ids);
522 GET_CURRENT_CONTEXT(ctx);
525 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)");
529 delete_vertex_arrays(ctx, n, ids);
544 gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
553 first = _mesa_HashFindFreeKeyBlock(ctx->Array.Objects, n);
563 obj = _mesa_new_vao(ctx, name);
565 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
569 _mesa_HashInsertLocked(ctx->Array.Objects, obj->Name, obj);
576 gen_vertex_arrays_err(struct gl_context *ctx, GLsizei n, GLuint *arrays,
580 _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);
584 gen_vertex_arrays(ctx, n, arrays, create, func);
595 GET_CURRENT_CONTEXT(ctx);
596 gen_vertex_arrays(ctx, n, arrays, false, "glGenVertexArrays");
603 GET_CURRENT_CONTEXT(ctx);
604 gen_vertex_arrays_err(ctx, n, arrays, false, "glGenVertexArrays");
615 GET_CURRENT_CONTEXT(ctx);
616 gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
623 GET_CURRENT_CONTEXT(ctx);
624 gen_vertex_arrays_err(ctx, n, arrays, true, "glCreateVertexArrays");
639 GET_CURRENT_CONTEXT(ctx);
640 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
642 obj = _mesa_lookup_vao(ctx, id);
655 vertex_array_element_buffer(struct gl_context *ctx, GLuint vaobj, GLuint buffer,
661 ASSERT_OUTSIDE_BEGIN_END(ctx);
670 vao =_mesa_lookup_vao_err(ctx, vaobj, "glVertexArrayElementBuffer");
674 vao = _mesa_lookup_vao(ctx, vaobj);
684 bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
687 bufObj = _mesa_lookup_bufferobj(ctx, buffer);
690 bufObj = ctx->Shared->NullBufferObj;
694 _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj);
701 GET_CURRENT_CONTEXT(ctx);
702 vertex_array_element_buffer(ctx, vaobj, buffer, true);
709 GET_CURRENT_CONTEXT(ctx);
710 vertex_array_element_buffer(ctx, vaobj, buffer, false);
717 GET_CURRENT_CONTEXT(ctx);
720 ASSERT_OUTSIDE_BEGIN_END(ctx);
728 vao =_mesa_lookup_vao_err(ctx, vaobj, "glGetVertexArrayiv");
738 _mesa_error(ctx, GL_INVALID_ENUM,