From 3bcbee7f73afaf6219b174ca2e0c197f94aa9ce5 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Mon, 31 Jul 2023 19:40:30 +0200 Subject: [PATCH 1/3] MSAA support, Alpha to coverage support Port from Birdhouse - msaa is enabled with command line parameter -msaa - alpha to coverage is enabled with parameter -a2c - note: a2c has issues with transparent surfaces becoming less opaque Need to find a way to make it toggable from cvar/menu somehow See: https://git.do.srb2.org/bird/Kart-Public/-/commit/6de9344875ff5d1b140cc4345cf155a15cc1102f --- src/hardware/hw_defs.h | 2 ++ src/hardware/hw_main.c | 9 +++++++++ src/hardware/r_opengl/r_opengl.c | 9 +++++++++ src/sdl/i_video.c | 16 ++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index f242576cd..294e4e791 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -234,6 +234,8 @@ enum hwdsetspecialstate HWD_SET_TEXTUREFILTERMODE, HWD_SET_TEXTUREANISOTROPICMODE, + + HWD_SET_MSAA, HWD_SET_SCREEN_TEXTURES, diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index a4e257117..2065b20f8 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -41,6 +41,7 @@ #include "../st_stuff.h" #include "../i_system.h" #include "../m_cheat.h" +#include "../m_argv.h" // parm functions for msaa #ifdef ESLOPE #include "../p_slopes.h" @@ -6025,6 +6026,14 @@ void HWR_Startup(void) HWD.pfnKillShaders(); if (!HWD.pfnLoadShaders()) gr_shadersavailable = false; + + if (M_CheckParm("-msaa")) + { + if (M_CheckParm("-a2c")) + HWD.pfnSetSpecialState(HWD_SET_MSAA, 2); + else + HWD.pfnSetSpecialState(HWD_SET_MSAA, 1); + } } diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index a12962008..9c8074f56 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2735,6 +2735,15 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) } Flush(); //??? if we want to change filter mode by texture, remove this break; + + case HWD_SET_MSAA: + if (Value) + { + pglEnable(GL_MULTISAMPLE); + if (Value == 2) + pglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE); + } + break; case HWD_SET_TEXTUREANISOTROPICMODE: anisotropic_filter = min(Value,maximumAnisotropy); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index d18d6652e..712b4da4e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -107,6 +107,10 @@ static void Impl_SetVsync(void); consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +// these cant be used since config is read after window creation, so need to use command line parameter instead +//static CV_PossibleValue_t msaa_cons_t[] = {{0, "Off"}, {2, "2X"}, {4, "4X"}, {8, "8X"}, {16, "16X"}, {0, NULL}}; +//consvar_t cv_msaa = {"msaa", "Off", CV_SAVE, msaa_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + UINT8 graphics_started = 0; // Is used in console.c and screen.c // To disable fullscreen at startup; is set in VID_PrepareModeList @@ -1772,7 +1776,19 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) #ifdef HWRENDER if (rendermode == render_opengl) + { flags |= SDL_WINDOW_OPENGL; + if (M_CheckParm("-msaa") && M_IsNextParm()) + { + unsigned int value; + const char* str = M_GetNextParm(); + if (sscanf(str, "%u", &value)) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, value); + } + } + } // Without a 24-bit depth buffer many visuals are ruined by z-fighting. // Some GPU drivers may give us a 16-bit depth buffer since the -- 2.54.0 From 826549be4c30651403da3fbce982a1448e361e9a Mon Sep 17 00:00:00 2001 From: Indev Date: Tue, 1 Aug 2023 13:31:50 +0300 Subject: [PATCH 2/3] Make MSAA and A2C configurable in renderer.txt --- src/hardware/hw_main.c | 98 ++++++++++++++++---------------- src/hardware/hw_main.h | 3 + src/sdl/i_video.c | 126 ++++++++++++++++++++++++++++++----------- 3 files changed, 146 insertions(+), 81 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2065b20f8..0221aa4d4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -110,7 +110,7 @@ static INT32 current_bsp_culling_distance = 0; // - full screen scaling (use native resolution or windowed mode to avoid this) consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; - + consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; static void CV_filtermode_ONChange(void) @@ -439,7 +439,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col poly_color.s.green = (UINT8)green; poly_color.s.blue = (UINT8)blue; } - + // Clamp the light level, since it can sometimes go out of the 0-255 range from animations light_level = min(max(light_level, 0), 255); @@ -821,14 +821,14 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend HWR_Lighting(pSurf, lightlevel, wallcolormap); HWD.pfnSetShader(2); // wall shader - + // don't draw to color buffer when drawing to stencil if (gl_drawing_stencil) { blendmode |= PF_Invisible|PF_NoAlphaTest; // TODO not sure if any others than PF_Invisible are needed?? blendmode &= ~PF_Masked; } - + HWD.pfnDrawPolygon(pSurf, wallVerts, 4, blendmode|PF_Modulated|PF_Occlude); #ifdef WALLSPLATS @@ -875,7 +875,7 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa pegt = wallVerts[3].t; pegb = wallVerts[0].t; pegmul = (pegb - pegt) / (top - bot); - + if (fpclassify(pegmul) == FP_NAN) pegmul = 0.0; @@ -1631,7 +1631,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom } else repeats = 1; - + fixed_t midtexheight = textureheight[gr_midtexture] * repeats; fixed_t popentop, popenbottom, polytop, polybottom, lowcut, highcut; fixed_t popentopslope, popenbottomslope, polytopslope, polybottomslope, lowcutslope, highcutslope; @@ -1658,7 +1658,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom #ifdef ESLOPE popentop = min(worldtop, worldhigh); popenbottom = max(worldbottom, worldlow); - + popentopslope = min(worldtopslope, worldhighslope); popenbottomslope = max(worldbottomslope, worldlowslope); } @@ -1699,7 +1699,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom polytopslope = popentopslope + gr_sidedef->rowoffset; polybottomslope = polytopslope - midtexheight; } - + // CB #ifdef POLYOBJECTS // NOTE: With polyobjects, whenever you need to check the properties of the polyobject sector it belongs to, @@ -1725,7 +1725,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom l = max(polybottom, lowcut); hS = min(highcutslope, polytopslope); lS = max(polybottomslope, lowcutslope); - + // PEGGING fixed_t texturevpeg, texturevpegslope; @@ -1760,7 +1760,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom // set alpha for transparent walls (new boom and legacy linedef types) FBITFIELD blendmode; - + switch (gr_linedef->special) { case 900: @@ -1966,7 +1966,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!gl_drawing_stencil && gr_frontsector && gr_backsector && gr_frontsector->tag != gr_backsector->tag && (gr_backsector->ffloors || gr_frontsector->ffloors)) { ffloor_t * rover; - fixed_t highcut = 0, lowcut = 0; + fixed_t highcut = 0, lowcut = 0; fixed_t lowcutslope, highcutslope; // Used for height comparisons and etc across FOFs and slopes @@ -1979,14 +1979,14 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom highcut = min(worldtop, worldhigh); lowcutslope = max(worldbottomslope, worldlowslope); highcutslope = min(worldtopslope, worldhighslope); - + if (gr_backsector->ffloors) { for (rover = gr_backsector->ffloors; rover; rover = rover->next) { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || (rover->flags & FF_INVERTSIDES)) continue; - + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) @@ -2156,7 +2156,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom { if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_ALLSIDES)) continue; - + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) @@ -2427,7 +2427,7 @@ void HWR_AddLine(seg_t *line) static sector_t tempsec; fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t - + boolean dont_draw = false; #ifdef POLYOBJECTS if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES)) @@ -2444,7 +2444,7 @@ void HWR_AddLine(seg_t *line) // OPTIMIZE: quickly reject orthogonal back sides. angle1 = R_PointToAngle64(v1x, v1y); angle2 = R_PointToAngle64(v2x, v2y); - + // do an extra culling check when rendering portals // check if any line vertex is on the viewable side of the portal target line // if not, the line can be culled. @@ -2515,7 +2515,7 @@ void HWR_AddLine(seg_t *line) checkforemptylines = true; gr_backsector = line->backsector; - + // Portal line /* if (cv_grportals.value && line->linedef->special == 40 && line->side == 0) @@ -3069,7 +3069,7 @@ void HWR_Subsector(size_t num) gr_frontsector = R_FakeFlat(gr_frontsector, &tempsec, &floorlightlevel, &ceilinglightlevel, false); //FIXME: Use floorlightlevel and ceilinglightlevel insted of lightlevel. - + if (gr_portal == GRPORTAL_SEARCH) { skipSprites = true; @@ -3326,7 +3326,7 @@ void HWR_Subsector(size_t num) ++numpolys; po = (polyobj_t *)(po->link.next); } - + // for performance stats ps_numpolyobjects.value.i += numpolys; @@ -3449,7 +3449,7 @@ void HWR_RenderBSPNode(INT32 bspnum) // Decide which side the view point is on INT32 side; - + ps_numbspcalls.value.i++; // Found a subsector? @@ -3470,7 +3470,7 @@ void HWR_RenderBSPNode(INT32 bspnum) HWR_Subsector(bspnum&(~NF_SUBSECTOR)); return; } - + // in portal checking phase we can stop after one is found //if (gr_portal == GRPORTAL_FOUND) // return; @@ -4420,10 +4420,10 @@ static int CompareVisSprites(const void *p1, const void *p2) gr_vissprite_t* spr2 = *(gr_vissprite_t*const*)p2; int idiff; float fdiff; - + // make transparent sprites last // "boolean to int" - + int transparency1 = (spr1->mobj->flags2 & MF2_SHADOW) || (spr1->mobj->frame & FF_TRANSMASK); int transparency2 = (spr2->mobj->flags2 & MF2_SHADOW) || (spr2->mobj->frame & FF_TRANSMASK); idiff = transparency1 - transparency2; @@ -4630,7 +4630,7 @@ void HWR_RenderDrawNodes(void) // However, in reality we shouldn't be re-copying and shifting all this information // that is already lying around. This should all be in some sort of linked list or lists. sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL); - + PS_START_TIMING(ps_hw_nodesorttime); for (i = 0; i < numplanes; i++, p++) @@ -4650,7 +4650,7 @@ void HWR_RenderDrawNodes(void) sortnode[p].wall = &wallinfo[i]; sortindex[p] = p; } - + ps_numdrawnodes.value.i = p; // p is the number of stuff to sort @@ -4694,7 +4694,7 @@ void HWR_RenderDrawNodes(void) run_start++; } } - + PS_STOP_TIMING(ps_hw_nodesorttime); PS_START_TIMING(ps_hw_nodedrawtime); @@ -4733,7 +4733,7 @@ void HWR_RenderDrawNodes(void) sortnode[sortindex[i]].wall->lightlevel, sortnode[sortindex[i]].wall->wallcolormap); } } - + PS_STOP_TIMING(ps_hw_nodedrawtime); numwalls = 0; @@ -4944,7 +4944,7 @@ void HWR_ProjectSprite(mobj_t *thing) const boolean papersprite = (thing->frame & FF_PAPERSPRITE); INT32 heightsec, phs; vector3_t pos; - + fixed_t spr_width, spr_height; fixed_t spr_offset, spr_topoffset; #ifdef ROTSPRITE @@ -4954,7 +4954,7 @@ void HWR_ProjectSprite(mobj_t *thing) angle_t sliptiderollangle = 0; #endif - + // uncapped/interpolation interpmobjstate_t interp = {0}; @@ -4970,7 +4970,7 @@ void HWR_ProjectSprite(mobj_t *thing) { R_InterpolateMobjState(thing, FRACUNIT, &interp); } - + if (interp.spritexscale < 1 || interp.spriteyscale < 1) return; @@ -5079,7 +5079,7 @@ void HWR_ProjectSprite(mobj_t *thing) if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)thing->skin)->highresscale); - + spr_width = spritecachedinfo[lumpoff].width; spr_height = spritecachedinfo[lumpoff].height; spr_offset = spritecachedinfo[lumpoff].offset; @@ -5095,7 +5095,7 @@ void HWR_ProjectSprite(mobj_t *thing) } else rollsum = (thing->rollangle)+(thing->sloperoll); - + rollangle = R_GetRollAngle(rollsum); rotsprite = Patch_GetRotatedSprite(sprframe, (thing->frame & FF_FRAMEMASK), rot, flip, sprinfo, rollangle); @@ -5105,7 +5105,7 @@ void HWR_ProjectSprite(mobj_t *thing) spr_height = rotsprite->height << FRACBITS; spr_offset = rotsprite->leftoffset << FRACBITS; spr_topoffset = rotsprite->topoffset << FRACBITS; - spr_topoffset += FEETADJUST; + spr_topoffset += FEETADJUST; // flip -> rotate, not rotate -> flip flip = 0; } @@ -5203,7 +5203,7 @@ void HWR_ProjectSprite(mobj_t *thing) vis->tz = tz; // Keep tz for the simple sprite sorting that happens vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST vis->flip = flip; - + vis->scale = this_scale; vis->spritexscale = spritexscale; vis->spriteyscale = spriteyscale; @@ -5216,7 +5216,7 @@ void HWR_ProjectSprite(mobj_t *thing) else #endif vis->gpatch = (GLPatch_t *)W_CachePatchNum(sprframe->lumppat[rot], PU_CACHE); - + vis->mobj = thing; @@ -5254,7 +5254,7 @@ void HWR_ProjectSprite(mobj_t *thing) // set top/bottom coords vis->ty = gzt; - + vis->gzt = gzt; vis->gz = gz; @@ -5391,7 +5391,7 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) // set top/bottom coords vis->ty = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset); - + vis->gzt = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset); vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height); @@ -5484,7 +5484,7 @@ void HWR_SetTransform(float fpov, player_t *player) { postimg_t *postprocessor = &postimgtype[0]; INT32 i; - + // copy view cam position for local use dup_viewx = viewx; dup_viewy = viewy; @@ -5575,7 +5575,7 @@ void HWR_PortalClipping(portal_t *portal) v1y = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv1)->y); v2x = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv2)->x); v2y = FLOAT_TO_FIXED(((polyvertex_t *)seg->pv2)->y); - + angle1 = R_PointToAngleEx(viewx, viewy, v1x, v1y); angle2 = R_PointToAngleEx(viewx, viewy, v2x, v2y); */ @@ -5705,19 +5705,19 @@ void RecursivePortalRendering(portal_t *rootportal, const float fpov, player_t * validcount++; if (cv_grbatching.value) HWD.pfnStartBatching(); - + ps_numbspcalls.value.i = 0; ps_numpolyobjects.value.i = 0; PS_START_TIMING(ps_bsptime); if (!rootportal && portallist.base && !skybox)// if portals have been drawn in the main view, then render skywalls differently gr_collect_skywalls = true; - - // Recursively "render" the BSP tree. + + // Recursively "render" the BSP tree. HWR_RenderBSPNode((INT32)numnodes-1); - + PS_STOP_TIMING(ps_bsptime); - + if (cv_grbatching.value) { HWD.pfnRenderBatches(&ps_hw_batchsorttime.value.p, &ps_hw_batchdrawtime.value.p, @@ -5913,7 +5913,7 @@ void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, play // Render the BSP from the new viewpoint. portalcullsector = gr_portalcullsectors[portalnum]; HWR_RenderBSPNode((INT32)numnodes - 1); - + // Draw MD2 and sprites ps_numsprites.value.i = gr_visspritecount; PS_START_TIMING(ps_hw_spritesorttime); @@ -5922,7 +5922,7 @@ void HWR_RenderSinglePortal(portal_t *portal, size_t portalnum, float fpov, play PS_START_TIMING(ps_hw_spritedrawtime); HWR_DrawSprites(); PS_STOP_TIMING(ps_hw_spritedrawtime); - + ps_numdrawnodes.value.i = 0; ps_hw_nodesorttime.value.p = 0; ps_hw_nodedrawtime.value.p = 0; @@ -6026,10 +6026,10 @@ void HWR_Startup(void) HWD.pfnKillShaders(); if (!HWD.pfnLoadShaders()) gr_shadersavailable = false; - - if (M_CheckParm("-msaa")) + + if (msaa) { - if (M_CheckParm("-a2c")) + if (a2c) HWD.pfnSetSpecialState(HWD_SET_MSAA, 2); else HWD.pfnSetSpecialState(HWD_SET_MSAA, 1); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index c49e384b2..ef461a094 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -41,6 +41,9 @@ extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy extern float gr_basewindowcenterx, gr_basewindowcentery; +extern unsigned msaa; +extern boolean a2c; + extern FTransform atransform; // Performance stats diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 712b4da4e..30eab8711 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -99,6 +99,14 @@ static char vidModeName[33][32]; // allow 33 different modes rendermode_t rendermode = render_none; +#ifdef HWRENDER +unsigned msaa = 0; + +// Eee probably the way i organize it isn't best >< +// Just don't know where do i put declaration and "implementation" +boolean a2c = false; +#endif + boolean highcolor = false; static void Impl_SetVsync(void); @@ -1778,18 +1786,14 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen) if (rendermode == render_opengl) { flags |= SDL_WINDOW_OPENGL; - if (M_CheckParm("-msaa") && M_IsNextParm()) - { - unsigned int value; - const char* str = M_GetNextParm(); - if (sscanf(str, "%u", &value)) - { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, value); - } - } + } + + if (msaa) + { + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa); } - + // Without a 24-bit depth buffer many visuals are ruined by z-fighting. // Some GPU drivers may give us a 16-bit depth buffer since the // default value for SDL_GL_DEPTH_SIZE is 16. @@ -1972,32 +1976,84 @@ void I_StartupGraphics(void) rendermode = render_opengl; #endif - if (rendermode == render_none) - { -#ifdef HWRENDER + msaa = 0; boolean msaa_set = false; + a2c = false; boolean a2c_set = false; + + if (M_CheckParm("-msaa") && M_IsNextParm()) + { + const char* str = M_GetNextParm(); + if (sscanf(str, "%u", &msaa)) + { + msaa_set = true; + } + } + + if (M_CheckParm("-a2c")) + { + a2c = true; + a2c_set = true; + } + else if (M_CheckParm("-noa2c")) + { + a2c_set = true; + } + + { char line[16]; char * word; FILE * file = OpenRendererFile("r"); if (file != NULL) { - if (fgets(line, sizeof line, file) != NULL) +#ifdef HWRENDER + while (fgets(line, sizeof line, file) != NULL) { - word = strtok(line, "\n"); + word = strtok(line, " \n"); - if (strcasecmp(word, "software") == 0) - { - rendermode = render_soft; - } - else if (strcasecmp(word, "opengl") == 0) - { - rendermode = render_opengl; - } + if (rendermode == render_none) + { + if (strcasecmp(word, "software") == 0) + { + rendermode = render_soft; + } + else if (strcasecmp(word, "opengl") == 0) + { + rendermode = render_opengl; + } + + if (rendermode != render_none) + { + CONS_Printf("Using last known renderer: %s\n", line); + } + } + + if (!msaa_set) + { + if (strcasecmp(word, "msaa") == 0) + { + const char *nextword = strtok(NULL, " \n"); + + if (!nextword || !sscanf(nextword, "%u", &msaa)) + { + CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n"); + } + else + { + CONS_Printf("Using last know MSAA value: %u\n", msaa); + } + } + } + + if (!a2c_set) + { + if (strcasecmp(word, "a2c") == 0) + { + a2c = true; + + CONS_Printf("Using a2c because it was specified to be used earlier\n"); + } + } + } - if (rendermode != render_none) - { - CONS_Printf("Using last known renderer: %s\n", line); - } - } fclose(file); } #endif @@ -2006,8 +2062,8 @@ void I_StartupGraphics(void) rendermode = render_soft; CONS_Printf("Using default software renderer.\n"); } - } - else + } + { FILE * file = OpenRendererFile("w"); if (file != NULL) @@ -2020,7 +2076,13 @@ void I_StartupGraphics(void) { fputs("opengl\n", file); } - fclose(file); + + fprintf(file, "msaa %u\n", msaa); + + if (a2c) + fputs("a2c\n", file); + + fclose(file); } else { -- 2.54.0 From a9c1e50cf88abd1792eb22299d4af8fcf153b654 Mon Sep 17 00:00:00 2001 From: xyzzy Date: Wed, 2 Aug 2023 15:12:53 +0300 Subject: [PATCH 3/3] Add missing files to .gitignore --- .gitignore | 4 +++- assets/.gitignore | 1 + src/CMakeLists.txt | 8 ++++++++ src/sdl/CMakeLists.txt | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 797ea03df..8b73f04f5 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ Win32_LIB_ASM_Release /assets/debian compile.sh *.gz -.vscode/ \ No newline at end of file +.vscode/ +out +build diff --git a/assets/.gitignore b/assets/.gitignore index b9dc7c70d..52c1d72f4 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -10,3 +10,4 @@ !LICENSE-3RD-PARTY.txt !CMakeLists.txt !debian-template/* +installer diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index db19cbe81..e4eb9f134 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,7 @@ set(SRB2_CORE_SOURCES d_net.c d_netcmd.c d_netfil.c + d_protocol.c dehacked.c f_finale.c f_wipe.c @@ -31,6 +32,7 @@ set(SRB2_CORE_SOURCES m_fixed.c m_menu.c m_misc.c + m_perfstats.c m_queue.c m_random.c md5.c @@ -61,6 +63,7 @@ set(SRB2_CORE_HEADERS d_netcmd.h d_netfil.h d_player.h + d_protocol.h d_think.h d_ticcmd.h dehacked.h @@ -97,6 +100,7 @@ set(SRB2_CORE_HEADERS m_menu.h m_misc.h m_queue.h + m_perfstats.h m_random.h m_swap.h md5.h @@ -121,6 +125,7 @@ set(SRB2_CORE_RENDER_SOURCES r_draw.c r_fps.c r_main.c + r_patch.c r_plane.c r_segs.c r_sky.c @@ -134,6 +139,7 @@ set(SRB2_CORE_RENDER_SOURCES r_fps.h r_local.h r_main.h + r_patch r_plane.h r_segs.h r_sky.h @@ -261,6 +267,7 @@ if(${SRB2_CONFIG_HAVE_BLUA}) lua_script.c lua_skinlib.c lua_thinkerlib.c + lua_udatalib.c ) set(SRB2_LUA_HEADERS lua_hook.h @@ -268,6 +275,7 @@ if(${SRB2_CONFIG_HAVE_BLUA}) lua_hudlib_drawlist.h lua_libs.h lua_script.h + lua_udatalib.h ) prepend_sources(SRB2_LUA_SOURCES) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b20adb096..67df4a646 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -274,16 +274,16 @@ if(${SDL2_FOUND}) ) ## strip debug symbols into separate file when using gcc - if(CMAKE_COMPILER_IS_GNUCC) - if(${CMAKE_BUILD_TYPE} MATCHES Debug) - message(STATUS "Will make separate debug symbols in *.debug") - add_custom_command(TARGET SRB2SDL2 POST_BUILD - COMMAND ${OBJCOPY} --only-keep-debug $ $.debug - COMMAND ${OBJCOPY} --strip-debug $ - COMMAND ${OBJCOPY} --add-gnu-debuglink=$.debug $ - ) - endif() - endif() + # if(CMAKE_COMPILER_IS_GNUCC) + # if(${CMAKE_BUILD_TYPE} MATCHES Debug) + # message(STATUS "Will make separate debug symbols in *.debug") + # add_custom_command(TARGET SRB2SDL2 POST_BUILD + # COMMAND ${OBJCOPY} --only-keep-debug $ $.debug + # COMMAND ${OBJCOPY} --strip-debug $ + # COMMAND ${OBJCOPY} --add-gnu-debuglink=$.debug $ + # ) + # endif() + # endif() #### Installation #### if(${CMAKE_SYSTEM} MATCHES Darwin) -- 2.54.0