Beispiel #1
0
FrameBuffer * PostProcessor::doGammaCorrection(FrameBuffer * _pBuffer)
{
	if (_pBuffer == nullptr)
		return nullptr;

	m_pResultBuffer->m_postProcessed = _pBuffer->m_postProcessed;

	if (((*REG.VI_STATUS & 8) | config.gammaCorrection.force) == 0)
		return _pBuffer;

	if ((_pBuffer->m_postProcessed&PostProcessor::postEffectGammaCorrection) == PostProcessor::postEffectGammaCorrection)
		return m_pResultBuffer;

	_pBuffer->m_postProcessed |= PostProcessor::postEffectGammaCorrection;

	_preDraw(_pBuffer);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pResultBuffer->m_FBO);
	textureCache().activateTexture(0, m_pTextureOriginal);
	glUseProgram(m_gammaCorrectionProgram);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	_postDraw();
	m_pResultBuffer->m_postProcessed = _pBuffer->m_postProcessed;
	return m_pResultBuffer;
}
Beispiel #2
0
FrameBuffer * PostProcessor::doBlur(FrameBuffer * _pBuffer)
{
	if (_pBuffer == nullptr)
		return nullptr;

	m_pResultBuffer->m_postProcessed = _pBuffer->m_postProcessed;

	if (config.bloomFilter.enable == 0)
		return _pBuffer;

	if ((_pBuffer->m_postProcessed&PostProcessor::postEffectBlur) == PostProcessor::postEffectBlur)
		return m_pResultBuffer;

	_pBuffer->m_postProcessed |= PostProcessor::postEffectBlur;

	_preDraw(_pBuffer);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_glowMap);
	textureCache().activateTexture(0, m_pTextureOriginal);
	glUseProgram(m_extractBloomProgram);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_blur);
	textureCache().activateTexture(0, m_pTextureGlowMap);
	glUseProgram(m_seperableBlurProgram);
	int loc = glGetUniformLocation(m_seperableBlurProgram, "Orientation");
	assert(loc >= 0);
	glUniform1i(loc, 0);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_glowMap);
	textureCache().activateTexture(0, m_pTextureBlur);
	glUniform1i(loc, 1);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pResultBuffer->m_FBO);
	textureCache().activateTexture(0, m_pTextureOriginal);
	textureCache().activateTexture(1, m_pTextureGlowMap);
	glUseProgram(m_glowProgram);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	_postDraw();
	m_pResultBuffer->m_postProcessed = _pBuffer->m_postProcessed;
	return m_pResultBuffer;
}
FrameBuffer * PostProcessor::doOrientationCorrection(FrameBuffer * _pBuffer)
{
	if (_pBuffer == nullptr)
		return nullptr;

	if (config.generalEmulation.enableBlitScreenWorkaround == 0)
		return _pBuffer;

	_preDraw(_pBuffer);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pResultBuffer->m_FBO);
	textureCache().activateTexture(0, m_pTextureOriginal);
	glUseProgram(m_orientationCorrectionProgram);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	_postDraw();
	return m_pResultBuffer;
}
void PostProcessor::doGammaCorrection(FrameBuffer * _pBuffer)
{
	if (((*gfx_info.VI_STATUS_REG & 8)|config.gammaCorrection.force) == 0)
		return;

	if (_pBuffer == nullptr || (_pBuffer->m_postProcessed&PostProcessor::postEffectGammaCorrection) == PostProcessor::postEffectGammaCorrection)
		return;

	_pBuffer->m_postProcessed |= PostProcessor::postEffectGammaCorrection;

	_preDraw(_pBuffer);

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
	textureCache().activateTexture(0, m_pTextureOriginal);
	glUseProgram(m_gammaCorrectionProgram);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	_postDraw();
}