rendertargets ignore gl_max_size. this fixes underwaterwarp+bloom at high resolutions with outdated configs (ones that picked up an earlier default, or custom settings to limit texture detail... those crazy legoquakers).

fix shadow/particle issues, shadowmapping should be a little more robust now.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4783 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-11-03 04:45:18 +00:00
parent 9602ae7247
commit 2a65ebee65
4 changed files with 71 additions and 43 deletions

View file

@ -3124,7 +3124,7 @@ static void Image_RoundDimensions(int *scaled_width, int *scaled_height, unsigne
if (*scaled_height > sh_config.texture_maxsize) if (*scaled_height > sh_config.texture_maxsize)
*scaled_height = sh_config.texture_maxsize; *scaled_height = sh_config.texture_maxsize;
} }
if (!(flags & IF_UIPIC)) if (!(flags & (IF_UIPIC|IF_RENDERTARGET)))
{ {
if (gl_max_size.value) if (gl_max_size.value)
{ {

View file

@ -209,11 +209,70 @@ static void BE_PolyOffset(qboolean pushdepth)
po.factor += r_polygonoffset_submodel_factor.value; po.factor += r_polygonoffset_submodel_factor.value;
po.unit += r_polygonoffset_submodel_offset.value; po.unit += r_polygonoffset_submodel_offset.value;
} }
if (shaderstate.mode == BEM_DEPTHONLY)
#ifndef FORCESTATE
if (shaderstate.curpolyoffset.factor != po.factor || shaderstate.curpolyoffset.unit != po.unit)
#endif
{ {
extern cvar_t r_polygonoffset_shadowmap_offset, r_polygonoffset_shadowmap_factor; shaderstate.curpolyoffset = po;
po.factor += r_polygonoffset_shadowmap_factor.value; if (shaderstate.curpolyoffset.factor || shaderstate.curpolyoffset.unit)
po.unit += r_polygonoffset_shadowmap_offset.value; {
qglEnable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(shaderstate.curpolyoffset.factor, shaderstate.curpolyoffset.unit);
}
else
qglDisable(GL_POLYGON_OFFSET_FILL);
}
}
void GLBE_PolyOffsetStencilShadow(qboolean pushdepth)
{
extern cvar_t r_polygonoffset_stencil_offset, r_polygonoffset_stencil_factor;
polyoffset_t po;
if (pushdepth)
{
/*some quake doors etc are flush with the walls that they're meant to be hidden behind, or plats the same height as the floor, etc
we move them back very slightly using polygonoffset to avoid really ugly z-fighting*/
extern cvar_t r_polygonoffset_submodel_offset, r_polygonoffset_submodel_factor;
po.factor = r_polygonoffset_submodel_factor.value + r_polygonoffset_stencil_factor.value;
po.unit = r_polygonoffset_submodel_offset.value + r_polygonoffset_stencil_offset.value;
}
else
{
po.factor = r_polygonoffset_stencil_factor.value;
po.unit = r_polygonoffset_stencil_offset.value;
}
#ifndef FORCESTATE
if (shaderstate.curpolyoffset.factor != po.factor || shaderstate.curpolyoffset.unit != po.unit)
#endif
{
shaderstate.curpolyoffset = po;
if (shaderstate.curpolyoffset.factor || shaderstate.curpolyoffset.unit)
{
qglEnable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(shaderstate.curpolyoffset.factor, shaderstate.curpolyoffset.unit);
}
else
qglDisable(GL_POLYGON_OFFSET_FILL);
}
}
static void GLBE_PolyOffsetShadowMap(qboolean pushdepth)
{
extern cvar_t r_polygonoffset_shadowmap_offset, r_polygonoffset_shadowmap_factor;
polyoffset_t po;
if (pushdepth)
{
/*some quake doors etc are flush with the walls that they're meant to be hidden behind, or plats the same height as the floor, etc
we move them back very slightly using polygonoffset to avoid really ugly z-fighting*/
extern cvar_t r_polygonoffset_submodel_offset, r_polygonoffset_submodel_factor;
po.factor = r_polygonoffset_submodel_factor.value + r_polygonoffset_shadowmap_factor.value;
po.unit = r_polygonoffset_submodel_offset.value + r_polygonoffset_shadowmap_offset.value;
}
else
{
po.factor = r_polygonoffset_shadowmap_factor.value;
po.unit = r_polygonoffset_shadowmap_offset.value;
} }
#ifndef FORCESTATE #ifndef FORCESTATE
@ -800,6 +859,8 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
shaderstate.sourcevbo = &shaderstate.dummyvbo; shaderstate.sourcevbo = &shaderstate.dummyvbo;
shaderstate.dummyvbo.indicies.gl.vbo = ibo; shaderstate.dummyvbo.indicies.gl.vbo = ibo;
GLBE_PolyOffsetShadowMap(false);
if (shaderstate.allblackshader) if (shaderstate.allblackshader)
{ {
GL_SelectProgram(shaderstate.allblackshader); GL_SelectProgram(shaderstate.allblackshader);
@ -3362,7 +3423,7 @@ void GLBE_SelectMode(backendmode_t mode)
//we don't write or blend anything (maybe alpha test... but mneh) //we don't write or blend anything (maybe alpha test... but mneh)
BE_SendPassBlendDepthMask(SBITS_MISC_DEPTHWRITE | SBITS_MASK_BITS); BE_SendPassBlendDepthMask(SBITS_MISC_DEPTHWRITE | SBITS_MASK_BITS);
BE_PolyOffset(false); // BE_PolyOffset(false);
GL_CullFace(SHADER_CULL_FRONT); GL_CullFace(SHADER_CULL_FRONT);
break; break;
@ -3370,7 +3431,7 @@ void GLBE_SelectMode(backendmode_t mode)
#ifdef RTLIGHTS #ifdef RTLIGHTS
case BEM_STENCIL: case BEM_STENCIL:
/*BEM_STENCIL doesn't support mesh writing*/ /*BEM_STENCIL doesn't support mesh writing*/
GLBE_PushOffsetShadow(false); GLBE_PolyOffsetStencilShadow(false);
if (gl_config_nofixedfunc && !shaderstate.allblackshader) if (gl_config_nofixedfunc && !shaderstate.allblackshader)
{ {
@ -3604,39 +3665,6 @@ void GLBE_Scissor(srect_t *rect)
} }
} }
void GLBE_PushOffsetShadow(qboolean pushdepth)
{
extern cvar_t r_polygonoffset_stencil_offset, r_polygonoffset_stencil_factor;
polyoffset_t po;
if (pushdepth)
{
/*some quake doors etc are flush with the walls that they're meant to be hidden behind, or plats the same height as the floor, etc
we move them back very slightly using polygonoffset to avoid really ugly z-fighting*/
extern cvar_t r_polygonoffset_submodel_offset, r_polygonoffset_submodel_factor;
po.factor = r_polygonoffset_submodel_factor.value + r_polygonoffset_stencil_factor.value;
po.unit = r_polygonoffset_submodel_offset.value + r_polygonoffset_stencil_offset.value;
}
else
{
po.factor = r_polygonoffset_stencil_factor.value;
po.unit = r_polygonoffset_stencil_offset.value;
}
#ifndef FORCESTATE
if (shaderstate.curpolyoffset.factor != po.factor || shaderstate.curpolyoffset.unit != po.unit)
#endif
{
shaderstate.curpolyoffset = po;
if (shaderstate.curpolyoffset.factor || shaderstate.curpolyoffset.unit)
{
qglEnable(GL_POLYGON_OFFSET_FILL);
qglPolygonOffset(shaderstate.curpolyoffset.factor, shaderstate.curpolyoffset.unit);
}
else
qglDisable(GL_POLYGON_OFFSET_FILL);
}
}
#if defined(RTLIGHTS) && !defined(GLSLONLY) #if defined(RTLIGHTS) && !defined(GLSLONLY)
texid_t GenerateNormalisationCubeMap(void); texid_t GenerateNormalisationCubeMap(void);
static void BE_LegacyLighting(void) static void BE_LegacyLighting(void)

View file

@ -2665,7 +2665,7 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e)
GL_SelectEBO(0); GL_SelectEBO(0);
qglEnableClientState(GL_VERTEX_ARRAY); qglEnableClientState(GL_VERTEX_ARRAY);
GLBE_PushOffsetShadow(true); GLBE_PolyOffsetStencilShadow(true);
model = e->model; model = e->model;
surf = model->surfaces+model->firstmodelsurface; surf = model->surfaces+model->firstmodelsurface;
@ -2742,7 +2742,7 @@ static void Sh_DrawBrushModelShadow(dlight_t *dl, entity_t *e)
qglEnd(); qglEnd();
} }
GLBE_PushOffsetShadow(false); GLBE_PolyOffsetStencilShadow(false);
#endif #endif
} }

View file

@ -750,7 +750,7 @@ void BE_GenerateProgram(shader_t *shader);
void Sh_RegisterCvars(void); void Sh_RegisterCvars(void);
#ifdef RTLIGHTS #ifdef RTLIGHTS
// //
void GLBE_PushOffsetShadow(qboolean foobar); void GLBE_PolyOffsetStencilShadow(qboolean foobar);
//sets up gl for depth-only FIXME //sets up gl for depth-only FIXME
int GLBE_SetupForShadowMap(texid_t shadowmaptex, int texwidth, int texheight, float shadowscale); int GLBE_SetupForShadowMap(texid_t shadowmaptex, int texwidth, int texheight, float shadowscale);
//Called from shadowmapping code into backend //Called from shadowmapping code into backend