gsdx ogl: add the option force_texture_clear for test purpose

Might be completely useless.

1 => always clear framebuffers and textures to black (aka 0)
2 => always clear framebuffers and textures to red
This commit is contained in:
Gregory Hainaut 2016-06-24 18:41:55 +02:00
parent 36dd50005a
commit 79587215bb
4 changed files with 43 additions and 13 deletions

View File

@ -52,6 +52,7 @@ FILE* GSDeviceOGL::m_debug_gl_file = NULL;
GSDeviceOGL::GSDeviceOGL() GSDeviceOGL::GSDeviceOGL()
: m_msaa(0) : m_msaa(0)
, m_force_texture_clear(0)
, m_window(NULL) , m_window(NULL)
, m_fbo(0) , m_fbo(0)
, m_fbo_read(0) , m_fbo_read(0)
@ -150,15 +151,19 @@ GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt
} }
// NOTE: I'm not sure RenderTarget always need to be cleared. It could be costly for big upscale. // NOTE: I'm not sure RenderTarget always need to be cleared. It could be costly for big upscale.
switch(type) // FIXME: it will be more logical to do it in FetchSurface. This code is only called at first creation
{ // of the texture. However we could reuse a deleted texture.
case GSTexture::RenderTarget: if (m_force_texture_clear == 0) {
ClearRenderTarget(t, 0); switch(type)
break; {
case GSTexture::DepthStencil: case GSTexture::RenderTarget:
ClearDepth(t, 0); ClearRenderTarget(t, 0);
// No need to clear the stencil now. break;
break; case GSTexture::DepthStencil:
ClearDepth(t, 0);
// No need to clear the stencil now.
break;
}
} }
return t; return t;
@ -166,7 +171,31 @@ GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, bool msaa, int fmt
GSTexture* GSDeviceOGL::FetchSurface(int type, int w, int h, bool msaa, int format) GSTexture* GSDeviceOGL::FetchSurface(int type, int w, int h, bool msaa, int format)
{ {
return GSDevice::FetchSurface(type, w, h, false, format); GSTexture* t = GSDevice::FetchSurface(type, w, h, false, format);
if (m_force_texture_clear) {
GSVector4 red(1.0f, 0.0f, 0.0f, 1.0f);
switch(type)
{
case GSTexture::RenderTarget:
ClearRenderTarget(t, 0);
break;
case GSTexture::DepthStencil:
ClearDepth(t, 0);
// No need to clear the stencil now.
break;
case GSTexture::Texture:
if (m_force_texture_clear > 1)
static_cast<GSTextureOGL*>(t)->Clear((void*)&red);
else if (m_force_texture_clear)
static_cast<GSTextureOGL*>(t)->Clear(NULL);
break;
}
}
return t;
} }
bool GSDeviceOGL::Create(GSWnd* wnd) bool GSDeviceOGL::Create(GSWnd* wnd)
@ -194,6 +223,8 @@ bool GSDeviceOGL::Create(GSWnd* wnd)
} }
#endif #endif
m_force_texture_clear = theApp.GetConfigI("force_texture_clear");
// WARNING it must be done after the control setup (at least on MESA) // WARNING it must be done after the control setup (at least on MESA)
GL_PUSH("GSDeviceOGL::Create"); GL_PUSH("GSDeviceOGL::Create");

View File

@ -398,6 +398,7 @@ public:
private: private:
uint32 m_msaa; // Level of Msaa uint32 m_msaa; // Level of Msaa
int m_force_texture_clear;
static bool m_debug_gl_call; static bool m_debug_gl_call;
static FILE* m_debug_gl_file; static FILE* m_debug_gl_file;

View File

@ -29,9 +29,6 @@
extern uint64 g_real_texture_upload_byte; extern uint64 g_real_texture_upload_byte;
#endif #endif
// FIXME find the optimal number of PBO
#define PBO_POOL_SIZE 8
// FIXME OGL4: investigate, only 1 unpack buffer always bound // FIXME OGL4: investigate, only 1 unpack buffer always bound
namespace PboPool { namespace PboPool {

View File

@ -275,6 +275,7 @@ GSdxApp::GSdxApp()
m_default_configuration["dump"] = "0"; m_default_configuration["dump"] = "0";
m_default_configuration["extrathreads"] = "2"; m_default_configuration["extrathreads"] = "2";
m_default_configuration["filter"] = "2"; m_default_configuration["filter"] = "2";
m_default_configuration["force_texture_clear"] = "0";
m_default_configuration["fxaa"] = "0"; m_default_configuration["fxaa"] = "0";
m_default_configuration["interlace"] = "7"; m_default_configuration["interlace"] = "7";
m_default_configuration["large_framebuffer"] = "1"; m_default_configuration["large_framebuffer"] = "1";