mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Unify/centralize SetFramebufferSamplingParams. Some include cleanup.
This commit is contained in:
1 parent
d8263d50f4
commit
5190f85c8e
16 files changed
+33
-87
No files matched your search
@@ -252,6 +252,24 @@ void TextureCacheCommon::UpdateSamplingParams(int maxLevel, u32 texAddr, Sampler
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheCommon::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key) {
|
||||
UpdateSamplingParams(0, 0, key);
|
||||
|
||||
key.mipEnable = false;
|
||||
key.minFilt &= 1;
|
||||
key.mipFilt = 0;
|
||||
key.magFilt &= 1;
|
||||
key.aniso = 0.0;
|
||||
|
||||
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
if (w != bufferWidth || h != bufferHeight) {
|
||||
key.sClamp = true;
|
||||
key.tClamp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheCommon::UpdateMaxSeenV(TexCacheEntry *entry, bool throughMode) {
|
||||
// If the texture is >= 512 pixels tall...
|
||||
if (entry->dim >= 0x900) {
|
||||
|
||||
@@ -284,8 +284,9 @@ protected:
|
||||
}
|
||||
|
||||
u32 EstimateTexMemoryUsage(const TexCacheEntry *entry);
|
||||
void GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, int maxLevel, u32 addr, GETexLevelMode &mode);
|
||||
|
||||
void UpdateSamplingParams(int maxLevel, u32 texAddr, SamplerCacheKey &key); // Used by D3D11 and Vulkan.
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
void UpdateMaxSeenV(TexCacheEntry *entry, bool throughMode);
|
||||
|
||||
FramebufferMatchInfo MatchFramebuffer(const TextureDefinition &entry, VirtualFramebuffer *framebuffer, u32 texaddrOffset, FramebufferNotificationChannel channel) const;
|
||||
|
||||
@@ -17,19 +17,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <d3d11.h>
|
||||
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/D3D11/DrawEngineD3D11.h"
|
||||
#include "GPU/D3D11/TextureCacheD3D11.h"
|
||||
#include "GPU/D3D11/DepalettizeShaderD3D11.h"
|
||||
#include "GPU/Common/VertexDecoderCommon.h"
|
||||
|
||||
class FramebufferManagerD3D11;
|
||||
class ShaderManagerD3D11;
|
||||
class LinkedShaderD3D11;
|
||||
class TextureCacheD3D11;
|
||||
|
||||
class GPU_D3D11 : public GPUCommon {
|
||||
public:
|
||||
|
||||
@@ -156,24 +156,6 @@ void TextureCacheD3D11::InvalidateLastTexture(TexCacheEntry *entry) {
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheD3D11::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key) {
|
||||
UpdateSamplingParams(0, 0, key);
|
||||
|
||||
key.mipEnable = false;
|
||||
key.minFilt &= 1;
|
||||
key.mipFilt = 0;
|
||||
key.magFilt &= 1;
|
||||
|
||||
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
|
||||
// This happens whether we have OES_texture_npot or not.
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
if (w != bufferWidth || h != bufferHeight) {
|
||||
key.sClamp = true;
|
||||
key.tClamp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheD3D11::StartFrame() {
|
||||
InvalidateLastTexture();
|
||||
timesInvalidatedAllThisFrame_ = 0;
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
void ForgetLastTexture() override;
|
||||
void InvalidateLastTexture(TexCacheEntry *entry = nullptr) override;
|
||||
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/Directx9/FramebufferManagerDX9.h"
|
||||
#include "GPU/Directx9/DrawEngineDX9.h"
|
||||
#include "GPU/Directx9/TextureCacheDX9.h"
|
||||
#include "GPU/Directx9/DepalettizeShaderDX9.h"
|
||||
#include "GPU/Common/VertexDecoderCommon.h"
|
||||
|
||||
@@ -31,6 +30,7 @@ namespace DX9 {
|
||||
|
||||
class ShaderManagerDX9;
|
||||
class LinkedShaderDX9;
|
||||
class TextureCacheDX9;
|
||||
|
||||
class GPU_DX9 : public GPUCommon {
|
||||
public:
|
||||
|
||||
@@ -119,23 +119,6 @@ D3DFORMAT getClutDestFormat(GEPaletteFormat format) {
|
||||
return D3DFMT_A8R8G8B8;
|
||||
}
|
||||
|
||||
void TextureCacheDX9::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key) {
|
||||
UpdateSamplingParams(0, 0, key);
|
||||
|
||||
key.mipEnable = false;
|
||||
key.minFilt &= 1;
|
||||
key.mipFilt = 0;
|
||||
key.magFilt &= 1;
|
||||
|
||||
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
if (w != bufferWidth || h != bufferHeight) {
|
||||
key.sClamp = true;
|
||||
key.tClamp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheDX9::ApplySamplingParams(const SamplerCacheKey &key) {
|
||||
dxstate.texMinFilter.set(key.minFilt ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
dxstate.texMipFilter.set(key.mipFilt ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
|
||||
@@ -52,8 +52,6 @@ public:
|
||||
void ForgetLastTexture() override;
|
||||
void InvalidateLastTexture(TexCacheEntry *entry = nullptr) override;
|
||||
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override;
|
||||
|
||||
protected:
|
||||
|
||||
+3
-3
@@ -17,17 +17,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/GLES/FramebufferManagerGLES.h"
|
||||
#include "GPU/GLES/DrawEngineGLES.h"
|
||||
#include "GPU/GLES/TextureCacheGLES.h"
|
||||
#include "GPU/GLES/DepalettizeShaderGLES.h"
|
||||
#include "GPU/GLES/FragmentTestCacheGLES.h"
|
||||
|
||||
class ShaderManagerGLES;
|
||||
class TextureCacheGLES;
|
||||
class LinkedShader;
|
||||
|
||||
class GPU_GLES : public GPUCommon {
|
||||
|
||||
@@ -130,20 +130,6 @@ void TextureCacheGLES::ApplySamplingParams(const SamplerCacheKey &key) {
|
||||
MagFiltGL[magKey], key.minFilt ? GL_LINEAR : GL_NEAREST, aniso);
|
||||
}
|
||||
|
||||
void TextureCacheGLES::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key) {
|
||||
UpdateSamplingParams(0, 0, key);
|
||||
key.mipEnable = false; // framebuffers can't mipmap.
|
||||
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
|
||||
// This happens whether we have OES_texture_npot or not.
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
if (w != bufferWidth || h != bufferHeight) {
|
||||
key.sClamp = true;
|
||||
key.tClamp = true;
|
||||
}
|
||||
key.aniso = 0.0f;
|
||||
}
|
||||
|
||||
static void ConvertColors(void *dstBuf, const void *srcBuf, Draw::DataFormat dstFmt, int numPixels) {
|
||||
const u32 *src = (const u32 *)srcBuf;
|
||||
u32 *dst = (u32 *)dstBuf;
|
||||
|
||||
@@ -63,7 +63,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override;
|
||||
|
||||
void DeviceLost();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Common/Vulkan/VulkanImage.h"
|
||||
#include "GPU/Vulkan/GPU_Vulkan.h"
|
||||
#include "GPU/Vulkan/VulkanUtil.h"
|
||||
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
||||
|
||||
#undef DrawText
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "GPU/GPUCommon.h"
|
||||
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
||||
#include "GPU/Vulkan/PipelineManagerVulkan.h"
|
||||
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
||||
#include "GPU/Vulkan/DepalettizeShaderVulkan.h"
|
||||
|
||||
class FramebufferManagerVulkan;
|
||||
class ShaderManagerVulkan;
|
||||
class LinkedShader;
|
||||
class TextureCacheVulkan;
|
||||
|
||||
class GPU_Vulkan : public GPUCommon {
|
||||
public:
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "GPU/Vulkan/GPU_Vulkan.h"
|
||||
#include "GPU/Vulkan/PipelineManagerVulkan.h"
|
||||
#include "GPU/Vulkan/TextureCacheVulkan.h"
|
||||
#include "GPU/Vulkan/FramebufferManagerVulkan.h"
|
||||
#include "GPU/Vulkan/ShaderManagerVulkan.h"
|
||||
#include "GPU/Vulkan/DrawEngineVulkan.h"
|
||||
|
||||
@@ -439,25 +439,6 @@ static const VkFilter MagFiltVK[2] = {
|
||||
VK_FILTER_LINEAR
|
||||
};
|
||||
|
||||
void TextureCacheVulkan::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key) {
|
||||
UpdateSamplingParams(0, 0, key);
|
||||
|
||||
key.mipEnable = false;
|
||||
key.minFilt &= 1;
|
||||
key.mipFilt = 0;
|
||||
key.magFilt &= 1;
|
||||
|
||||
// Often the framebuffer will not match the texture size. We'll wrap/clamp in the shader in that case.
|
||||
// This happens whether we have OES_texture_npot or not.
|
||||
int w = gstate.getTextureWidth(0);
|
||||
int h = gstate.getTextureHeight(0);
|
||||
|
||||
if (w != bufferWidth || h != bufferHeight) {
|
||||
key.sClamp = true;
|
||||
key.tClamp = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCacheVulkan::StartFrame() {
|
||||
InvalidateLastTexture();
|
||||
depalShaderCache_->Decimate();
|
||||
|
||||
@@ -100,7 +100,6 @@ public:
|
||||
imageView = imageView_;
|
||||
sampler = curSampler_;
|
||||
}
|
||||
void SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight, SamplerCacheKey &key);
|
||||
|
||||
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level) override;
|
||||
|
||||
|
||||
Reference in new issue
Block a user