OpenGL: only enable stencil testing during level render

not 100% sure if this is the most correct thing, but this causes issues with Nvidia Gpu´s under x11
should fix https://github.com/Indev450/SRB2Kart-Saturn/issues/226
This commit is contained in:
alufolie91 committed 2026-05-06 16:29:44 +02:00
1 parent 0b7c67de2d
commit e30685baf2
3 files changed
+19 -1

No files matched your search

+4
View File
@@ -32,8 +32,12 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
void GL_SetTransform(FTransform *stransform);
void GL_SetBlend(FBITFIELD PolyFlags);
void GL_SetPalette(RGBA_t *palette);
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
void GL_EnableStencilTest(void);
void GL_DisableStencilTest(void);
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
+4
View File
@@ -5537,6 +5537,8 @@ extern "C" {
// ==========================================================================
static void HWR_RenderFrame(boolean skybox, boolean drawsky)
{
GL_EnableStencilTest();
// Clear view, set viewport (glViewport), set perspective...
HWR_ClearView();
@@ -5567,6 +5569,8 @@ static void HWR_RenderFrame(boolean skybox, boolean drawsky)
else
HWR_RenderViewpoint<RenderViewpointType::kNormal>(NULL, 0, !skybox);
GL_DisableStencilTest();
// Check for new console commands.
NetUpdate();
}
+11 -1
View File
@@ -1287,7 +1287,7 @@ void GL_SetStates(void)
pglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
pglEnable(GL_STENCIL_TEST);
pglDisable(GL_STENCIL_TEST);
pglEnable(GL_DEPTH_TEST); // check the depth buffer
pglDepthMask(GL_TRUE); // enable writing to depth buffer
pglClearDepth(1.0f);
@@ -1317,6 +1317,16 @@ void GL_SetStates(void)
#endif
}
void GL_EnableStencilTest(void)
{
pglEnable(GL_STENCIL_TEST);
}
void GL_DisableStencilTest(void)
{
pglDisable(GL_STENCIL_TEST);
}
// -----------------+
// DeleteTexture : Deletes a texture from the GPU and frees its data
// -----------------+