From 9ec5e96ec8297216bcab4036deaa6eb714ca4e67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 28 Jan 2020 17:25:40 -0500 Subject: [PATCH] vbo: use the template for noop GLvertexformat initialization Reviewed-by: Kristian H. Kristensen Part-of: --- src/mesa/vbo/vbo_exec_api.c | 2 +- src/mesa/vbo/vbo_noop.c | 353 +++--------------------------------- src/mesa/vbo/vbo_noop.h | 2 +- src/mesa/vbo/vbo_save_api.c | 2 +- 4 files changed, 27 insertions(+), 332 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 4ab09c01fdd..231fd7545ef 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -1030,7 +1030,7 @@ vbo_exec_vtx_init(struct vbo_exec_context *exec) exec->vtx.buffer_ptr = exec->vtx.buffer_map; vbo_exec_vtxfmt_init(exec); - _mesa_noop_vtxfmt_init(&exec->vtxfmt_noop); + _mesa_noop_vtxfmt_init(ctx, &exec->vtxfmt_noop); exec->vtx.enabled = 0; for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { diff --git a/src/mesa/vbo/vbo_noop.c b/src/mesa/vbo/vbo_noop.c index f86984589f1..ab85904a442 100644 --- a/src/mesa/vbo/vbo_noop.c +++ b/src/mesa/vbo/vbo_noop.c @@ -35,271 +35,13 @@ #include "main/dlist.h" #include "main/eval.h" #include "vbo/vbo_noop.h" - -static void GLAPIENTRY -_mesa_noop_EdgeFlag(GLboolean b) -{ -} - -static void GLAPIENTRY -_mesa_noop_Indexf(GLfloat f) -{ -} - -static void GLAPIENTRY -_mesa_noop_Indexfv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_FogCoordfEXT(GLfloat a) -{ -} - -static void GLAPIENTRY -_mesa_noop_FogCoordfvEXT(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Normal3f(GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_Normal3fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Color4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) -{ -} - -static void GLAPIENTRY -_mesa_noop_Color4fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Color3f(GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_Color3fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord1fARB(GLenum target, GLfloat a) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord1fvARB(GLenum target, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord2fARB(GLenum target, GLfloat a, GLfloat b) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord2fvARB(GLenum target, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord3fARB(GLenum target, GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord3fvARB(GLenum target, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord4fARB(GLenum target, GLfloat a, GLfloat b, - GLfloat c, GLfloat d) -{ -} - -static void GLAPIENTRY -_mesa_noop_MultiTexCoord4fvARB(GLenum target, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_SecondaryColor3fEXT(GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_SecondaryColor3fvEXT(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord1f(GLfloat a) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord1fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord2f(GLfloat a, GLfloat b) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord2fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord3f(GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord3fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) -{ -} - -static void GLAPIENTRY -_mesa_noop_TexCoord4fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib1fNV(GLuint index, GLfloat x) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib1fvNV(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib2fvNV(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib3fvNV(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib4fNV(GLuint index, GLfloat x, - GLfloat y, GLfloat z, GLfloat w) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib4fvNV(GLuint index, const GLfloat * v) -{ -} - - -static void GLAPIENTRY -_mesa_noop_VertexAttrib1fARB(GLuint index, GLfloat x) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib1fvARB(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib2fvARB(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib3fvARB(GLuint index, const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib4fARB(GLuint index, GLfloat x, - GLfloat y, GLfloat z, GLfloat w) -{ -} - -static void GLAPIENTRY -_mesa_noop_VertexAttrib4fvARB(GLuint index, const GLfloat * v) -{ -} +#include "vbo_attrib.h" static void GLAPIENTRY _mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params) { } -static void GLAPIENTRY -_mesa_noop_Vertex2fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Vertex3fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Vertex4fv(const GLfloat * v) -{ -} - -static void GLAPIENTRY -_mesa_noop_Vertex2f(GLfloat a, GLfloat b) -{ -} - -static void GLAPIENTRY -_mesa_noop_Vertex3f(GLfloat a, GLfloat b, GLfloat c) -{ -} - -static void GLAPIENTRY -_mesa_noop_Vertex4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) -{ -} - static void GLAPIENTRY _mesa_noop_EvalCoord1f(GLfloat a) { @@ -351,6 +93,23 @@ _mesa_noop_PrimitiveRestartNV(void) { } +/** + * If index=0, does glVertexAttrib*() alias glVertex() to emit a vertex? + * It depends on a few things, including whether we're inside or outside + * of glBegin/glEnd. + */ +static inline bool +is_vertex_position(const struct gl_context *ctx, GLuint index) +{ + return false; /* it doesn't matter for noop */ +} + +#define ATTR_UNION(A, N, T, C, V0, V1, V2, V3) do { (void)ctx; (void)(A); } while(0) +#define ERROR(err) _mesa_error(ctx, err, __func__) +#define TAG(x) _mesa_noop_##x + +#include "vbo_attrib_tmp.h" + /** * Build a vertexformat of functions that are no-ops. @@ -358,78 +117,14 @@ _mesa_noop_PrimitiveRestartNV(void) * to put the vertex data into. */ void -_mesa_noop_vtxfmt_init(GLvertexformat * vfmt) +_mesa_noop_vtxfmt_init(struct gl_context *ctx, GLvertexformat * vfmt) { - vfmt->ArrayElement = _mesa_noop_ArrayElement; - - vfmt->Begin = _mesa_noop_Begin; - - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; - - 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->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV; - - 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; +#define NAME_AE(x) _mesa_noop_##x +#define NAME_CALLLIST(x) _mesa_##x +#define NAME(x) _mesa_noop_##x +#define NAME_ES(x) _mesa_noop_##x##ARB - vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; - vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; - vfmt->Indexf = _mesa_noop_Indexf; - vfmt->Indexfv = _mesa_noop_Indexfv; - vfmt->Materialfv = _mesa_noop_Materialfv; - vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB; - vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB; - vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB; - vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB; - vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB; - vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB; - vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB; - vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB; - vfmt->Normal3f = _mesa_noop_Normal3f; - vfmt->Normal3fv = _mesa_noop_Normal3fv; - vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT; - vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT; - vfmt->TexCoord1f = _mesa_noop_TexCoord1f; - vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv; - vfmt->TexCoord2f = _mesa_noop_TexCoord2f; - vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv; - vfmt->TexCoord3f = _mesa_noop_TexCoord3f; - vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv; - vfmt->TexCoord4f = _mesa_noop_TexCoord4f; - vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv; - vfmt->Vertex2f = _mesa_noop_Vertex2f; - vfmt->Vertex2fv = _mesa_noop_Vertex2fv; - vfmt->Vertex3f = _mesa_noop_Vertex3f; - vfmt->Vertex3fv = _mesa_noop_Vertex3fv; - vfmt->Vertex4f = _mesa_noop_Vertex4f; - vfmt->Vertex4fv = _mesa_noop_Vertex4fv; - vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV; - vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV; - vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV; - vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV; - vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV; - vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV; - vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV; - vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV; - vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB; - vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB; - vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB; - vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB; - vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB; - vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB; - vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB; - vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB; +#include "vbo_init_tmp.h" } diff --git a/src/mesa/vbo/vbo_noop.h b/src/mesa/vbo/vbo_noop.h index 0ca1bfa8e1b..1f3caade8bd 100644 --- a/src/mesa/vbo/vbo_noop.h +++ b/src/mesa/vbo/vbo_noop.h @@ -31,7 +31,7 @@ struct _glapi_table; extern void -_mesa_noop_vtxfmt_init(GLvertexformat *vfmt); +_mesa_noop_vtxfmt_init(struct gl_context *ctx, GLvertexformat *vfmt); extern GLboolean _mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch); diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index d378bdb058d..29684188127 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1930,5 +1930,5 @@ vbo_save_api_init(struct vbo_save_context *save) vtxfmt_init(ctx); current_init(ctx); - _mesa_noop_vtxfmt_init(&save->vtxfmt_noop); + _mesa_noop_vtxfmt_init(ctx, &save->vtxfmt_noop); } -- 2.30.2