Remove global num videos hack.

This commit is contained in:
Unknown W. Brackets 2016-05-01 08:53:48 -07:00
parent 99d29356d7
commit f5b93bc6f0
8 changed files with 15 additions and 30 deletions

View File

@ -39,8 +39,6 @@ extern "C" {
}
#endif // USE_FFMPEG
int g_iNumVideos = 0;
#ifdef USE_FFMPEG
static AVPixelFormat getSwsFormat(int pspFormat)
{
@ -149,12 +147,10 @@ MediaEngine::MediaEngine(): m_pdata(0) {
m_ringbuffersize = 0;
m_mpegheaderReadPos = 0;
m_audioType = PSP_CODEC_AT3PLUS; // in movie, we use only AT3+ audio
g_iNumVideos++;
}
MediaEngine::~MediaEngine() {
closeMedia();
g_iNumVideos--;
}
void MediaEngine::closeMedia() {

View File

@ -36,9 +36,6 @@
// Videos should be updated every few frames, so we forge quickly.
#define VIDEO_DECIMATE_AGE 4
// Ugly.
extern int g_iNumVideos;
TextureCacheCommon::TextureCacheCommon()
: cacheSizeEstimate_(0), nextTexture_(nullptr),
clutLastFormat_(0xFFFFFFFF), clutTotalBytes_(0), clutMaxBytes_(0), clutRenderAddress_(0xFFFFFFFF) {
@ -79,7 +76,7 @@ int TextureCacheCommon::AttachedDrawingHeight() {
return 0;
}
void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, u8 maxLevel) {
void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, u8 maxLevel, u32 addr) {
minFilt = gstate.texfilter & 0x7;
magFilt = (gstate.texfilter >> 8) & 1;
sClamp = gstate.isTexCoordClampedS();
@ -96,9 +93,12 @@ void TextureCacheCommon::GetSamplingParams(int &minFilt, int &magFilt, bool &sCl
lodBias = (float)(int)(s8)((gstate.texlevel >> 16) & 0xFF) / 16.0f;
}
if (g_Config.iTexFiltering == TEX_FILTER_LINEAR_VIDEO && g_iNumVideos > 0 && (gstate.getTextureDimension(0) & 0xF) >= 9) {
magFilt |= 1;
minFilt |= 1;
if (g_Config.iTexFiltering == TEX_FILTER_LINEAR_VIDEO) {
bool isVideo = videos_.find(addr & 0x3FFFFFFF) != videos_.end();
if (isVideo) {
magFilt |= 1;
minFilt |= 1;
}
}
if (g_Config.iTexFiltering == TEX_FILTER_LINEAR && (!gstate.isColorTestEnabled() || IsColorTestTriviallyTrue())) {
if (!gstate.isAlphaTestEnabled() || IsAlphaTestTriviallyTrue()) {
@ -309,6 +309,7 @@ void TextureCacheCommon::NotifyConfigChanged() {
}
void TextureCacheCommon::NotifyVideoUpload(u32 addr, int size, int width, GEBufferFormat fmt) {
addr &= 0x3FFFFFFF;
videos_[addr] = gpuStats.numFlips;
}

View File

@ -149,7 +149,7 @@ protected:
void *RearrangeBuf(void *inBuf, u32 inRowBytes, u32 outRowBytes, int h, bool allowInPlace = true);
u32 EstimateTexMemoryUsage(const TexCacheEntry *entry);
void GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, u8 maxLevel);
void GetSamplingParams(int &minFilt, int &magFilt, bool &sClamp, bool &tClamp, float &lodBias, u8 maxLevel, u32 addr);
void UpdateMaxSeenV(bool throughMode);
virtual bool AttachFramebuffer(TexCacheEntry *entry, u32 address, VirtualFramebuffer *framebuffer, u32 texaddrOffset = 0) = 0;

View File

@ -38,8 +38,6 @@
#include "math/math_util.h"
extern int g_iNumVideos;
namespace DX9 {
#define INVALID_TEX (LPDIRECT3DTEXTURE9)(-1)
@ -503,7 +501,7 @@ void TextureCacheDX9::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr);
if (entry.maxLevel != 0) {
GETexLevelMode mode = gstate.getTexLevelMode();
@ -543,7 +541,7 @@ void TextureCacheDX9::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHe
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0, 0);
dxstate.texMinFilter.set(MinFilt[minFilt]);
dxstate.texMipFilter.set(MipFilt[minFilt]);

View File

@ -50,8 +50,6 @@
// #define DEBUG_READ_PIXELS 1
extern int g_iNumVideos;
static const char tex_fs[] =
#ifdef USING_GLES2
"precision mediump float;\n"

View File

@ -71,9 +71,6 @@
#define INVALID_TEX -1
// Hack!
extern int g_iNumVideos;
TextureCache::TextureCache() : secondCacheSizeEstimate_(0), clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL), texelsScaledThisFrame_(0) {
timesInvalidatedAllThisFrame_ = 0;
lastBoundTexture = INVALID_TEX;
@ -490,7 +487,7 @@ void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr);
if (entry.maxLevel != 0) {
if (force || entry.lodBias != lodBias) {
@ -544,7 +541,7 @@ void TextureCache::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeigh
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0, 0);
minFilt &= 1; // framebuffers can't mipmap.

View File

@ -52,8 +52,6 @@
#include "UI/OnScreenDisplay.h"
extern int g_iNumVideos;
const VkFormat framebufFormat = VK_FORMAT_R8G8B8A8_UNORM;
static const char tex_fs[] = R"(#version 400

View File

@ -83,9 +83,6 @@ static const VkComponentMapping VULKAN_1555_SWIZZLE = { VK_COMPONENT_SWIZZLE_B,
static const VkComponentMapping VULKAN_565_SWIZZLE = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
static const VkComponentMapping VULKAN_8888_SWIZZLE = { VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A };
// Hack!
extern int g_iNumVideos;
SamplerCache::~SamplerCache() {
for (auto iter : cache_) {
vulkan_->Delete().QueueDeleteSampler(iter.second);
@ -508,7 +505,7 @@ void TextureCacheVulkan::UpdateSamplingParams(TexCacheEntry &entry, SamplerCache
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, entry.maxLevel, entry.addr);
key.minFilt = minFilt & 1;
key.mipEnable = (minFilt >> 2) & 1;
key.mipFilt = (minFilt >> 1) & 1;
@ -549,7 +546,7 @@ void TextureCacheVulkan::SetFramebufferSamplingParams(u16 bufferWidth, u16 buffe
bool sClamp;
bool tClamp;
float lodBias;
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0);
GetSamplingParams(minFilt, magFilt, sClamp, tClamp, lodBias, 0, 0);
key.minFilt = minFilt & 1;
key.mipFilt = 0;