[renderer] Remove more dead code

The back-buffer and video buffer locking code was pretty much never more
than stubs (except maybe in dos quake).
This commit is contained in:
Bill Currie 2022-03-07 08:44:53 +09:00
parent 04fd9baff5
commit 5eb397dd31
21 changed files with 2 additions and 175 deletions

View file

@ -145,7 +145,6 @@ extern vec3_t r_pright, r_pup, r_ppn;
void D_Aff8Patch (void *pcolormap); void D_Aff8Patch (void *pcolormap);
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height); void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height);
void D_DisableBackBufferAccess (void);
void D_EndDirectRect (int x, int y, int width, int height); void D_EndDirectRect (int x, int y, int width, int height);
void D_PolysetDraw (void); void D_PolysetDraw (void);
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts); void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
@ -155,7 +154,6 @@ void D_DrawPoly (void);
void D_DrawSprite (void); void D_DrawSprite (void);
void D_DrawSurfaces (void); void D_DrawSurfaces (void);
void D_DrawZPoint (void); void D_DrawZPoint (void);
void D_EnableBackBufferAccess (void);
void D_Init (void); void D_Init (void);
void D_Init_Cvars (void); void D_Init_Cvars (void);
void D_ViewChanged (void); void D_ViewChanged (void);

View file

@ -105,7 +105,7 @@ typedef struct surf_s {
qboolean insubmodel; qboolean insubmodel;
float d_ziorigin, d_zistepu, d_zistepv; float d_ziorigin, d_zistepu, d_zistepv;
int pad[2]; // to 64 bytes int pad[2]; // to 64 bytes (FIXME not for 64-bit)
} surf_t; } surf_t;
extern surf_t *surfaces, *surface_p, *surf_max; extern surf_t *surfaces, *surface_p, *surf_max;

View file

@ -34,8 +34,6 @@ void VID_InitGamma (const byte *);
qboolean VID_SetGamma (double); qboolean VID_SetGamma (double);
void VID_UpdateGamma (struct cvar_s *); void VID_UpdateGamma (struct cvar_s *);
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
void VID_InitBuffers (void); void VID_InitBuffers (void);
void VID_MakeColormaps (void); void VID_MakeColormaps (void);

View file

@ -63,24 +63,12 @@ D_Init (void)
VID_InitBuffers (); VID_InitBuffers ();
} }
void
D_EnableBackBufferAccess (void)
{
VID_LockBuffer ();
}
void void
D_TurnZOn (void) D_TurnZOn (void)
{ {
// not needed for software version // not needed for software version
} }
void
D_DisableBackBufferAccess (void)
{
VID_UnlockBuffer ();
}
void void
D_SetupFrame (void) D_SetupFrame (void)
{ {

View file

@ -782,9 +782,7 @@ Draw_FadeScreen (void)
int width = vid.conview->xlen / 4; int width = vid.conview->xlen / 4;
uint32_t *pbuf; uint32_t *pbuf;
VID_UnlockBuffer ();
S_ExtraUpdate (); S_ExtraUpdate ();
VID_LockBuffer ();
for (y = 0; y < height; y++) { for (y = 0; y < height; y++) {
uint32_t mask; uint32_t mask;
@ -798,9 +796,7 @@ Draw_FadeScreen (void)
} }
vr_data.scr_copyeverything = 1; vr_data.scr_copyeverything = 1;
VID_UnlockBuffer ();
S_ExtraUpdate (); S_ExtraUpdate ();
VID_LockBuffer ();
} }
void void

View file

@ -72,7 +72,6 @@ SCR_CaptureBGR (void)
tex->height = vid.height; tex->height = vid.height;
tex->format = tex_rgb; tex->format = tex_rgb;
tex->palette = 0; tex->palette = 0;
D_EnableBackBufferAccess ();
src = vid.buffer; src = vid.buffer;
for (y = 0; y < tex->height; y++) { for (y = 0; y < tex->height; y++) {
dst = tex->data + (tex->height - 1 - y) * tex->width * 3; dst = tex->data + (tex->height - 1 - y) * tex->width * 3;
@ -83,7 +82,6 @@ SCR_CaptureBGR (void)
src++; src++;
} }
} }
D_DisableBackBufferAccess ();
return tex; return tex;
} }
@ -95,9 +93,6 @@ SCR_ScreenShot (unsigned width, unsigned height)
int count, dex, dey, dx, dy, nx, r, g, b, x, y, w, h; int count, dex, dey, dx, dy, nx, r, g, b, x, y, w, h;
tex_t *tex; tex_t *tex;
// enable direct drawing of console to back buffer
D_EnableBackBufferAccess ();
w = (vid.width < width) ? vid.width : width; w = (vid.width < width) ? vid.width : width;
h = (vid.height < height) ? vid.height : height; h = (vid.height < height) ? vid.height : height;
@ -145,8 +140,6 @@ SCR_ScreenShot (unsigned width, unsigned height)
*dest++ = MipColor (r, g, b); *dest++ = MipColor (r, g, b);
} }
} }
// for adapters that can't stay mapped in for linear writes all the time
D_DisableBackBufferAccess ();
return tex; return tex;
} }
@ -163,19 +156,12 @@ SCR_ScreenShot_f (void)
va (0, "%s/qf", qfs_gamedir->dir.shots), ".pcx")) { va (0, "%s/qf", qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX"); Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else { } else {
// enable direct drawing of console to back buffer
D_EnableBackBufferAccess ();
// save the pcx file // save the pcx file
pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes, pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes,
vid.basepal, false, &pcx_len); vid.basepal, false, &pcx_len);
QFS_WriteFile (pcxname->str, pcx, pcx_len); QFS_WriteFile (pcxname->str, pcx, pcx_len);
// for adapters that can't stay mapped in for linear writes all the
// time
D_DisableBackBufferAccess ();
Sys_Printf ("Wrote %s/%s\n", qfs_userpath, pcxname->str); Sys_Printf ("Wrote %s/%s\n", qfs_userpath, pcxname->str);
} }
dstring_delete (pcxname); dstring_delete (pcxname);
@ -184,25 +170,13 @@ SCR_ScreenShot_f (void)
void void
R_RenderFrame (SCR_Func *scr_funcs) R_RenderFrame (SCR_Func *scr_funcs)
{ {
vrect_t vrect;
// do 3D refresh drawing, and then update the screen // do 3D refresh drawing, and then update the screen
D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
if (vr_data.scr_fullupdate++ < vid.numpages) { // clear the entire screen if (vr_data.scr_fullupdate++ < vid.numpages) { // clear the entire screen
vr_data.scr_copyeverything = 1; vr_data.scr_copyeverything = 1;
Draw_TileClear (0, 0, vid.width, vid.height); Draw_TileClear (0, 0, vid.width, vid.height);
} }
D_DisableBackBufferAccess (); // for adapters that can't stay mapped
// in for linear writes all the time
VID_LockBuffer ();
R_RenderView (); R_RenderView ();
VID_UnlockBuffer ();
D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
view_draw (vr_data.scr_view); view_draw (vr_data.scr_view);
while (*scr_funcs) { while (*scr_funcs) {
@ -210,9 +184,8 @@ R_RenderFrame (SCR_Func *scr_funcs)
scr_funcs++; scr_funcs++;
} }
D_DisableBackBufferAccess (); // for adapters that can't stay mapped
// in for linear writes all the time
// update one of three areas // update one of three areas
vrect_t vrect;
if (vr_data.scr_copyeverything) { if (vr_data.scr_copyeverything) {
vrect.x = 0; vrect.x = 0;
vrect.y = 0; vrect.y = 0;

View file

@ -522,9 +522,7 @@ R_ScanEdges (void)
// flush the span list if we can't be sure we have enough spans left // flush the span list if we can't be sure we have enough spans left
// for the next scan // for the next scan
if (span_p > max_span_p) { if (span_p > max_span_p) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
if (r_drawculledpolys) if (r_drawculledpolys)
R_DrawCulledPolys (); R_DrawCulledPolys ();

View file

@ -731,9 +731,7 @@ R_EdgeDrawing (void)
} }
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
if (!(r_drawpolys | r_drawculledpolys)) if (!(r_drawpolys | r_drawculledpolys))
@ -773,21 +771,14 @@ R_RenderView_ (void)
// done in screen.c // done in screen.c
R_LowFPPrecision (); R_LowFPPrecision ();
if (!r_worldentity.renderer.model)
Sys_Error ("R_RenderView: NULL worldmodel");
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
R_EdgeDrawing (); R_EdgeDrawing ();
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
if (r_dspeeds->int_val) { if (r_dspeeds->int_val) {

View file

@ -68,12 +68,8 @@ R_TimeRefresh_f (void)
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
r_refdef.viewangles[1] = i / 128.0 * 360.0; r_refdef.viewangles[1] = i / 128.0 * 360.0;
VID_LockBuffer ();
R_RenderView (); R_RenderView ();
VID_UnlockBuffer ();
vr.x = r_refdef.vrect.x; vr.x = r_refdef.vrect.x;
vr.y = r_refdef.vrect.y; vr.y = r_refdef.vrect.y;
vr.width = r_refdef.vrect.width; vr.width = r_refdef.vrect.width;

View file

@ -75,24 +75,12 @@ sw32_D_Init (void)
VID_MakeColormaps(); VID_MakeColormaps();
} }
void
sw32_D_EnableBackBufferAccess (void)
{
VID_LockBuffer ();
}
void void
sw32_D_TurnZOn (void) sw32_D_TurnZOn (void)
{ {
// not needed for software version // not needed for software version
} }
void
sw32_D_DisableBackBufferAccess (void)
{
VID_UnlockBuffer ();
}
void void
sw32_D_SetupFrame (void) sw32_D_SetupFrame (void)
{ {

View file

@ -1224,9 +1224,7 @@ sw32_Draw_FadeScreen (void)
{ {
int x, y; int x, y;
VID_UnlockBuffer ();
S_ExtraUpdate (); S_ExtraUpdate ();
VID_LockBuffer ();
switch(sw32_ctx->pixbytes) { switch(sw32_ctx->pixbytes) {
case 1: case 1:
@ -1269,9 +1267,7 @@ sw32_Draw_FadeScreen (void)
} }
vr_data.scr_copyeverything = 1; vr_data.scr_copyeverything = 1;
VID_UnlockBuffer ();
S_ExtraUpdate (); S_ExtraUpdate ();
VID_LockBuffer ();
} }
void void

View file

@ -1,7 +1,6 @@
#ifdef NH_DEFINE #ifdef NH_DEFINE
#undef NH_DEFINE #undef NH_DEFINE
#define D_CacheSurface sw32_D_CacheSurface #define D_CacheSurface sw32_D_CacheSurface
#define D_DisableBackBufferAccess sw32_D_DisableBackBufferAccess
#define D_DrawParticle sw32_D_DrawParticle #define D_DrawParticle sw32_D_DrawParticle
#define D_DrawPoly sw32_D_DrawPoly #define D_DrawPoly sw32_D_DrawPoly
#define D_DrawSkyScans sw32_D_DrawSkyScans #define D_DrawSkyScans sw32_D_DrawSkyScans
@ -10,7 +9,6 @@
#define D_DrawSurfaces sw32_D_DrawSurfaces #define D_DrawSurfaces sw32_D_DrawSurfaces
#define D_DrawZPoint sw32_D_DrawZPoint #define D_DrawZPoint sw32_D_DrawZPoint
#define D_DrawZSpans sw32_D_DrawZSpans #define D_DrawZSpans sw32_D_DrawZSpans
#define D_EnableBackBufferAccess sw32_D_EnableBackBufferAccess
#define D_FillRect sw32_D_FillRect #define D_FillRect sw32_D_FillRect
#define D_FlushCaches sw32_D_FlushCaches #define D_FlushCaches sw32_D_FlushCaches
#define D_Init sw32_D_Init #define D_Init sw32_D_Init
@ -240,7 +238,6 @@ extern struct surf_s *sw32_surfaces;
#define zspantable sw32_zspantable #define zspantable sw32_zspantable
#else #else
#undef D_CacheSurface #undef D_CacheSurface
#undef D_DisableBackBufferAccess
#undef D_DrawParticle #undef D_DrawParticle
#undef D_DrawPoly #undef D_DrawPoly
#undef D_DrawSkyScans #undef D_DrawSkyScans
@ -249,7 +246,6 @@ extern struct surf_s *sw32_surfaces;
#undef D_DrawSurfaces #undef D_DrawSurfaces
#undef D_DrawZPoint #undef D_DrawZPoint
#undef D_DrawZSpans #undef D_DrawZSpans
#undef D_EnableBackBufferAccess
#undef D_FillRect #undef D_FillRect
#undef D_FlushCaches #undef D_FlushCaches
#undef D_Init #undef D_Init

View file

@ -75,7 +75,6 @@ sw32_SCR_CaptureBGR (void)
tex->height = vid.height; tex->height = vid.height;
tex->format = tex_rgb; tex->format = tex_rgb;
tex->palette = 0; tex->palette = 0;
sw32_D_EnableBackBufferAccess ();
src = vid.buffer; src = vid.buffer;
for (y = 0; y < tex->height; y++) { for (y = 0; y < tex->height; y++) {
dst = tex->data + (tex->height - 1 - y) * tex->width * 3; dst = tex->data + (tex->height - 1 - y) * tex->width * 3;
@ -86,7 +85,6 @@ sw32_SCR_CaptureBGR (void)
src++; src++;
} }
} }
sw32_D_DisableBackBufferAccess ();
return tex; return tex;
} }
@ -108,9 +106,6 @@ sw32_SCR_ScreenShot_f (void)
qfs_gamedir->dir.shots), ".pcx")) { qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX"); Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else { } else {
// enable direct drawing of console to back buffer
sw32_D_EnableBackBufferAccess ();
// save the pcx file // save the pcx file
switch(sw32_ctx->pixbytes) { switch(sw32_ctx->pixbytes) {
case 1: case 1:
@ -127,9 +122,6 @@ sw32_SCR_ScreenShot_f (void)
Sys_Error("SCR_ScreenShot_f: unsupported r_pixbytes %i", sw32_ctx->pixbytes); Sys_Error("SCR_ScreenShot_f: unsupported r_pixbytes %i", sw32_ctx->pixbytes);
} }
// for adapters that can't stay mapped in for linear writes all the time
sw32_D_DisableBackBufferAccess ();
if (pcx) { if (pcx) {
QFS_WriteFile (pcxname->str, pcx, pcx_len); QFS_WriteFile (pcxname->str, pcx, pcx_len);
Sys_Printf ("Wrote %s/%s\n", qfs_userpath, pcxname->str); Sys_Printf ("Wrote %s/%s\n", qfs_userpath, pcxname->str);
@ -143,23 +135,12 @@ sw32_R_RenderFrame (SCR_Func *scr_funcs)
{ {
vrect_t vrect; vrect_t vrect;
// do 3D refresh drawing, and then update the screen
sw32_D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
if (vr_data.scr_fullupdate++ < vid.numpages) { // clear the entire screen if (vr_data.scr_fullupdate++ < vid.numpages) { // clear the entire screen
vr_data.scr_copyeverything = 1; vr_data.scr_copyeverything = 1;
sw32_Draw_TileClear (0, 0, vid.width, vid.height); sw32_Draw_TileClear (0, 0, vid.width, vid.height);
} }
sw32_D_DisableBackBufferAccess (); // for adapters that can't stay mapped
// in for linear writes all the time
VID_LockBuffer ();
sw32_R_RenderView (); sw32_R_RenderView ();
VID_UnlockBuffer ();
sw32_D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
view_draw (vr_data.scr_view); view_draw (vr_data.scr_view);
while (*scr_funcs) { while (*scr_funcs) {
@ -167,8 +148,6 @@ sw32_R_RenderFrame (SCR_Func *scr_funcs)
scr_funcs++; scr_funcs++;
} }
sw32_D_DisableBackBufferAccess (); // for adapters that can't stay mapped
// in for linear writes all the time
// update one of three areas // update one of three areas
if (vr_data.scr_copyeverything) { if (vr_data.scr_copyeverything) {
vrect.x = 0; vrect.x = 0;

View file

@ -503,9 +503,7 @@ sw32_R_ScanEdges (void)
// flush the span list if we can't be sure we have enough spans left // flush the span list if we can't be sure we have enough spans left
// for the next scan // for the next scan
if (span_p > max_span_p) { if (span_p > max_span_p) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
if (sw32_r_drawculledpolys) if (sw32_r_drawculledpolys)
R_DrawCulledPolys (); R_DrawCulledPolys ();

View file

@ -736,9 +736,7 @@ R_EdgeDrawing (void)
} }
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
if (!(sw32_r_drawpolys | sw32_r_drawculledpolys)) if (!(sw32_r_drawpolys | sw32_r_drawculledpolys))
@ -776,21 +774,14 @@ R_RenderView_ (void)
#endif #endif
R_PushDlights (vec3_origin); R_PushDlights (vec3_origin);
if (!r_worldentity.renderer.model)
Sys_Error ("R_RenderView: NULL worldmodel");
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
R_EdgeDrawing (); R_EdgeDrawing ();
if (!r_dspeeds->int_val) { if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
} }
if (r_dspeeds->int_val) { if (r_dspeeds->int_val) {

View file

@ -70,12 +70,8 @@ sw32_R_TimeRefresh_f (void)
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
r_refdef.viewangles[1] = i / 128.0 * 360.0; r_refdef.viewangles[1] = i / 128.0 * 360.0;
VID_LockBuffer ();
sw32_R_RenderView (); sw32_R_RenderView ();
VID_UnlockBuffer ();
vr.x = r_refdef.vrect.x; vr.x = r_refdef.vrect.x;
vr.y = r_refdef.vrect.y; vr.y = r_refdef.vrect.y;
vr.width = r_refdef.vrect.width; vr.width = r_refdef.vrect.width;
@ -289,11 +285,6 @@ sw32_R_SetupFrame (void)
sw32_R_ViewChanged (); sw32_R_ViewChanged ();
} }
} else { } else {
vrect.x = 0;
vrect.y = 0;
vrect.width = vid.width;
vrect.height = vid.height;
r_refdef.vrect.x = vr_data.scr_view->xpos; r_refdef.vrect.x = vr_data.scr_view->xpos;
r_refdef.vrect.y = vr_data.scr_view->ypos; r_refdef.vrect.y = vr_data.scr_view->ypos;
r_refdef.vrect.width = vr_data.scr_view->xlen; r_refdef.vrect.width = vr_data.scr_view->xlen;

View file

@ -525,16 +525,6 @@ VID_Update (vrect_t *rects)
} }
} }
void
VID_LockBuffer (void)
{
}
void
VID_UnlockBuffer (void)
{
}
void void
VID_SetCaption (const char *text) VID_SetCaption (const char *text)
{ {

View file

@ -156,13 +156,3 @@ D_EndDirectRect (int x, int y, int width, int height)
x = sdl_screen->w + x - 1; x = sdl_screen->w + x - 1;
SDL_UpdateRect (sdl_screen, x, y, width, height); SDL_UpdateRect (sdl_screen, x, y, width, height);
} }
void
VID_LockBuffer (void)
{
}
void
VID_UnlockBuffer (void)
{
}

View file

@ -462,16 +462,6 @@ VID_Update (vrect_t *rects)
} }
} }
void
VID_LockBuffer (void)
{
}
void
VID_UnlockBuffer (void)
{
}
void void
VID_SetCaption (const char *text) VID_SetCaption (const char *text)
{ {

View file

@ -154,16 +154,6 @@ VID_Init_Cvars (void)
Win_GL_Init_Cvars (); Win_GL_Init_Cvars ();
} }
void
VID_LockBuffer (void)
{
}
void
VID_UnlockBuffer (void)
{
}
void void
VID_SetCaption (const char *text) VID_SetCaption (const char *text)
{ {

View file

@ -167,16 +167,6 @@ update ()
} }
#endif #endif
void
VID_LockBuffer (void)
{
}
void
VID_UnlockBuffer (void)
{
}
void void
VID_SetCaption (const char *text) VID_SetCaption (const char *text)
{ {