mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-07 22:37:15 +00:00
Switch texture scaling shaders to a fixed scale model, preparing for the next change.
This commit is contained in:
parent
c111d6cc2d
commit
6349704924
@ -208,10 +208,11 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector<Path> &direct
|
||||
info.section = section.name();
|
||||
section.Get("Name", &info.name, section.name().c_str());
|
||||
section.Get("Compute", &temp, "");
|
||||
section.Get("MaxScale", &info.maxScale, 255);
|
||||
section.Get("Scale", &info.scaleFactor, 0);
|
||||
info.computeShaderFile = path / temp;
|
||||
|
||||
appendTextureShader(info);
|
||||
if (info.scaleFactor >= 2 && info.scaleFactor < 8) {
|
||||
appendTextureShader(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,9 @@ struct TextureShaderInfo {
|
||||
std::string name;
|
||||
|
||||
Path computeShaderFile;
|
||||
int maxScale;
|
||||
|
||||
// Upscaling shaders have a fixed scale factor.
|
||||
int scaleFactor;
|
||||
|
||||
bool operator == (const std::string &other) {
|
||||
return name == other;
|
||||
|
@ -299,7 +299,7 @@ void TextureCacheVulkan::CompileScalingShader() {
|
||||
if (uploadCS_ != VK_NULL_HANDLE)
|
||||
vulkan_->Delete().QueueDeleteShaderModule(uploadCS_);
|
||||
textureShader_.clear();
|
||||
maxScaleFactor_ = 255;
|
||||
shaderScaleFactor_ = 0; // no texture scaling shader
|
||||
} else if (uploadCS_) {
|
||||
// No need to recreate.
|
||||
return;
|
||||
@ -321,7 +321,7 @@ void TextureCacheVulkan::CompileScalingShader() {
|
||||
_dbg_assert_msg_(uploadCS_ != VK_NULL_HANDLE, "failed to compile upload shader");
|
||||
|
||||
textureShader_ = g_Config.sTextureShaderName;
|
||||
maxScaleFactor_ = shaderInfo->maxScale;
|
||||
shaderScaleFactor_ = shaderInfo->scaleFactor;
|
||||
}
|
||||
|
||||
void TextureCacheVulkan::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
|
||||
@ -677,11 +677,15 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
}
|
||||
|
||||
int scaleFactor = standardScaleFactor_;
|
||||
if (scaleFactor > maxScaleFactor_)
|
||||
scaleFactor = maxScaleFactor_;
|
||||
bool hardwareScaling = g_Config.bTexHardwareScaling && uploadCS_ != VK_NULL_HANDLE;
|
||||
if (hardwareScaling) {
|
||||
_assert_(shaderScaleFactor_ != 0);
|
||||
scaleFactor = shaderScaleFactor_;
|
||||
}
|
||||
|
||||
// Rachet down scale factor in low-memory mode.
|
||||
if (lowMemoryMode_) {
|
||||
// TODO: I think really we should just turn it off?
|
||||
if (lowMemoryMode_ && !hardwareScaling) {
|
||||
// Keep it even, though, just in case of npot troubles.
|
||||
scaleFactor = scaleFactor > 4 ? 4 : (scaleFactor > 2 ? 2 : 1);
|
||||
}
|
||||
@ -696,11 +700,10 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
||||
badMipSizes = false;
|
||||
}
|
||||
|
||||
bool hardwareScaling = g_Config.bTexHardwareScaling && uploadCS_ != VK_NULL_HANDLE;
|
||||
|
||||
// Don't scale the PPGe texture.
|
||||
if (entry->addr > 0x05000000 && entry->addr < PSP_GetKernelMemoryEnd())
|
||||
if (entry->addr > 0x05000000 && entry->addr < PSP_GetKernelMemoryEnd()) {
|
||||
scaleFactor = 1;
|
||||
}
|
||||
if ((entry->status & TexCacheEntry::STATUS_CHANGE_FREQUENT) != 0 && scaleFactor != 1 && !hardwareScaling) {
|
||||
// Remember for later that we /wanted/ to scale this texture.
|
||||
entry->status |= TexCacheEntry::STATUS_TO_SCALE;
|
||||
|
@ -135,7 +135,7 @@ private:
|
||||
Vulkan2D *vulkan2D_;
|
||||
|
||||
std::string textureShader_;
|
||||
int maxScaleFactor_ = 255;
|
||||
int shaderScaleFactor_ = 0;
|
||||
VkShaderModule uploadCS_ = VK_NULL_HANDLE;
|
||||
|
||||
// Bound state to emulate an API similar to the others
|
||||
|
@ -533,6 +533,11 @@ void GameSettingsScreen::CreateViews() {
|
||||
static const char *texScaleLevels[] = {"Off", "2x", "3x"};
|
||||
#endif
|
||||
|
||||
static const char *texScaleAlgos[] = { "xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic", };
|
||||
PopupMultiChoice *texScalingType = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gr->T("Upscale Type"), texScaleAlgos, 0, ARRAY_SIZE(texScaleAlgos), gr->GetName(), screenManager()));
|
||||
texScalingType->SetEnabledFunc([]() {
|
||||
return !g_Config.bSoftwareRendering && !UsingHardwareTextureScaling();
|
||||
});
|
||||
PopupMultiChoice *texScalingChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingLevel, gr->T("Upscale Level"), texScaleLevels, 1, ARRAY_SIZE(texScaleLevels), gr->GetName(), screenManager()));
|
||||
// TODO: Better check? When it won't work, it scales down anyway.
|
||||
if (!gl_extensions.OES_texture_npot && GetGPUBackend() == GPUBackend::OPENGL) {
|
||||
@ -545,11 +550,7 @@ void GameSettingsScreen::CreateViews() {
|
||||
}
|
||||
return UI::EVENT_CONTINUE;
|
||||
});
|
||||
texScalingChoice->SetDisabledPtr(&g_Config.bSoftwareRendering);
|
||||
|
||||
static const char *texScaleAlgos[] = { "xBRZ", "Hybrid", "Bicubic", "Hybrid + Bicubic", };
|
||||
PopupMultiChoice *texScalingType = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexScalingType, gr->T("Upscale Type"), texScaleAlgos, 0, ARRAY_SIZE(texScaleAlgos), gr->GetName(), screenManager()));
|
||||
texScalingType->SetEnabledFunc([]() {
|
||||
texScalingChoice->SetEnabledFunc([]() {
|
||||
return !g_Config.bSoftwareRendering && !UsingHardwareTextureScaling();
|
||||
});
|
||||
|
||||
|
@ -151,13 +151,14 @@ Fragment=psp_color.fsh
|
||||
Vertex=fxaa.vsh
|
||||
[Tex4xBRZ]
|
||||
Type=Texture
|
||||
Name=4xBRZ
|
||||
Name=4xBRZ (4x)
|
||||
Author=Hyllian
|
||||
Compute=tex_4xbrz.csh
|
||||
VendorBlacklist=ARM
|
||||
Scale=4
|
||||
[TexMMPX]
|
||||
Type=Texture
|
||||
Name=MMPX
|
||||
Name=MMPX (2x)
|
||||
Author=Morgan McGuire and Mara Gagiu
|
||||
Compute=tex_mmpx.csh
|
||||
MaxScale=2
|
||||
Scale=2
|
||||
|
Loading…
x
Reference in New Issue
Block a user