fixed crashes due to bad shader stage collapse data

This commit is contained in:
myT 2023-07-29 04:53:18 +02:00
parent dd7aef88d5
commit b3480c7129
4 changed files with 11 additions and 11 deletions

View file

@ -102,6 +102,8 @@ chg: with r_backend GL3, depth fade with MSAA now requires GLSL 4.00 at a minimu
chg: with r_backend GL3, alpha to coverage now requires GLSL 4.00 at a minimum
fix: the renderer could crash on some maps without lightmaps (e.g. b0_beta5)
fix: with r_backend GL2, the extra clip plane for mirror/portal surfaces was not being used
this quick fix is likely to fail for some drivers and vendors due to its use of deprecated features
based on a few tests: OK on NVIDIA and Intel, not working on AMD

View file

@ -2526,7 +2526,7 @@ static void DrawGeneric()
BindBundle(0, &stage->bundle);
if(stage->mtStages == 1)
if(stage->mtStages == 1 && tess.xstages[i + 1] != NULL)
{
const shaderStage_t* stage2 = tess.xstages[i + 1];
d3d.texEnv = stage2->mtEnv;

View file

@ -320,9 +320,7 @@ static void DrawGeneric()
R_BindAnimatedImage( &pStage->bundle );
GL_State( pStage->stateBits );
if ( pStage->mtStages ) {
// we can't really cope with massive collapses, so
assert( pStage->mtStages == 1 );
if ( pStage->mtStages == 1 && tess.xstages[stage + 1] != NULL ) {
glUniform1i( genericProgAttribs.texEnv, tess.xstages[stage + 1]->mtEnv );
if ( GL2_StageIterator_MultitextureStage( stage + 1 ) )
break;

View file

@ -2262,13 +2262,7 @@ static void DrawGeneric()
BindBundle(0, &stage->bundle);
if(stage->mtStages == 0)
{
BindImage(1, tr.whiteImage);
BindVertexArray(VB_TEXCOORD2);
ApplyTexEnv(TE_DISABLED);
}
else
if(stage->mtStages == 1 && tess.xstages[i + 1] != NULL)
{
const shaderStage_t* const stage2 = tess.xstages[i + 1];
BindBundle(1, &stage2->bundle);
@ -2276,6 +2270,12 @@ static void DrawGeneric()
ApplyTexEnv(stage2->mtEnv);
++i;
}
else
{
BindImage(1, tr.whiteImage);
BindVertexArray(VB_TEXCOORD2);
ApplyTexEnv(TE_DISABLED);
}
if(pipeline->uniformsDirty[GU_ALPHA_TEX])
{