mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-02 20:00:35 +00:00
Avoid forcing nearest/disabling linear if possible.
If we know that the test is trivially true, we don't need to worry about the test. May help #4405.
This commit is contained in:
parent
6fcf25b399
commit
99458d7797
@ -52,7 +52,7 @@ const bool safeDestFactors[16] = {
|
||||
true, //GE_DSTBLEND_FIXB,
|
||||
};
|
||||
|
||||
static bool IsAlphaTestTriviallyTrue() {
|
||||
bool IsAlphaTestTriviallyTrue() {
|
||||
switch (gstate.getAlphaTestFunction()) {
|
||||
case GE_COMP_NEVER:
|
||||
return false;
|
||||
@ -215,7 +215,7 @@ StencilValueType ReplaceAlphaWithStencilType() {
|
||||
return STENCIL_VALUE_UNKNOWN;
|
||||
}
|
||||
|
||||
static bool IsColorTestTriviallyTrue() {
|
||||
bool IsColorTestTriviallyTrue() {
|
||||
switch (gstate.getColorTestFunction()) {
|
||||
case GE_COMP_NEVER:
|
||||
return false;
|
||||
|
@ -58,6 +58,8 @@ enum ReplaceAlphaType {
|
||||
REPLACE_ALPHA_DUALSOURCE = 2,
|
||||
};
|
||||
|
||||
bool IsAlphaTestTriviallyTrue();
|
||||
bool IsColorTestTriviallyTrue();
|
||||
StencilValueType ReplaceAlphaWithStencilType();
|
||||
ReplaceAlphaType ReplaceAlphaWithStencil();
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/GLES/TextureCache.h"
|
||||
#include "GPU/GLES/Framebuffer.h"
|
||||
#include "GPU/GLES/FragmentShaderGenerator.h"
|
||||
#include "GPU/Common/TextureDecoder.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
@ -521,12 +522,18 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((g_Config.iTexFiltering == LINEAR && !gstate.isColorTestEnabled() && !gstate.isAlphaTestEnabled()) || (g_Config.iTexFiltering == LINEARFMV && g_iNumVideos)) {
|
||||
if (g_Config.iTexFiltering == LINEARFMV && g_iNumVideos > 0 && (entry.dim & 0xF) >= 9) {
|
||||
magFilt |= 1;
|
||||
minFilt |= 1;
|
||||
}
|
||||
if (g_Config.iTexFiltering == LINEAR && (!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue())) {
|
||||
if (!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue()) {
|
||||
magFilt |= 1;
|
||||
minFilt |= 1;
|
||||
}
|
||||
}
|
||||
// Force Nearest when color test enabled and rendering resolution greater than 480x272
|
||||
if (g_Config.iTexFiltering == NEAREST || (gstate.isColorTestEnabled() && g_Config.iInternalResolution != 1 && gstate.isModeThrough())) {
|
||||
if (g_Config.iTexFiltering == NEAREST || ((gstate.isColorTestEnabled() && !IsColorTestTriviallyTrue()) && g_Config.iInternalResolution != 1 && gstate.isModeThrough())) {
|
||||
magFilt &= ~1;
|
||||
minFilt &= ~1;
|
||||
}
|
||||
@ -878,12 +885,12 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) {
|
||||
entry->framebuffer->last_frame_used = gpuStats.numFlips;
|
||||
|
||||
// We need to force it, since we may have set it on a texture before attaching.
|
||||
UpdateSamplingParams(*entry, true);
|
||||
gstate_c.curTextureWidth = entry->framebuffer->width;
|
||||
gstate_c.curTextureHeight = entry->framebuffer->height;
|
||||
gstate_c.flipTexture = true;
|
||||
gstate_c.textureFullAlpha = entry->framebuffer->format == GE_FORMAT_565;
|
||||
gstate_c.textureSimpleAlpha = false;
|
||||
UpdateSamplingParams(*entry, true);
|
||||
} else {
|
||||
if (entry->framebuffer->fbo)
|
||||
entry->framebuffer->fbo = 0;
|
||||
@ -1296,15 +1303,15 @@ void TextureCache::SetTexture(bool force) {
|
||||
float anisotropyLevel = (float) aniso > maxAnisotropyLevel ? maxAnisotropyLevel : (float) aniso;
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropyLevel);
|
||||
|
||||
gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL;
|
||||
gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN;
|
||||
|
||||
UpdateSamplingParams(*entry, true);
|
||||
|
||||
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
//glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
gstate_c.textureFullAlpha = entry->GetAlphaStatus() == TexCacheEntry::STATUS_ALPHA_FULL;
|
||||
gstate_c.textureSimpleAlpha = entry->GetAlphaStatus() != TexCacheEntry::STATUS_ALPHA_UNKNOWN;
|
||||
}
|
||||
|
||||
GLenum TextureCache::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user