mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Revert "Rewrite fog coordinate calculation:"
This reverts commit 7d4d0f282e
.
This commit is contained in:
parent
7d4d0f282e
commit
d494806186
|
@ -280,8 +280,12 @@ public:
|
|||
"IN highp vec4 aModify; \n"
|
||||
" \n"
|
||||
"uniform int uTexturePersp; \n"
|
||||
"uniform lowp int uTextureFilterMode; \n"
|
||||
"uniform lowp int uTextureFilterMode; \n"
|
||||
" \n"
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
"uniform mediump vec2 uFogScale; \n"
|
||||
"uniform mediump vec2 uScreenCoordsScale; \n"
|
||||
" \n"
|
||||
"uniform mediump vec2 uTexScale; \n"
|
||||
"uniform mediump vec2 uTexOffset[2]; \n"
|
||||
"uniform mediump vec2 uCacheScale[2]; \n"
|
||||
|
@ -330,6 +334,18 @@ public:
|
|||
" vNumLights = 0.0; \n"
|
||||
" } \n"
|
||||
" gl_Position.y = -gl_Position.y; \n"
|
||||
" if (uFogUsage > 0) { \n"
|
||||
" lowp float fp; \n"
|
||||
" if (aPosition.z < -aPosition.w && aModify[1] == 0.0) \n"
|
||||
" fp = -uFogScale.s + uFogScale.t; \n"
|
||||
" else \n"
|
||||
" fp = aPosition.z/aPosition.w*uFogScale.s + uFogScale.t; \n"
|
||||
" fp = clamp(fp, 0.0, 1.0); \n"
|
||||
" if (uFogUsage == 1) \n"
|
||||
" vShadeColor.a = fp; \n"
|
||||
" else \n"
|
||||
" vShadeColor.rgb = vec3(fp); \n"
|
||||
" } \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
@ -344,6 +360,9 @@ public:
|
|||
"IN lowp vec4 aColor; \n"
|
||||
"IN lowp float aNumLights; \n"
|
||||
"IN highp vec4 aModify; \n"
|
||||
" \n"
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
"uniform mediump vec2 uFogScale; \n"
|
||||
"uniform mediump vec2 uScreenCoordsScale; \n"
|
||||
" \n"
|
||||
"OUT lowp float vNumLights; \n"
|
||||
|
@ -370,6 +389,18 @@ public:
|
|||
" vNumLights = 0.0; \n"
|
||||
" } \n"
|
||||
" gl_Position.y = -gl_Position.y; \n"
|
||||
" if (uFogUsage > 0) { \n"
|
||||
" lowp float fp; \n"
|
||||
" if (aPosition.z < -aPosition.w && aModify[1] == 0.0) \n"
|
||||
" fp = -uFogScale.s + uFogScale.t; \n"
|
||||
" else \n"
|
||||
" fp = aPosition.z/aPosition.w*uFogScale.s + uFogScale.t; \n"
|
||||
" fp = clamp(fp, 0.0, 1.0); \n"
|
||||
" if (uFogUsage == 1) \n"
|
||||
" vShadeColor.a = fp; \n"
|
||||
" else \n"
|
||||
" vShadeColor.rgb = vec3(fp); \n"
|
||||
" } \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
@ -590,7 +621,7 @@ public:
|
|||
{
|
||||
m_part =
|
||||
" if (uFogUsage == 1) \n"
|
||||
" fragColor.rgb = mix(fragColor.rgb, uFogColor.rgb, shadeColor.a); \n"
|
||||
" fragColor.rgb = mix(fragColor.rgb, uFogColor.rgb, vShadeColor.a); \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
@ -826,7 +857,6 @@ public:
|
|||
"uniform highp vec2 uTexScale0; \n"
|
||||
"uniform highp vec2 uTexScale1; \n"
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
"uniform mediump vec2 uFogScale; \n"
|
||||
"highp vec2 texCoord0; \n"
|
||||
"highp vec2 texCoord1; \n"
|
||||
;
|
||||
|
@ -916,11 +946,13 @@ public:
|
|||
"uniform lowp int uDepthSource; \n"
|
||||
"uniform highp float uPrimDepth; \n"
|
||||
"uniform mediump vec2 uScreenScale; \n"
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
"uniform mediump vec2 uFogScale; \n"
|
||||
;
|
||||
|
||||
if (config.generalEmulation.enableLegacyBlending == 0) {
|
||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||
m_part +=
|
||||
"uniform lowp int uFogUsage; \n"
|
||||
;
|
||||
} else {
|
||||
m_part +=
|
||||
"uniform lowp ivec4 uBlendMux1; \n"
|
||||
"uniform lowp int uForceBlendCycle1;\n"
|
||||
|
@ -1346,8 +1378,11 @@ public:
|
|||
"void main() \n"
|
||||
"{ \n"
|
||||
;
|
||||
m_part += _glinfo.isGLES2 ? " highp float fragDepth = gl_FragCoord.z; \n"
|
||||
: " highp float fragDepth = writeDepth(); \n";
|
||||
if (!_glinfo.isGLES2) {
|
||||
m_part +=
|
||||
" highp float fragDepth = writeDepth(); \n"
|
||||
;
|
||||
}
|
||||
m_part +=
|
||||
" lowp vec4 vec_color; \n"
|
||||
" lowp float alpha1; \n"
|
||||
|
@ -1357,6 +1392,7 @@ public:
|
|||
// m_part += "#define WRAP(x, low, high) (x) - ((high)-(low)) * floor(((x)-(low))/((high)-(low))) \n"; // Perhaps more compatible?
|
||||
// m_part += "#define WRAP(x, low, high) (x) + ((high)-(low)) * (1.0-step(low,x)) - ((high)-(low)) * step(high,x) \n"; // Step based version. Only wraps correctly if input is in the range [low-(high-low), high + (high-low)). Similar to old code.
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class ShaderFragmentMain2Cycle : public ShaderPart
|
||||
|
@ -1368,8 +1404,11 @@ public:
|
|||
"void main() \n"
|
||||
"{ \n"
|
||||
;
|
||||
m_part += _glinfo.isGLES2 ? " highp float fragDepth = gl_FragCoord.z; \n"
|
||||
: " highp float fragDepth = writeDepth(); \n";
|
||||
if (!_glinfo.isGLES2) {
|
||||
m_part +=
|
||||
" highp float fragDepth = writeDepth(); \n"
|
||||
;
|
||||
}
|
||||
m_part +=
|
||||
" lowp vec4 vec_color, combined_color; \n"
|
||||
" lowp float alpha1, alpha2; \n"
|
||||
|
@ -1381,24 +1420,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class ShaderFragmentFog : public ShaderPart
|
||||
{
|
||||
public:
|
||||
ShaderFragmentFog(const opengl::GLInfo & _glinfo)
|
||||
{
|
||||
m_part =
|
||||
" lowp vec4 shadeColor = vShadeColor; \n"
|
||||
" if (uFogUsage == 1) { \n"
|
||||
" lowp float fp = fragDepth*uFogScale.s + uFogScale.t; \n"
|
||||
" shadeColor.a = clamp(fp, 0.0, 1.0); \n"
|
||||
" } else if (uFogUsage == 2) { \n"
|
||||
" lowp float fp = fragDepth*uFogScale.s + uFogScale.t; \n"
|
||||
" shadeColor.rgb = vec3(clamp(fp, 0.0, 1.0)); \n"
|
||||
" } \n"
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderFragmentBlendMux : public ShaderPart
|
||||
{
|
||||
public:
|
||||
|
@ -1407,7 +1428,7 @@ public:
|
|||
if (config.generalEmulation.enableLegacyBlending == 0) {
|
||||
m_part =
|
||||
" lowp mat4 muxPM = mat4(vec4(0.0), vec4(0.0), uBlendColor, uFogColor); \n"
|
||||
" lowp vec4 muxA = vec4(0.0, uFogColor.a, shadeColor.a, 0.0); \n"
|
||||
" lowp vec4 muxA = vec4(0.0, uFogColor.a, vShadeColor.a, 0.0); \n"
|
||||
" lowp vec4 muxB = vec4(0.0, 1.0, 1.0, 0.0); \n"
|
||||
;
|
||||
}
|
||||
|
@ -2586,8 +2607,6 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
|
|||
else
|
||||
m_fragmentMain->write(ssShader);
|
||||
|
||||
m_fragmentFog->write(ssShader);
|
||||
|
||||
if (g_cycleType <= G_CYC_2CYCLE)
|
||||
m_fragmentBlendMux->write(ssShader);
|
||||
|
||||
|
@ -2614,11 +2633,11 @@ graphics::CombinerProgram * CombinerProgramBuilder::buildCombinerProgram(Combine
|
|||
}
|
||||
|
||||
if (bUseHWLight)
|
||||
ssShader << " calc_light(vNumLights, shadeColor.rgb, input_color);" << std::endl;
|
||||
ssShader << " calc_light(vNumLights, vShadeColor.rgb, input_color);" << std::endl;
|
||||
else
|
||||
ssShader << " input_color = shadeColor.rgb;" << std::endl;
|
||||
ssShader << " input_color = vShadeColor.rgb;" << std::endl;
|
||||
|
||||
ssShader << " vec_color = vec4(input_color, shadeColor.a);" << std::endl;
|
||||
ssShader << " vec_color = vec4(input_color, vShadeColor.a);" << std::endl;
|
||||
ssShader << strCombiner << std::endl;
|
||||
|
||||
if (config.frameBufferEmulation.N64DepthCompare != Config::dcDisable)
|
||||
|
@ -2753,7 +2772,6 @@ CombinerProgramBuilder::CombinerProgramBuilder(const opengl::GLInfo & _glinfo, o
|
|||
, m_fragmentHeaderReadTexCopyMode(new ShaderFragmentHeaderReadTexCopyMode(_glinfo))
|
||||
, m_fragmentMain(new ShaderFragmentMain(_glinfo))
|
||||
, m_fragmentMain2Cycle(new ShaderFragmentMain2Cycle(_glinfo))
|
||||
, m_fragmentFog(new ShaderFragmentFog(_glinfo))
|
||||
, m_fragmentBlendMux(new ShaderFragmentBlendMux(_glinfo))
|
||||
, m_fragmentReadTex0(new ShaderFragmentReadTex0(_glinfo))
|
||||
, m_fragmentReadTex1(new ShaderFragmentReadTex1(_glinfo))
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace glsl {
|
|||
ShaderPartPtr m_fragmentHeaderReadTexCopyMode;
|
||||
ShaderPartPtr m_fragmentMain;
|
||||
ShaderPartPtr m_fragmentMain2Cycle;
|
||||
ShaderPartPtr m_fragmentFog;
|
||||
ShaderPartPtr m_fragmentBlendMux;
|
||||
ShaderPartPtr m_fragmentReadTex0;
|
||||
ShaderPartPtr m_fragmentReadTex1;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace glsl {
|
|||
bool _saveCombinerKeys(const graphics::Combiners & _combiners) const;
|
||||
bool _loadFromCombinerKeys(graphics::Combiners & _combiners);
|
||||
|
||||
const u32 m_formatVersion = 0x2DU;
|
||||
const u32 m_formatVersion = 0x2CU;
|
||||
const u32 m_keysFormatVersion = 0x04;
|
||||
const opengl::GLInfo & m_glinfo;
|
||||
opengl::CachedUseProgram * m_useProgram;
|
||||
|
|
Loading…
Reference in New Issue
Block a user