mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
PostProcessor refactor: - rename process() to doBlur(). - move Blur() init and destroy to separate functions.
This commit is contained in:
parent
99ad1983e4
commit
330603e2b6
|
@ -97,7 +97,7 @@ FrameBuffer::FrameBuffer() :
|
||||||
m_scaleX(0), m_scaleY(0),
|
m_scaleX(0), m_scaleY(0),
|
||||||
m_copiedToRdram(false), m_fingerprint(false), m_cleared(false), m_changed(false), m_cfb(false),
|
m_copiedToRdram(false), m_fingerprint(false), m_cleared(false), m_changed(false), m_cfb(false),
|
||||||
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_needHeightCorrection(false),
|
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_needHeightCorrection(false),
|
||||||
m_postProcessed(false), m_pLoadTile(NULL),
|
m_postProcessed(0), m_pLoadTile(NULL),
|
||||||
m_pDepthBuffer(NULL), m_pResolveTexture(NULL), m_resolveFBO(0), m_resolved(false)
|
m_pDepthBuffer(NULL), m_pResolveTexture(NULL), m_resolveFBO(0), m_resolved(false)
|
||||||
{
|
{
|
||||||
m_pTexture = textureCache().addFrameBufferTexture();
|
m_pTexture = textureCache().addFrameBufferTexture();
|
||||||
|
@ -545,7 +545,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
||||||
|
|
||||||
m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress;
|
m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress;
|
||||||
m_pCurrent->m_isPauseScreen = m_pCurrent->m_isOBScreen = false;
|
m_pCurrent->m_isPauseScreen = m_pCurrent->m_isOBScreen = false;
|
||||||
m_pCurrent->m_postProcessed = false;
|
m_pCurrent->m_postProcessed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBufferList::copyAux()
|
void FrameBufferList::copyAux()
|
||||||
|
@ -739,7 +739,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
||||||
#endif // GLESX
|
#endif // GLESX
|
||||||
|
|
||||||
render.updateScissor(pBuffer);
|
render.updateScissor(pBuffer);
|
||||||
PostProcessor::get().process(pBuffer);
|
PostProcessor::get().doBlur(pBuffer);
|
||||||
// glDisable(GL_SCISSOR_TEST) does not affect glBlitFramebuffer, at least on AMD
|
// glDisable(GL_SCISSOR_TEST) does not affect glBlitFramebuffer, at least on AMD
|
||||||
glScissor(0, 0, ogl.getScreenWidth(), ogl.getScreenHeight() + ogl.getHeightOffset());
|
glScissor(0, 0, ogl.getScreenWidth(), ogl.getScreenHeight() + ogl.getHeightOffset());
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
@ -804,7 +804,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
||||||
|
|
||||||
OGLVideo & ogl = video();
|
OGLVideo & ogl = video();
|
||||||
ogl.getRender().updateScissor(pBuffer);
|
ogl.getRender().updateScissor(pBuffer);
|
||||||
PostProcessor::get().process(pBuffer);
|
PostProcessor::get().doBlur(pBuffer);
|
||||||
ogl.getRender().dropRenderState();
|
ogl.getRender().dropRenderState();
|
||||||
gSP.changed = gDP.changed = 0;
|
gSP.changed = gDP.changed = 0;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ struct FrameBuffer
|
||||||
bool m_isPauseScreen;
|
bool m_isPauseScreen;
|
||||||
bool m_isOBScreen;
|
bool m_isOBScreen;
|
||||||
bool m_needHeightCorrection;
|
bool m_needHeightCorrection;
|
||||||
bool m_postProcessed;
|
u32 m_postProcessed;
|
||||||
|
|
||||||
GLuint m_FBO;
|
GLuint m_FBO;
|
||||||
gDPTile *m_pLoadTile;
|
gDPTile *m_pLoadTile;
|
||||||
|
|
|
@ -1393,8 +1393,7 @@ void OGLRender::_initData()
|
||||||
Combiner_Init();
|
Combiner_Init();
|
||||||
TextDrawer::get().init();
|
TextDrawer::get().init();
|
||||||
TFH.init();
|
TFH.init();
|
||||||
if (config.bloomFilter.enable != 0)
|
PostProcessor::get().init();
|
||||||
PostProcessor::get().init();
|
|
||||||
m_renderState = rsNone;
|
m_renderState = rsNone;
|
||||||
|
|
||||||
gSP.changed = gDP.changed = 0xFFFFFFFF;
|
gSP.changed = gDP.changed = 0xFFFFFFFF;
|
||||||
|
|
|
@ -297,7 +297,7 @@ GLuint _createFBO(CachedTexture * _pTexture)
|
||||||
return FBO;
|
return FBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::init()
|
void PostProcessor::_initBlur()
|
||||||
{
|
{
|
||||||
m_pTextureOriginal = _createTexture();
|
m_pTextureOriginal = _createTexture();
|
||||||
m_FBO_original = _createFBO(m_pTextureOriginal);
|
m_FBO_original = _createFBO(m_pTextureOriginal);
|
||||||
|
@ -362,7 +362,13 @@ void PostProcessor::init()
|
||||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::destroy()
|
void PostProcessor::init()
|
||||||
|
{
|
||||||
|
if (config.bloomFilter.enable != 0)
|
||||||
|
_initBlur();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostProcessor::_destroyBlur()
|
||||||
{
|
{
|
||||||
if (m_copyProgram != 0)
|
if (m_copyProgram != 0)
|
||||||
glDeleteProgram(m_copyProgram);
|
glDeleteProgram(m_copyProgram);
|
||||||
|
@ -401,6 +407,12 @@ void PostProcessor::destroy()
|
||||||
m_pTextureBlur = NULL;
|
m_pTextureBlur = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PostProcessor::destroy()
|
||||||
|
{
|
||||||
|
_destroyBlur();
|
||||||
|
}
|
||||||
|
|
||||||
PostProcessor & PostProcessor::get()
|
PostProcessor & PostProcessor::get()
|
||||||
{
|
{
|
||||||
static PostProcessor processor;
|
static PostProcessor processor;
|
||||||
|
@ -431,15 +443,15 @@ void _setGLState() {
|
||||||
gDP.changed |= CHANGED_RENDERMODE;
|
gDP.changed |= CHANGED_RENDERMODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessor::process(FrameBuffer * _pBuffer)
|
void PostProcessor::doBlur(FrameBuffer * _pBuffer)
|
||||||
{
|
{
|
||||||
if (config.bloomFilter.enable == 0)
|
if (config.bloomFilter.enable == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_pBuffer == NULL || _pBuffer->m_postProcessed)
|
if (_pBuffer == NULL || (_pBuffer->m_postProcessed&PostProcessor::postEffectBlur) == PostProcessor::postEffectBlur)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_pBuffer->m_postProcessed = true;
|
_pBuffer->m_postProcessed |= PostProcessor::postEffectBlur;
|
||||||
|
|
||||||
_setGLState();
|
_setGLState();
|
||||||
OGLVideo & ogl = video();
|
OGLVideo & ogl = video();
|
||||||
|
|
|
@ -10,16 +10,20 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
void process(FrameBuffer * _pBuffer);
|
void doBlur(FrameBuffer * _pBuffer);
|
||||||
|
|
||||||
static PostProcessor & get();
|
static PostProcessor & get();
|
||||||
|
|
||||||
|
static const u32 postEffectBlur = 1U;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PostProcessor() :
|
PostProcessor() :
|
||||||
m_extractBloomProgram(0), m_seperableBlurProgram(0), m_glowProgram(0), m_bloomProgram(0), m_copyProgram(0),
|
m_extractBloomProgram(0), m_seperableBlurProgram(0), m_glowProgram(0), m_bloomProgram(0), m_copyProgram(0),
|
||||||
m_FBO_original(0), m_FBO_glowMap(0), m_FBO_blur(0),
|
m_FBO_original(0), m_FBO_glowMap(0), m_FBO_blur(0),
|
||||||
m_pTextureOriginal(NULL), m_pTextureGlowMap(NULL), m_pTextureBlur(NULL) {}
|
m_pTextureOriginal(NULL), m_pTextureGlowMap(NULL), m_pTextureBlur(NULL) {}
|
||||||
PostProcessor(const PostProcessor & _other);
|
PostProcessor(const PostProcessor & _other);
|
||||||
|
void _initBlur();
|
||||||
|
void _destroyBlur();
|
||||||
|
|
||||||
GLuint m_extractBloomProgram;
|
GLuint m_extractBloomProgram;
|
||||||
GLuint m_seperableBlurProgram;
|
GLuint m_seperableBlurProgram;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user