mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Give the mip bias its own uniform flag.
This commit is contained in:
1 parent
0caaa74be9
commit
c158414858
7 files changed
+12
-6
No files matched your search
@@ -348,7 +348,7 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu
|
||||
}
|
||||
|
||||
if (texture3D) {
|
||||
*uniformMask |= DIRTY_TEXCLAMP;
|
||||
*uniformMask |= DIRTY_MIPBIAS;
|
||||
WRITE(p, "uniform float u_mipBias;\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,13 @@ enum : uint64_t {
|
||||
DIRTY_DEPAL = 1ULL << 35,
|
||||
DIRTY_COLORWRITEMASK = 1ULL << 36,
|
||||
|
||||
DIRTY_MIPBIAS = 1ULL << 37,
|
||||
|
||||
// space for 4 more uniform dirty flags. Remember to update DIRTY_ALL_UNIFORMS.
|
||||
|
||||
DIRTY_BONE_UNIFORMS = 0xFF000000ULL,
|
||||
|
||||
DIRTY_ALL_UNIFORMS = 0x1FFFFFFFFFULL,
|
||||
DIRTY_ALL_UNIFORMS = 0x3FFFFFFFFFULL,
|
||||
DIRTY_ALL_LIGHTS = DIRTY_LIGHT0 | DIRTY_LIGHT1 | DIRTY_LIGHT2 | DIRTY_LIGHT3,
|
||||
|
||||
// Other dirty elements that aren't uniforms!
|
||||
|
||||
@@ -104,7 +104,9 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
||||
ub->texClamp[3] = invH * 0.5f;
|
||||
ub->texClampOffset[0] = gstate_c.curTextureXOffset * invW;
|
||||
ub->texClampOffset[1] = gstate_c.curTextureYOffset * invH;
|
||||
}
|
||||
|
||||
if (dirtyUniforms & DIRTY_MIPBIAS) {
|
||||
float mipBias = (float)gstate.getTexLevelOffset16() * (1.0 / 16.0f);
|
||||
ub->mipBias = (mipBias + 0.5f) / (float)(gstate.getTextureMaxLevel() + 1);
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ static void ConvertProjMatrixToD3DThrough(Matrix4x4 &in) {
|
||||
in.translateAndScale(Vec3(xoff, yoff, 0.5f), Vec3(1.0f, 1.0f, 0.5f));
|
||||
}
|
||||
|
||||
const uint64_t psUniforms = DIRTY_TEXENV | DIRTY_ALPHACOLORREF | DIRTY_ALPHACOLORMASK | DIRTY_FOGCOLOR | DIRTY_STENCILREPLACEVALUE | DIRTY_SHADERBLEND | DIRTY_TEXCLAMP;
|
||||
const uint64_t psUniforms = DIRTY_TEXENV | DIRTY_ALPHACOLORREF | DIRTY_ALPHACOLORMASK | DIRTY_FOGCOLOR | DIRTY_STENCILREPLACEVALUE | DIRTY_SHADERBLEND | DIRTY_TEXCLAMP | DIRTY_MIPBIAS;
|
||||
|
||||
void ShaderManagerDX9::PSUpdateUniforms(u64 dirtyUniforms) {
|
||||
if (dirtyUniforms & DIRTY_TEXENV) {
|
||||
@@ -314,7 +314,9 @@ void ShaderManagerDX9::PSUpdateUniforms(u64 dirtyUniforms) {
|
||||
};
|
||||
PSSetFloatArray(CONST_PS_TEXCLAMP, texclamp, 4);
|
||||
PSSetFloatArray(CONST_PS_TEXCLAMPOFF, texclampoff, 2);
|
||||
}
|
||||
|
||||
if (dirtyUniforms & DIRTY_MIPBIAS) {
|
||||
float mipBias = (float)gstate.getTexLevelOffset16() * (1.0 / 16.0f);
|
||||
|
||||
// NOTE: This equation needs some adjustment in D3D9. Can't get it to look completely smooth :(
|
||||
|
||||
@@ -459,7 +459,7 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
|
||||
}
|
||||
}
|
||||
|
||||
if ((dirty & DIRTY_TEXCLAMP) && u_mipBias != -1) {
|
||||
if ((dirty & DIRTY_MIPBIAS) && u_mipBias != -1) {
|
||||
float mipBias = (float)gstate.getTexLevelOffset16() * (1.0 / 16.0f);
|
||||
mipBias = (mipBias + 0.5f) / (float)(gstate.getTextureMaxLevel() + 1);
|
||||
|
||||
|
||||
+1
-1
@@ -1565,7 +1565,7 @@ void GPUCommon::Execute_TexLevel(u32 op, u32 diff) {
|
||||
|
||||
if (diff & 0xFF0000) {
|
||||
// Piggyback on this flag for 3D textures.
|
||||
gstate_c.Dirty(DIRTY_TEXCLAMP);
|
||||
gstate_c.Dirty(DIRTY_MIPBIAS);
|
||||
}
|
||||
if (gstate.getTexLevelMode() != GE_TEXLEVEL_MODE_AUTO && (0x00FF0000 & gstate.texlevel) != 0) {
|
||||
Flush();
|
||||
|
||||
+1
-1
@@ -554,7 +554,7 @@ struct GPUStateCache {
|
||||
void SetTextureIs3D(bool is3D) {
|
||||
if (is3D != curTextureIs3D) {
|
||||
curTextureIs3D = is3D;
|
||||
Dirty(DIRTY_FRAGMENTSHADER_STATE | DIRTY_UVSCALEOFFSET);
|
||||
Dirty(DIRTY_FRAGMENTSHADER_STATE | (is3D ? DIRTY_MIPBIAS : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user