add pr_nullrender variable to toggle drawing and updating GL buffers

git-svn-id: https://svn.eduke32.com/eduke32@5266 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
Plagman 2015-06-14 23:42:31 +00:00
parent efe3d87cf8
commit 18b3984a97
3 changed files with 69 additions and 43 deletions

View file

@ -56,6 +56,7 @@ extern int32_t pr_ati_nodepthoffset;
#ifdef __APPLE__
extern int32_t pr_ati_textureformat_one;
#endif
extern int32_t pr_nullrender;
extern int32_t r_pr_maxlightpasses;

View file

@ -47,6 +47,7 @@ int32_t pr_ati_nodepthoffset = 0;
#ifdef __APPLE__
int32_t pr_ati_textureformat_one = 0;
#endif
int32_t pr_nullrender = 0; // 1: no draw, 2: no draw or updates
int32_t r_pr_maxlightpasses = 5; // value of the cvar (not live value), used to detect changes
@ -2067,6 +2068,8 @@ static void polymer_drawplane(_prplane* plane)
{
int32_t materialbits;
if (pr_nullrender >= 1) return;
// debug code for drawing plane inverse TBN
// bglDisable(GL_TEXTURE_2D);
// bglBegin(GL_LINES);
@ -2348,6 +2351,8 @@ static int32_t polymer_updatesector(int16_t sectnum)
char curxpanning, curypanning;
GLfloat* curbuffer;
if (pr_nullrender >= 3) return 0;
s = prsectors[sectnum];
sec = (tsectortype *)&sector[sectnum];
@ -2519,6 +2524,8 @@ static int32_t polymer_updatesector(int16_t sectnum)
attributes:
if ((pr_vbos > 0) && ((i == -1) || (wallinvalidate)))
{
if (pr_nullrender < 2)
{
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->floor.vbo);
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sec->wallnum * sizeof(GLfloat)* 5, s->floor.buffer);
@ -2526,6 +2533,7 @@ attributes:
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sec->wallnum * sizeof(GLfloat)* 5, s->ceil.buffer);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
}
if ((!s->flags.empty) && (!s->flags.invalidtex) &&
(floorpicnum == s->floorpicnum_anim) &&
@ -2566,6 +2574,8 @@ finish:
{
polymer_buildfloor(sectnum);
if ((pr_vbos > 0))
{
if (pr_nullrender < 2)
{
if (s->oldindicescount < s->indicescount)
{
@ -2582,6 +2592,7 @@ finish:
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
}
}
}
if (wallinvalidate)
{
@ -2861,6 +2872,8 @@ static void polymer_updatewall(int16_t wallnum)
uint32_t invalid;
int32_t sectofwall = sectorofwall(wallnum);
if (pr_nullrender >= 3) return;
// yes, this function is messy and unefficient
// it also works, bitches
sec = &sector[sectofwall];
@ -3222,6 +3235,8 @@ static void polymer_updatewall(int16_t wallnum)
polymer_computeplane(&w->mask);
if ((pr_vbos > 0))
{
if (pr_nullrender < 2)
{
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, w->wall.vbo);
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, 4 * sizeof(GLfloat)* 5, w->wall.buffer);
@ -3235,6 +3250,7 @@ static void polymer_updatewall(int16_t wallnum)
bglBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat)* 5, 4 * sizeof(GLfloat)* 3, w->cap);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
}
w->flags.empty = 0;
w->flags.uptodate = 1;
@ -3550,6 +3566,8 @@ void polymer_updatesprite(int32_t snum)
const uint32_t alignmask = (cs & SPR_ALIGN_MASK);
const uint8_t flooraligned = (alignmask==SPR_FLOOR);
if (pr_nullrender >= 3) return;
if (pr_verbosity >= 3) OSD_Printf("PR : Updating sprite %i...\n", snum);
if (tspr->owner < 0 || tspr->picnum < 0) return;
@ -3563,11 +3581,14 @@ void polymer_updatesprite(int32_t snum)
}
if ((tspr->cstat & 48) && (pr_vbos > 0) && !prsprites[tspr->owner]->plane.vbo)
{
if (pr_nullrender < 2)
{
bglGenBuffersARB(1, &prsprites[tspr->owner]->plane.vbo);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, prsprites[tspr->owner]->plane.vbo);
bglBufferDataARB(GL_ARRAY_BUFFER_ARB, 4 * sizeof(GLfloat)* 5, NULL, mapvbousage);
}
}
s = prsprites[tspr->owner];
@ -3732,6 +3753,8 @@ void polymer_updatesprite(int32_t snum)
polymer_computeplane(&s->plane);
if (pr_nullrender < 2)
{
if (alignmask && (pr_vbos > 0))
{
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, s->plane.vbo);
@ -3743,6 +3766,7 @@ void polymer_updatesprite(int32_t snum)
bglDeleteBuffersARB(1, &s->plane.vbo);
s->plane.vbo = 0;
}
}
if (alignmask)
{

View file

@ -5650,6 +5650,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_overridemodelscale", "overrides model scale if non-zero; use it to fine-tune DEF tokens", (void *) &pr_overridemodelscale, CVAR_FLOAT | CVAR_NOSAVE, 0, 500 },
{ "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, 1 },
{ "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, 1 },
{ "r_pr_nullrender", "disable all draws when enabled, 2: disables updates too", (void *)&pr_nullrender, CVAR_INT | CVAR_NOSAVE, 0, 3 },
#endif
#ifdef __ANDROID__