Msaa #11
No files matched your search
@@ -234,6 +234,8 @@ enum hwdsetspecialstate
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||
|
||||
HWD_SET_MSAA,
|
||||
|
||||
HWD_SET_SCREEN_TEXTURES,
|
||||
|
||||
|
||||
+55
-46
@@ -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"
|
||||
@@ -109,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)
|
||||
@@ -438,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);
|
||||
|
||||
@@ -820,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
|
||||
@@ -874,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;
|
||||
|
||||
@@ -1630,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;
|
||||
@@ -1657,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);
|
||||
}
|
||||
@@ -1698,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,
|
||||
@@ -1724,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;
|
||||
|
||||
@@ -1759,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:
|
||||
@@ -1965,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
|
||||
@@ -1978,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)
|
||||
|
||||
@@ -2155,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)
|
||||
|
||||
@@ -2426,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))
|
||||
@@ -2443,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.
|
||||
@@ -2514,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)
|
||||
@@ -3068,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;
|
||||
@@ -3325,7 +3326,7 @@ void HWR_Subsector(size_t num)
|
||||
++numpolys;
|
||||
po = (polyobj_t *)(po->link.next);
|
||||
}
|
||||
|
||||
|
||||
// for performance stats
|
||||
ps_numpolyobjects.value.i += numpolys;
|
||||
|
||||
@@ -3448,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?
|
||||
@@ -3469,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;
|
||||
@@ -4419,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;
|
||||
@@ -4629,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++)
|
||||
@@ -4649,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
|
||||
@@ -4693,7 +4694,7 @@ void HWR_RenderDrawNodes(void)
|
||||
run_start++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PS_STOP_TIMING(ps_hw_nodesorttime);
|
||||
|
||||
PS_START_TIMING(ps_hw_nodedrawtime);
|
||||
@@ -4732,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;
|
||||
@@ -4943,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
|
||||
@@ -4953,7 +4954,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
angle_t sliptiderollangle = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
@@ -4969,7 +4970,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
{
|
||||
R_InterpolateMobjState(thing, FRACUNIT, &interp);
|
||||
}
|
||||
|
||||
|
||||
if (interp.spritexscale < 1 || interp.spriteyscale < 1)
|
||||
return;
|
||||
|
||||
@@ -5078,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;
|
||||
@@ -5094,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);
|
||||
|
||||
@@ -5104,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;
|
||||
}
|
||||
@@ -5202,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;
|
||||
@@ -5215,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;
|
||||
|
||||
|
||||
@@ -5253,7 +5254,7 @@ void HWR_ProjectSprite(mobj_t *thing)
|
||||
|
||||
// set top/bottom coords
|
||||
vis->ty = gzt;
|
||||
|
||||
|
||||
vis->gzt = gzt;
|
||||
vis->gz = gz;
|
||||
|
||||
@@ -5390,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);
|
||||
|
||||
@@ -5483,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;
|
||||
@@ -5574,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);
|
||||
*/
|
||||
@@ -5704,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,
|
||||
@@ -5912,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);
|
||||
@@ -5921,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;
|
||||
@@ -6025,6 +6026,14 @@ void HWR_Startup(void)
|
||||
HWD.pfnKillShaders();
|
||||
if (!HWD.pfnLoadShaders())
|
||||
gr_shadersavailable = false;
|
||||
|
||||
if (msaa)
|
||||
{
|
||||
if (a2c)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 2);
|
||||
else
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+100
-22
@@ -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);
|
||||
@@ -107,6 +115,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,8 +1784,16 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
flags |= SDL_WINDOW_OPENGL;
|
||||
|
||||
}
|
||||
|
||||
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.
|
||||
@@ -1956,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
|
||||
@@ -1990,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)
|
||||
@@ -2004,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
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user