1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Add FBInfo config options.

This commit is contained in:
Sergey Lipskiy 2016-02-03 22:18:40 +06:00
parent dca42610a8
commit ac8a9a9d5d
6 changed files with 41 additions and 15 deletions

View File

@ -52,8 +52,11 @@ void Config::resetToDefaults()
frameBufferEmulation.copyAuxToRDRAM = 0; frameBufferEmulation.copyAuxToRDRAM = 0;
frameBufferEmulation.copyToRDRAM = ctAsync; frameBufferEmulation.copyToRDRAM = ctAsync;
frameBufferEmulation.N64DepthCompare = 0; frameBufferEmulation.N64DepthCompare = 0;
frameBufferEmulation.aspect = 1; frameBufferEmulation.aspect = a43;
frameBufferEmulation.bufferSwapMode = bsOnVerticalInterrupt; frameBufferEmulation.bufferSwapMode = bsOnVerticalInterrupt;
frameBufferEmulation.fbInfoDisabled = 0;
frameBufferEmulation.fbInfoReadColorChunk = 0;
frameBufferEmulation.fbInfoReadDepthChunk = 1;
textureFilter.txCacheSize = 100 * gc_uMegabyte; textureFilter.txCacheSize = 100 * gc_uMegabyte;
textureFilter.txDump = 0; textureFilter.txDump = 0;

View File

@ -10,7 +10,8 @@
#define CONFIG_VERSION_FOUR 4U // Remove ValidityCheckMethod setting #define CONFIG_VERSION_FOUR 4U // Remove ValidityCheckMethod setting
#define CONFIG_VERSION_FIVE 5U // Add shader storage option #define CONFIG_VERSION_FIVE 5U // Add shader storage option
#define CONFIG_VERSION_SIX 6U // Change gamma correction options #define CONFIG_VERSION_SIX 6U // Change gamma correction options
#define CONFIG_VERSION_CURRENT CONFIG_VERSION_SIX #define CONFIG_VERSION_SEVEN 7U // Add FBInfo options
#define CONFIG_VERSION_CURRENT CONFIG_VERSION_SEVEN
#define BILINEAR_3POINT 0 #define BILINEAR_3POINT 0
#define BILINEAR_STANDARD 1 #define BILINEAR_STANDARD 1
@ -78,13 +79,19 @@ struct Config
struct { struct {
u32 enable; u32 enable;
u32 aspect; // 0: stretch ; 1: 4/3 ; 2: 16/9; 3: adjust
u32 bufferSwapMode; // 0: on VI update call; 1: on VI origin change; 2: on main frame buffer update
u32 N64DepthCompare;
u32 copyAuxToRDRAM; u32 copyAuxToRDRAM;
// Buffer read/write
u32 copyToRDRAM; u32 copyToRDRAM;
u32 copyDepthToRDRAM; u32 copyDepthToRDRAM;
u32 copyFromRDRAM; u32 copyFromRDRAM;
u32 N64DepthCompare; // FBInfo
u32 aspect; // 0: stretch ; 1: 4/3 ; 2: 16/9; 3: adjust u32 fbInfoSupported;
u32 bufferSwapMode; // 0: on VI update call; 1: on VI origin change; 2: on main frame buffer update u32 fbInfoDisabled;
u32 fbInfoReadColorChunk;
u32 fbInfoReadDepthChunk;
} frameBufferEmulation; } frameBufferEmulation;
struct struct

View File

@ -1,6 +1,6 @@
#include <list>
#include "FrameBufferInfoAPI.h" #include "FrameBufferInfoAPI.h"
#include "FrameBufferInfo.h" #include "FrameBufferInfo.h"
#include "Config.h"
#include "OpenGL.h" #include "OpenGL.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "DepthBuffer.h" #include "DepthBuffer.h"
@ -12,7 +12,7 @@ FBInfo fbInfo;
void FBInfo::reset() { void FBInfo::reset() {
m_supported = false; m_supported = false;
m_pWriteBuffer = nullptr; m_pWriteBuffer = m_pReadBuffer = nullptr;
} }
void FBInfo::Write(u32 addr, u32 size) void FBInfo::Write(u32 addr, u32 size)
@ -45,10 +45,19 @@ void FBInfo::Read(u32 addr)
if (pBuffer == nullptr || pBuffer == m_pWriteBuffer) if (pBuffer == nullptr || pBuffer == m_pWriteBuffer)
return; return;
if (pBuffer->m_isDepthBuffer) if (pBuffer->m_isDepthBuffer) {
FrameBuffer_CopyDepthBufferChunk(address); if (config.frameBufferEmulation.fbInfoReadDepthChunk != 0)
else FrameBuffer_CopyDepthBufferChunk(address);
FrameBuffer_CopyChunkToRDRAM(address); else if (pBuffer != m_pReadBuffer)
FrameBuffer_CopyDepthBuffer(address);
} else {
if (config.frameBufferEmulation.fbInfoReadColorChunk != 0)
FrameBuffer_CopyChunkToRDRAM(address);
else if (pBuffer != m_pReadBuffer)
FrameBuffer_CopyToRDRAM(address, true);
}
m_pReadBuffer = pBuffer;
} }
void FBInfo::GetInfo(void *pinfo) void FBInfo::GetInfo(void *pinfo)
@ -56,6 +65,10 @@ void FBInfo::GetInfo(void *pinfo)
// debugPrint("FBGetInfo\n"); // debugPrint("FBGetInfo\n");
FrameBufferInfo * pFBInfo = (FrameBufferInfo*)pinfo; FrameBufferInfo * pFBInfo = (FrameBufferInfo*)pinfo;
memset(pFBInfo, 0, sizeof(FrameBufferInfo)* 6); memset(pFBInfo, 0, sizeof(FrameBufferInfo)* 6);
if (config.frameBufferEmulation.fbInfoDisabled != 0)
return;
u32 idx = 0; u32 idx = 0;
DepthBuffer * pDepthBuffer = depthBufferList().getCurrent(); DepthBuffer * pDepthBuffer = depthBufferList().getCurrent();
if (pDepthBuffer != nullptr) { if (pDepthBuffer != nullptr) {
@ -66,6 +79,6 @@ void FBInfo::GetInfo(void *pinfo)
} }
frameBufferList().fillBufferInfo(&pFBInfo[idx], 6 - idx); frameBufferList().fillBufferInfo(&pFBInfo[idx], 6 - idx);
m_pWriteBuffer = nullptr; m_pWriteBuffer = m_pReadBuffer = nullptr;
m_supported = true; m_supported = true;
} }

View File

@ -35,6 +35,7 @@ public:
private: private:
const FrameBuffer * m_pWriteBuffer; const FrameBuffer * m_pWriteBuffer;
const FrameBuffer * m_pReadBuffer;
bool m_supported; bool m_supported;
}; };

View File

@ -9,6 +9,7 @@
#include "Combiner.h" #include "Combiner.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "DepthBuffer.h" #include "DepthBuffer.h"
#include "FrameBufferInfo.h"
#include "GBI.h" #include "GBI.h"
#include "PluginAPI.h" #include "PluginAPI.h"
#include "Config.h" #include "Config.h"
@ -209,7 +210,7 @@ void RSP_ProcessDList()
} }
} }
if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable) if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable && !fbInfo.isSupported())
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
RSP.busy = FALSE; RSP.busy = FALSE;

View File

@ -14,6 +14,7 @@
#include "CRC.h" #include "CRC.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "DepthBuffer.h" #include "DepthBuffer.h"
#include "FrameBufferInfo.h"
#include "VI.h" #include "VI.h"
#include "Config.h" #include "Config.h"
#include "Combiner.h" #include "Combiner.h"
@ -883,11 +884,11 @@ void gDPFullSync()
} }
const bool sync = config.frameBufferEmulation.copyToRDRAM == Config::ctSync; const bool sync = config.frameBufferEmulation.copyToRDRAM == Config::ctSync;
if (config.frameBufferEmulation.copyToRDRAM != Config::ctDisable) if (config.frameBufferEmulation.copyToRDRAM != Config::ctDisable && !fbInfo.isSupported())
FrameBuffer_CopyToRDRAM(gDP.colorImage.address, sync); FrameBuffer_CopyToRDRAM(gDP.colorImage.address, sync);
if (RSP.bLLE) { if (RSP.bLLE) {
if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable) if (config.frameBufferEmulation.copyDepthToRDRAM != Config::ctDisable && !fbInfo.isSupported())
FrameBuffer_CopyDepthBuffer(gDP.colorImage.address); FrameBuffer_CopyDepthBuffer(gDP.colorImage.address);
} }