mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Vulkan: Allow tex shaders to specify a max scale.
This commit is contained in:
parent
c99b4b118a
commit
c630d365cd
4 changed files with 7 additions and 0 deletions
|
@ -161,6 +161,7 @@ void LoadPostShaderInfo(const std::vector<std::string> &directories) {
|
|||
info.section = section.name();
|
||||
section.Get("Name", &info.name, section.name().c_str());
|
||||
section.Get("Compute", &temp, "");
|
||||
section.Get("MaxScale", &info.maxScale, 255);
|
||||
info.computeShaderFile = path + "/" + temp;
|
||||
|
||||
appendTextureShader(info);
|
||||
|
|
|
@ -70,6 +70,7 @@ struct TextureShaderInfo {
|
|||
std::string name;
|
||||
|
||||
std::string computeShaderFile;
|
||||
int maxScale;
|
||||
|
||||
bool operator == (const std::string &other) {
|
||||
return name == other;
|
||||
|
|
|
@ -394,6 +394,7 @@ void TextureCacheVulkan::CompileScalingShader() {
|
|||
if (copyCS_ != VK_NULL_HANDLE)
|
||||
vulkan_->Delete().QueueDeleteShaderModule(copyCS_);
|
||||
textureShader_.clear();
|
||||
maxScaleFactor_ = 255;
|
||||
} else if (uploadCS_ || copyCS_) {
|
||||
// No need to recreate.
|
||||
return;
|
||||
|
@ -417,6 +418,7 @@ void TextureCacheVulkan::CompileScalingShader() {
|
|||
_dbg_assert_msg_(copyCS_ != VK_NULL_HANDLE, "failed to compile copy shader");
|
||||
|
||||
textureShader_ = g_Config.sTextureShaderName;
|
||||
maxScaleFactor_ = shaderInfo->maxScale;
|
||||
}
|
||||
|
||||
void TextureCacheVulkan::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
|
||||
|
@ -762,6 +764,8 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
|
|||
VkFormat dstFmt = GetDestFormat(GETextureFormat(entry->format), gstate.getClutPaletteFormat());
|
||||
|
||||
int scaleFactor = standardScaleFactor_;
|
||||
if (scaleFactor > maxScaleFactor_)
|
||||
scaleFactor = maxScaleFactor_;
|
||||
|
||||
// Rachet down scale factor in low-memory mode.
|
||||
if (lowMemoryMode_) {
|
||||
|
|
|
@ -139,6 +139,7 @@ private:
|
|||
Vulkan2D *vulkan2D_;
|
||||
|
||||
std::string textureShader_;
|
||||
int maxScaleFactor_ = 255;
|
||||
VkShaderModule uploadCS_ = VK_NULL_HANDLE;
|
||||
VkShaderModule copyCS_ = VK_NULL_HANDLE;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue