From f531502dfb0891dc47be92447aa1f19375237fb1 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 6 Sep 2002 07:14:15 +0000 Subject: [PATCH] corrected function names reported in various backend not active errors (by using a #define that uses __func__ to get the function name as a string) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2338 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_backend.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index 60a9e7be..16178e65 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -65,6 +65,8 @@ void GL_PrintError(int errornumber, char *filename, int linenumber) } #endif +#define BACKENDACTIVECHECK if (!backendactive) Sys_Error(__func__ " called when backend is not active\n"); + float r_mesh_farclip; static float viewdist; @@ -433,8 +435,7 @@ void GL_Backend_ResetState(void) // called at beginning of frame void R_Mesh_Start(float farclip) { - if (!backendactive) - Sys_Error("R_Mesh_Clear: called when backend is not active\n"); + BACKENDACTIVECHECK CHECKGLERROR @@ -599,8 +600,7 @@ void _R_Mesh_ResizeCheck(int numverts, int numtriangles) { if (numtriangles > mesh_maxtris || numverts > mesh_maxverts) { - if (!backendactive) - Sys_Error("R_Mesh_Begin: called when backend is not active\n"); + BACKENDACTIVECHECK GL_Backend_ResizeArrays(max(numtriangles, (numverts + 2) / 3) + 100); GL_Backend_ResetState(); } @@ -609,8 +609,7 @@ void _R_Mesh_ResizeCheck(int numverts, int numtriangles) // renders the mesh void R_Mesh_Draw(int numverts, int numtriangles) { - if (!backendactive) - Sys_Error("R_Mesh_End: called when backend is not active\n"); + BACKENDACTIVECHECK c_meshs++; c_meshtris += numtriangles; @@ -630,6 +629,8 @@ void R_Mesh_Draw(int numverts, int numtriangles) void R_Mesh_Finish(void) { int i; + BACKENDACTIVECHECK + if (backendunits > 1) { for (i = backendunits - 1;i >= 0;i--) @@ -680,6 +681,8 @@ void R_Mesh_Finish(void) void R_Mesh_ClearDepth(void) { + BACKENDACTIVECHECK + R_Mesh_Finish(); qglClear(GL_DEPTH_BUFFER_BIT); R_Mesh_Start(r_mesh_farclip); @@ -692,8 +695,7 @@ void R_Mesh_State(const rmeshstate_t *m) int texturergbscale[MAX_TEXTUREUNITS]; float scaler; - if (!backendactive) - Sys_Error("R_Mesh_State: called when backend is not active\n"); + BACKENDACTIVECHECK if (gl_backend_rebindtextures) { -- 2.39.2