mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-03-03 11:37:20 +00:00
d3d: Set the lod bias for textures.
Why aren't these caching?
This commit is contained in:
parent
b8e768066f
commit
5e528f673d
@ -647,12 +647,12 @@ namespace DX9 {
|
||||
if (g_Config.iBufFilter == SCALE_LINEAR) {
|
||||
dxstate.texMagFilter.set(D3DTEXF_LINEAR);
|
||||
dxstate.texMinFilter.set(D3DTEXF_LINEAR);
|
||||
dxstate.texMipFilter.set(D3DTEXF_NONE);
|
||||
} else {
|
||||
dxstate.texMagFilter.set(D3DTEXF_POINT);
|
||||
dxstate.texMinFilter.set(D3DTEXF_POINT);
|
||||
dxstate.texMipFilter.set(D3DTEXF_NONE);
|
||||
}
|
||||
dxstate.texMipFilter.set(D3DTEXF_NONE);
|
||||
dxstate.texMipLodBias.set(0);
|
||||
DrawActiveTexture(colorTexture, x, y, w, h, (float)PSP_CoreParameter().pixelWidth, (float)PSP_CoreParameter().pixelHeight, false, 480.0f / (float)vfb->width, 272.0f / (float)vfb->height);
|
||||
}
|
||||
/*
|
||||
|
@ -491,15 +491,13 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
|
||||
bool noMip = (gstate.texlevel & 0xFFFFFF) == 0x000001 || (gstate.texlevel & 0xFFFFFF) == 0x100001 ; // Fix texlevel at 0
|
||||
|
||||
float lodBias = 0.0;
|
||||
if (entry.maxLevel == 0) {
|
||||
// Enforce no mip filtering, for safety.
|
||||
minFilt &= 1; // no mipmaps yet
|
||||
} else {
|
||||
// TODO: Is this a signed value? Which direction?
|
||||
float lodBias = 0.0; // -(float)((gstate.texlevel >> 16) & 0xFF) / 16.0f;
|
||||
if (force || entry.lodBias != lodBias) {
|
||||
entry.lodBias = lodBias;
|
||||
}
|
||||
// Texture lod bias should be signed.
|
||||
lodBias = (float)(int)(s8)((gstate.texlevel >> 16) & 0xFF) / 16.0f;
|
||||
}
|
||||
|
||||
if ((g_Config.iTexFiltering == LINEAR || (g_Config.iTexFiltering == LINEARFMV && g_iNumVideos)) && !gstate.isColorTestEnabled()) {
|
||||
@ -519,6 +517,7 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
|
||||
dxstate.texMinFilter.set(MinFilt[minFilt]);
|
||||
dxstate.texMipFilter.set(MipFilt[minFilt]);
|
||||
dxstate.texMipLodBias.set(lodBias);
|
||||
dxstate.texMagFilter.set(MagFilt[magFilt]);
|
||||
dxstate.texAddressU.set(sClamp ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP);
|
||||
dxstate.texAddressV.set(tClamp ? D3DTADDRESS_CLAMP : D3DTADDRESS_WRAP);
|
||||
@ -939,7 +938,6 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||
entry->lastFrame = gpuStats.numFlips;
|
||||
entry->framebuffer = 0;
|
||||
entry->maxLevel = maxLevel;
|
||||
entry->lodBias = 0.0f;
|
||||
|
||||
entry->dim = gstate.getTextureDimension(0);
|
||||
entry->bufw = bufw;
|
||||
|
@ -104,7 +104,6 @@ private:
|
||||
u32 fullhash;
|
||||
u32 cluthash;
|
||||
int maxLevel;
|
||||
float lodBias;
|
||||
|
||||
bool Matches(u16 dim2, u8 format2, int maxLevel2);
|
||||
void ReleaseTexture() {
|
||||
|
@ -54,6 +54,7 @@ void DirectxState::Restore() {
|
||||
texMinFilter.restore(); count++;
|
||||
texMagFilter.restore(); count++;
|
||||
texMipFilter.restore(); count++;
|
||||
texMipLodBias.restore(); count++;
|
||||
texAddressU.restore(); count++;
|
||||
texAddressV.restore(); count++;
|
||||
|
||||
|
@ -73,6 +73,28 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
// Can't have FLOAT template parameters...
|
||||
template<D3DSAMPLERSTATETYPE state1, DWORD p1def>
|
||||
class DxSampler0State1Float {
|
||||
D3DSAMPLERSTATETYPE _state1;
|
||||
union {
|
||||
FLOAT p1;
|
||||
DWORD p1d;
|
||||
};
|
||||
public:
|
||||
DxSampler0State1Float() : _state1(state1), p1d(p1def) {
|
||||
DirectxState::state_count++;
|
||||
}
|
||||
|
||||
inline void set(FLOAT newp1) {
|
||||
p1 = newp1;
|
||||
pD3Ddevice->SetSamplerState(0, _state1, p1d);
|
||||
}
|
||||
void restore() {
|
||||
pD3Ddevice->SetSamplerState(0, _state1, p1d);
|
||||
}
|
||||
};
|
||||
|
||||
template<D3DRENDERSTATETYPE state1, DWORD p1def, D3DRENDERSTATETYPE state2, DWORD p2def>
|
||||
class DxState2 {
|
||||
D3DRENDERSTATETYPE _state1;
|
||||
@ -318,6 +340,7 @@ public:
|
||||
DxSampler0State1<D3DSAMP_MINFILTER, D3DTEXF_POINT> texMinFilter;
|
||||
DxSampler0State1<D3DSAMP_MAGFILTER, D3DTEXF_POINT> texMagFilter;
|
||||
DxSampler0State1<D3DSAMP_MIPFILTER, D3DTEXF_NONE> texMipFilter;
|
||||
DxSampler0State1Float<D3DSAMP_MIPMAPLODBIAS, 0> texMipLodBias;
|
||||
DxSampler0State1<D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP> texAddressU;
|
||||
DxSampler0State1<D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP> texAddressV;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user