[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_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_PolysetDraw (void);
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
@ -155,7 +154,6 @@ void D_DrawPoly (void);
void D_DrawSprite (void);
void D_DrawSurfaces (void);
void D_DrawZPoint (void);
void D_EnableBackBufferAccess (void);
void D_Init (void);
void D_Init_Cvars (void);
void D_ViewChanged (void);

View file

@ -105,7 +105,7 @@ typedef struct surf_s {
qboolean insubmodel;
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;
extern surf_t *surfaces, *surface_p, *surf_max;

View file

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

View file

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

View file

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

View file

@ -72,7 +72,6 @@ SCR_CaptureBGR (void)
tex->height = vid.height;
tex->format = tex_rgb;
tex->palette = 0;
D_EnableBackBufferAccess ();
src = vid.buffer;
for (y = 0; y < tex->height; y++) {
dst = tex->data + (tex->height - 1 - y) * tex->width * 3;
@ -83,7 +82,6 @@ SCR_CaptureBGR (void)
src++;
}
}
D_DisableBackBufferAccess ();
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;
tex_t *tex;
// enable direct drawing of console to back buffer
D_EnableBackBufferAccess ();
w = (vid.width < width) ? vid.width : width;
h = (vid.height < height) ? vid.height : height;
@ -145,8 +140,6 @@ SCR_ScreenShot (unsigned width, unsigned height)
*dest++ = MipColor (r, g, b);
}
}
// for adapters that can't stay mapped in for linear writes all the time
D_DisableBackBufferAccess ();
return tex;
}
@ -163,19 +156,12 @@ SCR_ScreenShot_f (void)
va (0, "%s/qf", qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else {
// enable direct drawing of console to back buffer
D_EnableBackBufferAccess ();
// save the pcx file
pcx = EncodePCX (vid.buffer, vid.width, vid.height, vid.rowbytes,
vid.basepal, false, &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);
}
dstring_delete (pcxname);
@ -184,25 +170,13 @@ SCR_ScreenShot_f (void)
void
R_RenderFrame (SCR_Func *scr_funcs)
{
vrect_t vrect;
// 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
vr_data.scr_copyeverything = 1;
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 ();
VID_UnlockBuffer ();
D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
view_draw (vr_data.scr_view);
while (*scr_funcs) {
@ -210,9 +184,8 @@ R_RenderFrame (SCR_Func *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
vrect_t vrect;
if (vr_data.scr_copyeverything) {
vrect.x = 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
// for the next scan
if (span_p > max_span_p) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
if (r_drawculledpolys)
R_DrawCulledPolys ();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -75,7 +75,6 @@ sw32_SCR_CaptureBGR (void)
tex->height = vid.height;
tex->format = tex_rgb;
tex->palette = 0;
sw32_D_EnableBackBufferAccess ();
src = vid.buffer;
for (y = 0; y < tex->height; y++) {
dst = tex->data + (tex->height - 1 - y) * tex->width * 3;
@ -86,7 +85,6 @@ sw32_SCR_CaptureBGR (void)
src++;
}
}
sw32_D_DisableBackBufferAccess ();
return tex;
}
@ -108,9 +106,6 @@ sw32_SCR_ScreenShot_f (void)
qfs_gamedir->dir.shots), ".pcx")) {
Sys_Printf ("SCR_ScreenShot_f: Couldn't create a PCX");
} else {
// enable direct drawing of console to back buffer
sw32_D_EnableBackBufferAccess ();
// save the pcx file
switch(sw32_ctx->pixbytes) {
case 1:
@ -127,9 +122,6 @@ sw32_SCR_ScreenShot_f (void)
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) {
QFS_WriteFile (pcxname->str, pcx, pcx_len);
Sys_Printf ("Wrote %s/%s\n", qfs_userpath, pcxname->str);
@ -143,23 +135,12 @@ sw32_R_RenderFrame (SCR_Func *scr_funcs)
{
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
vr_data.scr_copyeverything = 1;
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 ();
VID_UnlockBuffer ();
sw32_D_EnableBackBufferAccess (); // of all overlay stuff if drawing
// directly
view_draw (vr_data.scr_view);
while (*scr_funcs) {
@ -167,8 +148,6 @@ sw32_R_RenderFrame (SCR_Func *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
if (vr_data.scr_copyeverything) {
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
// for the next scan
if (span_p > max_span_p) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
if (sw32_r_drawculledpolys)
R_DrawCulledPolys ();

View file

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

View file

@ -70,12 +70,8 @@ sw32_R_TimeRefresh_f (void)
for (i = 0; i < 128; i++) {
r_refdef.viewangles[1] = i / 128.0 * 360.0;
VID_LockBuffer ();
sw32_R_RenderView ();
VID_UnlockBuffer ();
vr.x = r_refdef.vrect.x;
vr.y = r_refdef.vrect.y;
vr.width = r_refdef.vrect.width;
@ -289,11 +285,6 @@ sw32_R_SetupFrame (void)
sw32_R_ViewChanged ();
}
} 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.y = vr_data.scr_view->ypos;
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
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;
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
VID_SetCaption (const char *text)
{

View file

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

View file

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