X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fapi_noop.c;h=c4ac95c986aa7353189079e27ebd0046b7ec1949;hb=b79782cbedf8b23ea392d9a597eb4831a605bbe0;hp=3df64362eab691ad658da83d0bba62e7ca42825e;hpb=bb1b01616b6cb9b0a1cab74e10940ce346cb8a3d;p=mesa.git diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 3df64362eab..c4ac95c986a 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -30,8 +30,10 @@ #include "context.h" #include "light.h" #include "macros.h" +#include "mfeatures.h" #include "dlist.h" -#include "glapi/dispatch.h" +#include "eval.h" +#include "main/dispatch.h" /** @@ -42,6 +44,9 @@ */ +#if FEATURE_beginend + + static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); @@ -475,7 +480,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fvNV( GLuint index, const GLfloat static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, 0, 0, 1); } else @@ -485,7 +490,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib1fARB( GLuint index, GLfloat x ) static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], 0, 0, 1); } else @@ -495,7 +500,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib1fvARB( GLuint index, const GLfloa static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, 0, 1); } else @@ -505,7 +510,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib2fARB( GLuint index, GLfloat x, GL static void GLAPIENTRY _mesa_noop_VertexAttrib2fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], 0, 1); } else @@ -516,7 +521,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, 1); } else @@ -526,7 +531,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib3fARB( GLuint index, GLfloat x, static void GLAPIENTRY _mesa_noop_VertexAttrib3fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], 1); } else @@ -537,7 +542,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], x, y, z, w); } else @@ -547,7 +552,7 @@ static void GLAPIENTRY _mesa_noop_VertexAttrib4fARB( GLuint index, GLfloat x, static void GLAPIENTRY _mesa_noop_VertexAttrib4fvARB( GLuint index, const GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); - if (index < MAX_VERTEX_ATTRIBS) { + if (index < MAX_VERTEX_GENERIC_ATTRIBS) { ASSIGN_4V(ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + index], v[0], v[1], v[2], v[3]); } else @@ -621,6 +626,8 @@ static void GLAPIENTRY _mesa_noop_Vertex4f( GLfloat a, GLfloat b, GLfloat c, GLf (void) a; (void) b; (void) c; (void) d; } + +#if FEATURE_evaluators /* Similarly, these have no effect outside begin/end: */ static void GLAPIENTRY _mesa_noop_EvalCoord1f( GLfloat a ) @@ -652,6 +659,7 @@ static void GLAPIENTRY _mesa_noop_EvalPoint2( GLint a, GLint b ) { (void) a; (void) b; } +#endif /* FEATURE_evaluators */ /* Begin -- call into driver, should result in the vtxfmt being @@ -672,6 +680,16 @@ static void GLAPIENTRY _mesa_noop_End( void ) } +/*** + * PrimitiveRestart called outside glBegin()/End(): raise an error + */ +static void GLAPIENTRY _mesa_noop_PrimitiveRestartNV( void ) +{ + GET_CURRENT_CONTEXT(ctx); + _mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartNV(no glBegin)"); +} + + /** * Execute a glRectf() function. This is not suitable for GL_COMPILE * modes (as the test for outside begin/end is not compiled), @@ -726,7 +744,7 @@ _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, GET_CURRENT_CONTEXT(ctx); GLint i; - if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices )) + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 )) return; CALL_Begin(GET_DISPATCH(), (mode)); @@ -752,6 +770,43 @@ _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, CALL_End(GET_DISPATCH(), ()); } +static void GLAPIENTRY +_mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices, GLint basevertex) +{ + GET_CURRENT_CONTEXT(ctx); + GLint i; + + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, + basevertex )) + return; + + CALL_Begin(GET_DISPATCH(), (mode)); + + switch (type) { + case GL_UNSIGNED_BYTE: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLubyte *)indices)[i] + + basevertex)); + break; + case GL_UNSIGNED_SHORT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLushort *)indices)[i] + + basevertex )); + break; + case GL_UNSIGNED_INT: + for (i = 0 ; i < count ; i++) + CALL_ArrayElement(GET_DISPATCH(), ( ((GLuint *)indices)[i] + + basevertex )); + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glDrawElementsBaseVertex(type)" ); + break; + } + + CALL_End(GET_DISPATCH(), ()); +} + static void GLAPIENTRY _mesa_noop_DrawRangeElements(GLenum mode, @@ -763,10 +818,58 @@ _mesa_noop_DrawRangeElements(GLenum mode, if (_mesa_validate_DrawRangeElements( ctx, mode, start, end, - count, type, indices )) + count, type, indices, 0 )) CALL_DrawElements(GET_DISPATCH(), (mode, count, type, indices)); } +/* GL_EXT_multi_draw_arrays */ +void GLAPIENTRY +_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, + const GLvoid **indices, GLsizei primcount) +{ + GLsizei i; + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + CALL_DrawElements(GET_DISPATCH(), (mode, count[i], type, indices[i])); + } + } +} + +static void GLAPIENTRY +_mesa_noop_DrawRangeElementsBaseVertex(GLenum mode, + GLuint start, GLuint end, + GLsizei count, GLenum type, + const GLvoid *indices, GLint basevertex) +{ + GET_CURRENT_CONTEXT(ctx); + + if (_mesa_validate_DrawRangeElements( ctx, mode, + start, end, + count, type, indices, basevertex )) + CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count, type, indices, + basevertex)); +} + +/* GL_EXT_multi_draw_arrays */ +void GLAPIENTRY +_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, + GLenum type, + const GLvoid **indices, + GLsizei primcount, + const GLint *basevertex) +{ + GLsizei i; + + for (i = 0; i < primcount; i++) { + if (count[i] > 0) { + CALL_DrawElementsBaseVertex(GET_DISPATCH(), (mode, count[i], type, + indices[i], + basevertex[i])); + } + } +} + /* * Eval Mesh */ @@ -789,6 +892,8 @@ _mesa_noop_EvalMesh1( GLenum mode, GLint i1, GLint i2 ) GLfloat u, du; GLenum prim; + ASSERT_OUTSIDE_BEGIN_END(ctx); + switch (mode) { case GL_POINT: prim = GL_POINTS; @@ -827,6 +932,8 @@ _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) GLfloat u, du, v, dv, v1, u1; GLint i, j; + ASSERT_OUTSIDE_BEGIN_END(ctx); + switch (mode) { case GL_POINT: case GL_LINE: @@ -902,22 +1009,23 @@ _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) { - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->Begin = _mesa_noop_Begin; - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; + + _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); + vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->End = _mesa_noop_End; - vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; - vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; - vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; - vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; - vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; - vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; + + vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV; + + _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_); + vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; @@ -971,6 +1079,11 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawArrays = _mesa_noop_DrawArrays; vfmt->DrawElements = _mesa_noop_DrawElements; vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements; - vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; - vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; + vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements; + vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; + vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; + vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; } + + +#endif /* FEATURE_beginend */