mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Fix depth_compare shader:
always write depth to buffer when otherMode.depthCompare flag is off. Up shader storage version. Fixed 2 players mode in Extreme-G XG2 (U) with N64 depth compare enabled, #1963
This commit is contained in:
parent
a5fc0689ac
commit
cb0cf5bed9
|
@ -1957,9 +1957,9 @@ public:
|
||||||
;
|
;
|
||||||
if (_glinfo.imageTextures) {
|
if (_glinfo.imageTextures) {
|
||||||
m_part +=
|
m_part +=
|
||||||
" ivec2 coord = ivec2(gl_FragCoord.xy); \n"
|
" ivec2 coord = ivec2(gl_FragCoord.xy); \n"
|
||||||
" highp vec4 depthZ = imageLoad(uDepthImageZ,coord); \n"
|
" highp vec4 depthZ = imageLoad(uDepthImageZ,coord); \n"
|
||||||
" highp vec4 depthDeltaZ = imageLoad(uDepthImageDeltaZ,coord);\n"
|
" highp vec4 depthDeltaZ = imageLoad(uDepthImageDeltaZ,coord);\n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
m_part +=
|
m_part +=
|
||||||
|
@ -1968,14 +1968,14 @@ public:
|
||||||
" if (uDepthSource == 1) { \n"
|
" if (uDepthSource == 1) { \n"
|
||||||
" dzMin = dz = uDeltaZ; \n"
|
" dzMin = dz = uDeltaZ; \n"
|
||||||
" } else { \n"
|
" } else { \n"
|
||||||
" dz = 4.0*fwidth(curZ); \n"
|
" dz = 4.0*fwidth(curZ); \n"
|
||||||
" dzMin = min(dz, depthDeltaZ.r); \n"
|
" dzMin = min(dz, depthDeltaZ.r); \n"
|
||||||
" } \n"
|
" } \n"
|
||||||
" bool bInfront = curZ < bufZ; \n"
|
" bool bInfront = curZ < bufZ; \n"
|
||||||
" bool bFarther = (curZ + dzMin) >= bufZ; \n"
|
" bool bFarther = (curZ + dzMin) >= bufZ; \n"
|
||||||
" bool bNearer = (curZ - dzMin) <= bufZ; \n"
|
" bool bNearer = (curZ - dzMin) <= bufZ; \n"
|
||||||
" bool bMax = bufZ == 1.0; \n"
|
" bool bMax = bufZ == 1.0; \n"
|
||||||
" bool bRes; \n"
|
" bool bRes = false; \n"
|
||||||
" switch (uDepthMode) { \n"
|
" switch (uDepthMode) { \n"
|
||||||
" case 1: \n"
|
" case 1: \n"
|
||||||
" bRes = bMax || bNearer; \n"
|
" bRes = bMax || bNearer; \n"
|
||||||
|
@ -1987,30 +1987,26 @@ public:
|
||||||
" case 3: \n"
|
" case 3: \n"
|
||||||
" bRes = bFarther && bNearer && !bMax; \n"
|
" bRes = bFarther && bNearer && !bMax; \n"
|
||||||
" break; \n"
|
" break; \n"
|
||||||
" default: \n"
|
|
||||||
" bRes = bInfront; \n"
|
|
||||||
" break; \n"
|
|
||||||
" } \n"
|
" } \n"
|
||||||
" if (uEnableDepthUpdate != 0 && bRes) { \n"
|
" bRes = bRes || (uEnableDepthCompare == 0); \n"
|
||||||
|
" if (uEnableDepthUpdate != 0 && bRes) { \n"
|
||||||
;
|
;
|
||||||
if (_glinfo.imageTextures) {
|
if (_glinfo.imageTextures) {
|
||||||
m_part +=
|
m_part +=
|
||||||
" highp vec4 depthOutZ = vec4(curZ, 1.0, 1.0, 1.0); \n"
|
" highp vec4 depthOutZ = vec4(curZ, 1.0, 1.0, 1.0); \n"
|
||||||
" highp vec4 depthOutDeltaZ = vec4(dz, 1.0, 1.0, 1.0); \n"
|
" highp vec4 depthOutDeltaZ = vec4(dz, 1.0, 1.0, 1.0); \n"
|
||||||
" imageStore(uDepthImageZ, coord, depthOutZ); \n"
|
" imageStore(uDepthImageZ, coord, depthOutZ); \n"
|
||||||
" imageStore(uDepthImageDeltaZ, coord, depthOutDeltaZ); \n"
|
" imageStore(uDepthImageDeltaZ, coord, depthOutDeltaZ); \n"
|
||||||
;
|
;
|
||||||
} else if (_glinfo.ext_fetch) {
|
} else if (_glinfo.ext_fetch) {
|
||||||
m_part +=
|
m_part +=
|
||||||
" depthZ.r = curZ; \n"
|
" depthZ.r = curZ; \n"
|
||||||
" depthDeltaZ.r = dz; \n"
|
" depthDeltaZ.r = dz; \n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
m_part +=
|
m_part +=
|
||||||
" } \n"
|
" } \n"
|
||||||
" if (uEnableDepthCompare != 0) \n"
|
" return bRes; \n"
|
||||||
" return bRes; \n"
|
|
||||||
" return true; \n"
|
|
||||||
"} \n"
|
"} \n"
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace glsl {
|
||||||
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
|
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
|
||||||
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
|
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
|
||||||
|
|
||||||
const u32 m_formatVersion = 0x22U;
|
const u32 m_formatVersion = 0x23U;
|
||||||
const u32 m_keysFormatVersion = 0x04;
|
const u32 m_keysFormatVersion = 0x04;
|
||||||
const opengl::GLInfo & m_glinfo;
|
const opengl::GLInfo & m_glinfo;
|
||||||
opengl::CachedUseProgram * m_useProgram;
|
opengl::CachedUseProgram * m_useProgram;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user