mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Move frame buffer emulation options to Config.
This commit is contained in:
parent
28133f2387
commit
ee57f6ef47
|
@ -109,6 +109,13 @@ void Config_LoadConfig()
|
|||
config.texture.textureBitDepth = 1;
|
||||
config.enableHWLighting = FALSE;
|
||||
}
|
||||
|
||||
// manually set frame bufer emulation options
|
||||
config.frameBufferEmulation.copyToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyFromRDRAM = FALSE;
|
||||
config.frameBufferEmulation.ignoreCFB = TRUE;
|
||||
config.frameBufferEmulation.N64DepthCompare = FALSE;
|
||||
}
|
||||
|
||||
void Config_SaveConfig()
|
||||
|
|
5
Config.h
5
Config.h
|
@ -25,6 +25,11 @@ struct Config
|
|||
|
||||
struct {
|
||||
u32 enable;
|
||||
u32 copyToRDRAM;
|
||||
u32 copyDepthToRDRAM;
|
||||
u32 copyFromRDRAM;
|
||||
u32 ignoreCFB;
|
||||
u32 N64DepthCompare;
|
||||
} frameBufferEmulation;
|
||||
|
||||
u32 enableFog;
|
||||
|
|
|
@ -467,6 +467,13 @@ void Config_LoadConfig()
|
|||
}
|
||||
|
||||
fclose( f );
|
||||
|
||||
// manually set frame bufer emulation options
|
||||
config.frameBufferEmulation.copyToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyDepthToRDRAM = FALSE;
|
||||
config.frameBufferEmulation.copyFromRDRAM = FALSE;
|
||||
config.frameBufferEmulation.ignoreCFB = TRUE;
|
||||
config.frameBufferEmulation.N64DepthCompare = FALSE;
|
||||
}
|
||||
|
||||
void Config_DoConfig()
|
||||
|
|
|
@ -13,9 +13,7 @@ const GLuint ZlutImageUnit = 0;
|
|||
const GLuint TlutImageUnit = 1;
|
||||
const GLuint depthImageUnit = 2;
|
||||
|
||||
bool g_bN64DepthCompare = false;
|
||||
|
||||
void DepthBuffer_Init()
|
||||
void DepthBuffer_Init()
|
||||
{
|
||||
depthBuffer.current = NULL;
|
||||
depthBuffer.top = NULL;
|
||||
|
|
|
@ -26,8 +26,6 @@ extern const GLuint ZlutImageUnit;
|
|||
extern const GLuint TlutImageUnit;
|
||||
extern const GLuint depthImageUnit;
|
||||
|
||||
extern bool g_bN64DepthCompare;
|
||||
|
||||
void DepthBuffer_Init();
|
||||
void DepthBuffer_Destroy();
|
||||
void DepthBuffer_SetBuffer( u32 address );
|
||||
|
|
|
@ -13,11 +13,6 @@
|
|||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
|
||||
bool g_bCopyToRDRAM = false;
|
||||
bool g_bCopyFromRDRAM = false;
|
||||
bool g_bCopyDepthToRDRAM = false;
|
||||
bool g_bIgnoreCFB = true;
|
||||
|
||||
#ifndef GLES2
|
||||
const GLint monohromeInternalformat = GL_R8;
|
||||
const GLenum monohromeformat = GL_RED;
|
||||
|
@ -279,7 +274,7 @@ void FrameBuffer_SaveBuffer( u32 address, u16 format, u16 size, u16 width, u16 h
|
|||
FrameBuffer *current = frameBuffer.top;
|
||||
if (current != NULL && gDP.colorImage.height > 1) {
|
||||
current->endAddress = current->startAddress + (((current->width * gDP.colorImage.height) << current->size >> 1) - 1);
|
||||
if (!g_bCopyToRDRAM && !current->cleared)
|
||||
if (!config.frameBufferEmulation.copyToRDRAM && !current->cleared)
|
||||
gDPFillRDRAM(current->startAddress, 0, 0, current->width, gDP.colorImage.height, current->width, current->size, frameBuffer.top->fillcolor);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ struct FrameBufferList
|
|||
};
|
||||
|
||||
extern FrameBufferList frameBuffer;
|
||||
extern bool g_bCopyToRDRAM;
|
||||
extern bool g_bCopyDepthToRDRAM;
|
||||
extern bool g_bCopyFromRDRAM;
|
||||
extern bool g_bIgnoreCFB;
|
||||
|
||||
void FrameBuffer_Init();
|
||||
void FrameBuffer_Destroy();
|
||||
|
|
|
@ -410,7 +410,7 @@ GLSLCombiner::GLSLCombiner(Combiner *_color, Combiner *_alpha) {
|
|||
|
||||
strcat(fragment_shader, " if (!alpha_test(gl_FragColor.a)) discard; \n");
|
||||
if (OGL.bImageTexture) {
|
||||
if (g_bN64DepthCompare)
|
||||
if (config.frameBufferEmulation.N64DepthCompare)
|
||||
strcat(fragment_shader, " if (!depth_compare()) discard; \n");
|
||||
else
|
||||
strcat(fragment_shader, " depth_compare(); \n");
|
||||
|
|
|
@ -192,7 +192,7 @@ void OGL_InitStates()
|
|||
glDepthMask( GL_FALSE );
|
||||
glEnable( GL_SCISSOR_TEST );
|
||||
|
||||
if (g_bN64DepthCompare) {
|
||||
if (config.frameBufferEmulation.N64DepthCompare) {
|
||||
glDisable( GL_DEPTH_TEST );
|
||||
glDisable( GL_POLYGON_OFFSET_FILL );
|
||||
glDepthFunc( GL_ALWAYS );
|
||||
|
@ -608,7 +608,7 @@ void OGL_UpdateStates()
|
|||
else
|
||||
Combiner_SetCombine(gDP.combine.mux);
|
||||
|
||||
if (!g_bN64DepthCompare && (gDP.changed & CHANGED_RENDERMODE) != 0) {
|
||||
if (!config.frameBufferEmulation.N64DepthCompare && (gDP.changed & CHANGED_RENDERMODE) != 0) {
|
||||
if (gDP.otherMode.depthCompare) {
|
||||
glEnable( GL_DEPTH_TEST );
|
||||
glDepthFunc( GL_LEQUAL );
|
||||
|
|
5
RSP.cpp
5
RSP.cpp
|
@ -8,6 +8,7 @@
|
|||
#include "FrameBuffer.h"
|
||||
#include "DepthBuffer.h"
|
||||
#include "GBI.h"
|
||||
#include "Config.h"
|
||||
|
||||
RSPInfo RSP;
|
||||
|
||||
|
@ -211,9 +212,9 @@ void RSP_ProcessDList()
|
|||
GBI.cmd[RSP.cmd]( w0, w1 );
|
||||
}
|
||||
|
||||
if (g_bCopyToRDRAM)
|
||||
if (config.frameBufferEmulation.copyToRDRAM)
|
||||
FrameBuffer_CopyToRDRAM( gDP.colorImage.address, false );
|
||||
if (g_bCopyDepthToRDRAM)
|
||||
if (config.frameBufferEmulation.copyDepthToRDRAM)
|
||||
FrameBuffer_CopyDepthBuffer( gDP.colorImage.address );
|
||||
|
||||
RSP.busy = FALSE;
|
||||
|
|
6
VI.cpp
6
VI.cpp
|
@ -57,7 +57,7 @@ void VI_UpdateScreen()
|
|||
VI.vStart = VI.vEnd = 0;
|
||||
|
||||
if (config.frameBufferEmulation.enable) {
|
||||
const bool bCFB = !g_bIgnoreCFB && (gSP.changed&CHANGED_CPU_FB_WRITE) == CHANGED_CPU_FB_WRITE;
|
||||
const bool bCFB = !config.frameBufferEmulation.ignoreCFB && (gSP.changed&CHANGED_CPU_FB_WRITE) == CHANGED_CPU_FB_WRITE;
|
||||
const bool bNeedUpdate = bCFB ? true : (*REG.VI_ORIGIN != VI.lastOrigin);// && gDP.colorImage.changed;
|
||||
|
||||
if (bNeedUpdate) {
|
||||
|
@ -69,9 +69,9 @@ void VI_UpdateScreen()
|
|||
if (VI.height > 0 && size > G_IM_SIZ_8b)
|
||||
FrameBuffer_SaveBuffer( *REG.VI_ORIGIN, G_IM_FMT_RGBA, size, *REG.VI_WIDTH, VI.height );
|
||||
}
|
||||
if ((((*REG.VI_STATUS)&3) > 0) && (g_bCopyFromRDRAM || bCFB)) {
|
||||
if ((((*REG.VI_STATUS)&3) > 0) && (config.frameBufferEmulation.copyFromRDRAM || bCFB)) {
|
||||
VI_UpdateSize();
|
||||
FrameBuffer_CopyFromRDRAM( *REG.VI_ORIGIN, g_bCopyFromRDRAM && !bCFB );
|
||||
FrameBuffer_CopyFromRDRAM( *REG.VI_ORIGIN, config.frameBufferEmulation.copyFromRDRAM && !bCFB );
|
||||
}
|
||||
FrameBuffer_RenderBuffer( *REG.VI_ORIGIN );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user