mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Force lod=1.0 when the most detailed texture is desired by the user.
This commit is contained in:
parent
dd64b42081
commit
c7701d16c3
|
@ -2190,20 +2190,7 @@ public:
|
|||
" name = c0 + tcData[4].t * (c1-c0); \\\n"
|
||||
"} \n"
|
||||
;
|
||||
if (config.generalEmulation.enableLOD == 0) {
|
||||
// Fake mipmap
|
||||
m_part +=
|
||||
"uniform lowp int uMaxTile; \n"
|
||||
"uniform mediump float uMinLod; \n"
|
||||
" \n"
|
||||
"mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n"
|
||||
" READ_TEX0_MIPMAP(readtex0, uTex0, tcData0); \n"
|
||||
" READ_TEX0_MIPMAP(readtex1, uTex1, tcData1); \n"
|
||||
" if (uMaxTile == 0) return 1.0; \n"
|
||||
" return uMinLod; \n"
|
||||
"} \n"
|
||||
;
|
||||
} else {
|
||||
|
||||
m_part +=
|
||||
"uniform lowp int uEnableLod; \n"
|
||||
"uniform mediump float uMinLod; \n"
|
||||
|
@ -2211,10 +2198,19 @@ public:
|
|||
"uniform lowp int uTextureDetail; \n"
|
||||
" \n"
|
||||
"mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1) { \n"
|
||||
" \n"
|
||||
;
|
||||
if (config.generalEmulation.enableLOD == 0) {
|
||||
m_part +=
|
||||
" mediump float lod = 1.0; \n"
|
||||
;
|
||||
} else {
|
||||
m_part +=
|
||||
" mediump vec2 dx = abs(dFdx(vLodTexCoord)) * uScreenScale; \n"
|
||||
" mediump vec2 dy = abs(dFdy(vLodTexCoord)) * uScreenScale; \n"
|
||||
" mediump float lod = max(max(dx.x, dx.y), max(dy.x, dy.y)); \n"
|
||||
;
|
||||
}
|
||||
m_part +=
|
||||
" lowp int max_tile = min(uTextureDetail != 2 ? 7 : 6, uMaxTile); \n"
|
||||
" mediump float min_lod = uTextureDetail != 0 ? uMinLod : 1.0; \n"
|
||||
" mediump float max_lod = pow(2.0, float(max_tile)) - 1.0 / 32.0; \n"
|
||||
|
@ -2247,11 +2243,9 @@ public:
|
|||
" else {READ_TEX1_MIPMAP(readtex1, uTex1, tcData1, tile1 - 1);} \n"
|
||||
" return lod_frac; \n"
|
||||
"} \n"
|
||||
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderCalcLight : public ShaderPart
|
||||
|
|
|
@ -582,12 +582,14 @@ private:
|
|||
fv2Uniform uScreenScale;
|
||||
};
|
||||
|
||||
class UMipmap1 : public UniformGroup
|
||||
class UMipmap : public UniformGroup
|
||||
{
|
||||
public:
|
||||
UMipmap1(GLuint _program) {
|
||||
UMipmap(GLuint _program) {
|
||||
LocateUniform(uMinLod);
|
||||
LocateUniform(uMaxTile);
|
||||
LocateUniform(uEnableLod);
|
||||
LocateUniform(uTextureDetail);
|
||||
}
|
||||
|
||||
void update(bool _force) override
|
||||
|
@ -598,29 +600,14 @@ public:
|
|||
uMaxTile.set(gSP.texture.level, _force);
|
||||
else
|
||||
uMaxTile.set(_pTexture->max_level > 0 ? gSP.texture.level : std::min(gSP.texture.level, 1u), _force);
|
||||
}
|
||||
|
||||
private:
|
||||
fUniform uMinLod;
|
||||
iUniform uMaxTile;
|
||||
};
|
||||
|
||||
class UMipmap2 : public UniformGroup
|
||||
{
|
||||
public:
|
||||
UMipmap2(GLuint _program) {
|
||||
LocateUniform(uEnableLod);
|
||||
LocateUniform(uTextureDetail);
|
||||
}
|
||||
|
||||
void update(bool _force) override
|
||||
{
|
||||
const int uCalcLOD = (gDP.otherMode.textureLOD == G_TL_LOD) ? 1 : 0;
|
||||
uEnableLod.set(uCalcLOD, _force);
|
||||
uTextureDetail.set(gDP.otherMode.textureDetail, _force);
|
||||
}
|
||||
|
||||
private:
|
||||
fUniform uMinLod;
|
||||
iUniform uMaxTile;
|
||||
iUniform uEnableLod;
|
||||
iUniform uTextureDetail;
|
||||
};
|
||||
|
@ -1223,9 +1210,7 @@ void CombinerProgramUniformFactory::buildUniforms(GLuint _program,
|
|||
_uniforms.emplace_back(new UFrameBufferInfo(_program));
|
||||
|
||||
if (_inputs.usesLOD()) {
|
||||
_uniforms.emplace_back(new UMipmap1(_program));
|
||||
if (config.generalEmulation.enableLOD != 0)
|
||||
_uniforms.emplace_back(new UMipmap2(_program));
|
||||
_uniforms.emplace_back(new UMipmap(_program));
|
||||
} else if (_key.getCycleType() < G_CYC_COPY) {
|
||||
_uniforms.emplace_back(new UTextureFetchMode(_program));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user