Lines Matching refs:ctx
61 _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
71 map = ctx->Driver.MapBufferRange(ctx, 0, elementBuf->Size,
95 ctx->Driver.UnmapBuffer(ctx, elementBuf);
106 check_valid_to_render(struct gl_context *ctx, const char *function)
108 if (!_mesa_valid_to_render(ctx, function)) {
112 switch (ctx->API) {
117 if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current)
126 if (!ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled)
136 ctx->Shader.CurrentVertexProgram;
138 GLboolean haveVertexProgram = ctx->VertexProgram._Enabled;
149 return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled ||
150 ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled);
170 check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
180 if (!ctx->Const.CheckArrayBounds)
189 ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;
191 vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1);
194 max + basevertex >= ctx->Array.ArrayObj->_MaxElement) {
196 _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)",
197 max, ctx->Array.ArrayObj->_MaxElement);
211 _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
228 valid_enum = (ctx->API == API_OPENGL);
234 valid_enum = _mesa_is_desktop_gl(ctx)
235 && ctx->Extensions.ARB_geometry_shader4;
243 _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
261 if (ctx->TransformFeedback.CurrentObject->Active &&
262 !ctx->TransformFeedback.CurrentObject->Paused) {
267 pass = ctx->TransformFeedback.Mode == GL_POINTS;
272 pass = ctx->TransformFeedback.Mode == GL_LINES;
275 pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
279 _mesa_error(ctx, GL_INVALID_OPERATION,
283 _mesa_lookup_prim_by_nr(ctx->TransformFeedback.Mode));
297 valid_elements_type(struct gl_context *ctx, GLenum type, const char *name)
306 _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)", name,
318 _mesa_validate_DrawElements(struct gl_context *ctx,
322 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
323 FLUSH_CURRENT(ctx, 0);
327 _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
331 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) {
335 if (!valid_elements_type(ctx, type, "glDrawElements"))
338 if (!check_valid_to_render(ctx, "glDrawElements"))
342 if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
345 if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
346 _mesa_warning(ctx, "glDrawElements index out of buffer bounds");
356 if (!check_index_bounds(ctx, count, type, indices, basevertex))
369 _mesa_validate_MultiDrawElements(struct gl_context *ctx,
376 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
377 FLUSH_CURRENT(ctx, 0);
382 _mesa_error(ctx, GL_INVALID_VALUE,
388 if (!_mesa_valid_prim_mode(ctx, mode, "glMultiDrawElements")) {
392 if (!valid_elements_type(ctx, type, "glMultiDrawElements"))
395 if (!check_valid_to_render(ctx, "glMultiDrawElements"))
399 if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
404 ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
405 _mesa_warning(ctx,
420 if (!check_index_bounds(ctx, count[i], type, indices[i],
435 _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
440 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
441 FLUSH_CURRENT(ctx, 0);
445 _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
449 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) {
454 _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(end<start)");
458 if (!valid_elements_type(ctx, type, "glDrawRangeElements"))
461 if (!check_valid_to_render(ctx, "glDrawRangeElements"))
465 if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
468 if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
469 _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds");
479 if (!check_index_bounds(ctx, count, type, indices, basevertex))
492 _mesa_validate_DrawArrays(struct gl_context *ctx,
495 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
496 FLUSH_CURRENT(ctx, 0);
500 _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
504 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArrays")) {
508 if (!check_valid_to_render(ctx, "glDrawArrays"))
511 if (ctx->Const.CheckArrayBounds) {
512 if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
521 _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint first,
524 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
525 FLUSH_CURRENT(ctx, 0);
529 _mesa_error(ctx, GL_INVALID_VALUE,
535 _mesa_error(ctx, GL_INVALID_VALUE,
540 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArraysInstanced")) {
546 _mesa_error(ctx, GL_INVALID_VALUE,
551 if (!check_valid_to_render(ctx, "glDrawArraysInstanced(invalid to render)"))
554 if (ctx->Const.CheckArrayBounds) {
555 if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement)
564 _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
569 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
570 FLUSH_CURRENT(ctx, 0);
574 _mesa_error(ctx, GL_INVALID_VALUE,
579 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) {
583 if (!valid_elements_type(ctx, type, "glDrawElementsInstanced"))
588 _mesa_error(ctx, GL_INVALID_VALUE,
593 if (!check_valid_to_render(ctx, "glDrawElementsInstanced"))
597 if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) {
600 if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) {
601 _mesa_warning(ctx,
612 if (!check_index_bounds(ctx, count, type, indices, basevertex))
622 _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
628 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
629 FLUSH_CURRENT(ctx, 0);
631 if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback*(mode)")) {
636 _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedback*(name)");
641 _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawTransformFeedback*");
645 if (stream >= ctx->Const.MaxVertexStreams) {
646 _mesa_error(ctx, GL_INVALID_VALUE,
653 _mesa_error(ctx, GL_INVALID_VALUE,
659 if (!check_valid_to_render(ctx, "glDrawTransformFeedback*")) {