Adds r_pr_ati_nodepthoffset and the proper detection code to winlayer and sdlayer to make polymer run properly on R520-class Radeon chips. A bug needs to be filed to AMD.

git-svn-id: https://svn.eduke32.com/eduke32@1446 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2009-06-28 21:16:11 +00:00
parent 9556762493
commit 5cdc55591b
5 changed files with 21 additions and 5 deletions

View file

@ -52,6 +52,7 @@ extern int32_t pr_overridespecular;
extern float pr_specularpower;
extern float pr_specularfactor;
extern int32_t pr_ati_fboworkaround;
extern int32_t pr_ati_nodepthoffset;
extern int32_t r_pr_maxlightpasses;

View file

@ -28,6 +28,7 @@ int32_t pr_overridespecular = 0;
float pr_specularpower = 15.0f;
float pr_specularfactor = 1.0f;
int32_t pr_ati_fboworkaround = 0;
int32_t pr_ati_nodepthoffset = 0;
int32_t r_pr_maxlightpasses = 5; // value of the cvar (not live value), used to detect changes
@ -1105,12 +1106,12 @@ void polymer_drawsprite(int32_t snum)
if ((tspr->cstat & 64) && ((tspr->cstat>>4) & 3))
bglEnable(GL_CULL_FACE);
if (!depth || mirrors[depth-1].plane)
if (!pr_ati_nodepthoffset && (!depth || mirrors[depth-1].plane))
bglEnable(GL_POLYGON_OFFSET_FILL);
polymer_drawplane(&spriteplane);
if (!depth || mirrors[depth-1].plane)
if (!pr_ati_nodepthoffset && (!depth || mirrors[depth-1].plane))
bglDisable(GL_POLYGON_OFFSET_FILL);
if ((tspr->cstat & 64) && ((tspr->cstat>>4) & 3))

View file

@ -5998,6 +5998,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 },
{ "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 },
{ "r_pr_ati_fboworkaround", "r_pr_ati_fboworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void*)&pr_ati_fboworkaround, CVAR_BOOL | CVAR_NOSAVE, 0, 0, 1 },
{ "r_pr_ati_nodepthoffset", "r_pr_ati_nodepthoffset: enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void*)&pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 0, 1 },
#endif
{ "r_models","r_models: enable/disable model rendering",(void *)&usemodels, CVAR_BOOL, 0, 0, 1 },

View file

@ -1118,7 +1118,14 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) {
pr_ati_fboworkaround = 1;
initprintf("Enabling ATI FBO color attachment workaround.\n");
} else pr_ati_fboworkaround = 0;
if (!Bstrncmp(glinfo.renderer,"Radeon X1", 9)) {
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
} else
pr_ati_nodepthoffset = 0;
} else
pr_ati_fboworkaround = 0;
#endif

View file

@ -3389,8 +3389,14 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
if (!Bstrcmp(glinfo.vendor,"ATI Technologies Inc.")) {
pr_ati_fboworkaround = 1;
initprintf("Enabling ATI FBO color attachment workaround.\n");
}
else pr_ati_fboworkaround = 0;
if (!Bstrncmp(glinfo.renderer,"Radeon X1", 9)) {
pr_ati_nodepthoffset = 1;
initprintf("Enabling ATI R520 polygon offset workaround.\n");
} else
pr_ati_nodepthoffset = 0;
} else
pr_ati_fboworkaround = 0;
}
#endif
if (!forcegl && err)