mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix the mip bias to take the texture depth and sampling offset into account.
This commit is contained in:
parent
2cb9e09ad3
commit
d7aa3ee486
2 changed files with 4 additions and 4 deletions
|
@ -560,11 +560,10 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
|||
}
|
||||
} else {
|
||||
if (texture3D) {
|
||||
WRITE(p, " float bias = u_mipBias * 1.0;\n");
|
||||
if (doTextureProjection) {
|
||||
WRITE(p, " vec4 t = %sProj(tex, vec4(%s.xy, bias, %s.z));\n", compat.texture, texcoord, texcoord);
|
||||
WRITE(p, " vec4 t = %sProj(tex, vec4(%s.xy, u_mipBias, %s.z));\n", compat.texture, texcoord, texcoord);
|
||||
} else {
|
||||
WRITE(p, " vec4 t = %s(tex, vec3(%s.xy, bias));\n", compat.texture, texcoord);
|
||||
WRITE(p, " vec4 t = %s(tex, vec3(%s.xy, u_mipBias));\n", compat.texture, texcoord);
|
||||
}
|
||||
} else {
|
||||
if (doTextureProjection) {
|
||||
|
|
|
@ -105,7 +105,8 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
|||
ub->texClampOffset[0] = gstate_c.curTextureXOffset * invW;
|
||||
ub->texClampOffset[1] = gstate_c.curTextureYOffset * invH;
|
||||
|
||||
ub->mipBias = (float)gstate.getTexLevelOffset16() * (1.0 / 16.0f);
|
||||
float mipBias = (float)gstate.getTexLevelOffset16() * (1.0 / 16.0f);
|
||||
ub->mipBias = (mipBias + 0.5f) / (float)(gstate.getTextureMaxLevel() + 1);
|
||||
}
|
||||
|
||||
if (dirtyUniforms & DIRTY_PROJMATRIX) {
|
||||
|
|
Loading…
Add table
Reference in a new issue