[Scummvm-git-logs] scummvm master -> 58d8da113b88a4a48121e4a91a1c7021c69a24c5

aquadran noreply at scummvm.org
Fri Oct 3 09:49:54 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
58d8da113b TINYGL: Cleanup. Keep aligned with 8 bits stencil buffer.


Commit: 58d8da113b88a4a48121e4a91a1c7021c69a24c5
    https://github.com/scummvm/scummvm/commit/58d8da113b88a4a48121e4a91a1c7021c69a24c5
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-10-03T11:49:20+02:00

Commit Message:
TINYGL: Cleanup. Keep aligned with 8 bits stencil buffer.

Changed paths:
    engines/wintermute/base/gfx/tinygl/meshx_tinygl.cpp
    engines/wintermute/base/gfx/tinygl/shadow_volume_tinygl.cpp
    graphics/tinygl/get.cpp
    graphics/tinygl/misc.cpp
    graphics/tinygl/zbuffer.h
    graphics/tinygl/zdirtyrect.h
    graphics/tinygl/zgl.h


diff --git a/engines/wintermute/base/gfx/tinygl/meshx_tinygl.cpp b/engines/wintermute/base/gfx/tinygl/meshx_tinygl.cpp
index 2a9241a1b3a..f42a4e33156 100644
--- a/engines/wintermute/base/gfx/tinygl/meshx_tinygl.cpp
+++ b/engines/wintermute/base/gfx/tinygl/meshx_tinygl.cpp
@@ -202,7 +202,7 @@ bool XMeshTinyGL::renderFlatShadowModel(uint32 shadowColor) {
 	tglDepthMask(TGL_FALSE);
 
 	tglEnable(TGL_STENCIL_TEST);
-	tglStencilFunc(TGL_ALWAYS, 1, (TGLuint)~0);
+	tglStencilFunc(TGL_ALWAYS, 1, 0xff);
 	tglStencilOp(TGL_REPLACE, TGL_REPLACE, TGL_REPLACE);
 
 	for (uint32 i = 0; i < numAttrs; i++) {
@@ -216,7 +216,7 @@ bool XMeshTinyGL::renderFlatShadowModel(uint32 shadowColor) {
 	}
 
 
-	tglStencilFunc(TGL_EQUAL, 1, (TGLuint)~0);
+	tglStencilFunc(TGL_EQUAL, 1, 0xff);
 	tglStencilOp(TGL_ZERO, TGL_ZERO, TGL_ZERO);
 
 	tglColor4ub(RGBCOLGetR(shadowColor), RGBCOLGetG(shadowColor), RGBCOLGetB(shadowColor), RGBCOLGetA(shadowColor));
diff --git a/engines/wintermute/base/gfx/tinygl/shadow_volume_tinygl.cpp b/engines/wintermute/base/gfx/tinygl/shadow_volume_tinygl.cpp
index 1b28a294894..3acff4e998d 100644
--- a/engines/wintermute/base/gfx/tinygl/shadow_volume_tinygl.cpp
+++ b/engines/wintermute/base/gfx/tinygl/shadow_volume_tinygl.cpp
@@ -73,7 +73,7 @@ bool ShadowVolumeTinyGL::renderToStencilBuffer() {
 	// Stencil test passes if ((ref & mask) cmpfn (stencil & mask)) is true.
 	// Note: since we set up the stencil-test to always pass, the STENCILFAIL
 	// renderstate is really not needed.
-	tglStencilFunc(TGL_ALWAYS, 0x1, (TGLuint)~0);
+	tglStencilFunc(TGL_ALWAYS, 0x1, 0xff);
 
 	tglShadeModel(TGL_FLAT);
 
@@ -112,7 +112,7 @@ bool ShadowVolumeTinyGL::renderToScene() {
 	tglBlendFunc(TGL_SRC_ALPHA, TGL_ONE_MINUS_SRC_ALPHA);
 
 	// Only write where stencil val >= 1 (count indicates # of shadows that overlap that pixel)
-	tglStencilFunc(TGL_LEQUAL, 0x1, (TGLuint)~0);
+	tglStencilFunc(TGL_LEQUAL, 0x1, 0xff);
 	tglStencilOp(TGL_KEEP, TGL_KEEP, TGL_KEEP);
 
 	tglDisable(TGL_FOG);
diff --git a/graphics/tinygl/get.cpp b/graphics/tinygl/get.cpp
index 75ada41460f..bdfeeb0a199 100644
--- a/graphics/tinygl/get.cpp
+++ b/graphics/tinygl/get.cpp
@@ -722,7 +722,8 @@ void GLContext::gl_get_pname(TGLenum pname, union uglValue *data, eDataType &dat
 		dataType = kIntType;
 		break;
 	case TGL_STENCIL_VALUE_MASK:
-		error("gl_get_pname: TGL_SCISSOR_BOX option not implemented");
+		data->_int = (TGLint)stencil_mask;
+		dataType = kIntType;
 		break;
 	case TGL_STENCIL_WRITEMASK:
 		data->_int = (TGLint)stencil_write_mask;
diff --git a/graphics/tinygl/misc.cpp b/graphics/tinygl/misc.cpp
index ed3e9829a4e..f7c1f86b998 100644
--- a/graphics/tinygl/misc.cpp
+++ b/graphics/tinygl/misc.cpp
@@ -165,8 +165,8 @@ void GLContext::glopStencilFunc(GLParam *p) {
 	else if (ref > 255)
 		ref = 255;
 	stencil_test_func = func;
-	stencil_ref_val = ref;
-	stencil_mask = mask;
+	stencil_ref_val = (byte)ref;
+	stencil_mask = (byte)mask;
 }
 
 void GLContext::glopStencilOp(GLParam *p) {
diff --git a/graphics/tinygl/zbuffer.h b/graphics/tinygl/zbuffer.h
index 6a73a28b337..43a7f712474 100644
--- a/graphics/tinygl/zbuffer.h
+++ b/graphics/tinygl/zbuffer.h
@@ -651,7 +651,7 @@ public:
 		_polygonStipplePattern = stipple;
 	}
 
-	void setStencilTestFunc(int stencilFunc, int stencilValue, uint stencilMask) {
+	void setStencilTestFunc(int stencilFunc, byte stencilValue, byte stencilMask) {
 		_stencilTestFunc = stencilFunc;
 		_stencilRefVal = stencilValue;
 		_stencilMask = stencilMask;
@@ -829,9 +829,9 @@ private:
 	bool _depthWrite;
 	bool _stencilTestEnabled;
 	int _stencilTestFunc;
-	int _stencilRefVal;
-	uint _stencilMask;
-	uint _stencilWriteMask;
+	byte _stencilRefVal;
+	byte _stencilMask;
+	byte _stencilWriteMask;
 	int _stencilSfail;
 	int _stencilDpfail;
 	int _stencilDppass;
diff --git a/graphics/tinygl/zdirtyrect.h b/graphics/tinygl/zdirtyrect.h
index e0c614eac32..dafb59409c0 100644
--- a/graphics/tinygl/zdirtyrect.h
+++ b/graphics/tinygl/zdirtyrect.h
@@ -168,9 +168,9 @@ private:
 		int alphaRefValue;
 		bool stencilTestEnabled;
 		int stencilTestFunc;
-		int stencilValue;
-		uint stencilMask;
-		uint stencilWriteMask;
+		byte stencilValue;
+		byte stencilMask;
+		byte stencilWriteMask;
 		int stencilSfail;
 		int stencilDpfail;
 		int stencilDppass;
diff --git a/graphics/tinygl/zgl.h b/graphics/tinygl/zgl.h
index 638e8a25431..640db31de41 100644
--- a/graphics/tinygl/zgl.h
+++ b/graphics/tinygl/zgl.h
@@ -434,9 +434,9 @@ struct GLContext {
 	bool stencil_buffer_supported;
 	bool stencil_test_enabled;
 	int stencil_test_func;
-	int stencil_ref_val;
-	uint stencil_mask;
-	uint stencil_write_mask;
+	byte stencil_ref_val;
+	byte stencil_mask;
+	byte stencil_write_mask;
 	int stencil_sfail;
 	int stencil_dpfail;
 	int stencil_dppass;




More information about the Scummvm-git-logs mailing list