void PostProcessor::_destroyBlur() { if (m_extractBloomProgram != 0) glDeleteProgram(m_extractBloomProgram); m_extractBloomProgram = 0; if (m_seperableBlurProgram != 0) glDeleteProgram(m_seperableBlurProgram); m_seperableBlurProgram = 0; if (m_glowProgram != 0) glDeleteProgram(m_glowProgram); m_glowProgram = 0; if (m_bloomProgram != 0) glDeleteProgram(m_bloomProgram); m_bloomProgram = 0; if (m_FBO_glowMap != 0) glDeleteFramebuffers(1, &m_FBO_glowMap); m_FBO_glowMap = 0; if (m_FBO_blur != 0) glDeleteFramebuffers(1, &m_FBO_blur); m_FBO_blur = 0; if (m_pTextureGlowMap != nullptr) textureCache().removeFrameBufferTexture(m_pTextureGlowMap); m_pTextureGlowMap = nullptr; if (m_pTextureBlur != nullptr) textureCache().removeFrameBufferTexture(m_pTextureBlur); m_pTextureBlur = nullptr; }
DepthBuffer::~DepthBuffer() { if (m_FBO != 0) glDeleteFramebuffers(1, &m_FBO); if (m_pDepthImageTexture != NULL) textureCache().removeFrameBufferTexture(m_pDepthImageTexture); if (m_pDepthBufferTexture != NULL) textureCache().removeFrameBufferTexture(m_pDepthBufferTexture); if (m_pResolveDepthBufferTexture != NULL) textureCache().removeFrameBufferTexture(m_pResolveDepthBufferTexture); }
void DepthBuffer::initDepthBufferTexture(FrameBuffer * _pBuffer) { if (m_pDepthBufferTexture == NULL) { m_pDepthBufferTexture = textureCache().addFrameBufferTexture(); _initDepthBufferTexture(_pBuffer, m_pDepthBufferTexture, config.video.multisampling != 0); } #ifdef GL_MULTISAMPLING_SUPPORT if (config.video.multisampling != 0 && m_pResolveDepthBufferTexture == NULL) { m_pResolveDepthBufferTexture = textureCache().addFrameBufferTexture(); _initDepthBufferTexture(_pBuffer, m_pResolveDepthBufferTexture, false); } #endif }
static CachedTexture * _createTexture() { CachedTexture * pTexture = textureCache().addFrameBufferTexture(); _initTexture(pTexture); return pTexture; }
void update(bool _force) override { int nFbMonochromeMode0 = 0, nFbMonochromeMode1 = 0; int nFbFixedAlpha0 = 0, nFbFixedAlpha1 = 0; int nMSTex0Enabled = 0, nMSTex1Enabled = 0; TextureCache & cache = textureCache(); if (cache.current[0] != nullptr && cache.current[0]->frameBufferTexture != CachedTexture::fbNone) { if (cache.current[0]->size == G_IM_SIZ_8b) { nFbMonochromeMode0 = 1; if (gDP.otherMode.imageRead == 0) nFbFixedAlpha0 = 1; } else if (gSP.textureTile[0]->size == G_IM_SIZ_16b && gSP.textureTile[0]->format == G_IM_FMT_IA) nFbMonochromeMode0 = 2; nMSTex0Enabled = cache.current[0]->frameBufferTexture == CachedTexture::fbMultiSample ? 1 : 0; } if (cache.current[1] != nullptr && cache.current[1]->frameBufferTexture != CachedTexture::fbNone) { if (cache.current[1]->size == G_IM_SIZ_8b) { nFbMonochromeMode1 = 1; if (gDP.otherMode.imageRead == 0) nFbFixedAlpha1 = 1; } else if (gSP.textureTile[1]->size == G_IM_SIZ_16b && gSP.textureTile[1]->format == G_IM_FMT_IA) nFbMonochromeMode1 = 2; nMSTex1Enabled = cache.current[1]->frameBufferTexture == CachedTexture::fbMultiSample ? 1 : 0; } uFbMonochrome.set(nFbMonochromeMode0, nFbMonochromeMode1, _force); uFbFixedAlpha.set(nFbFixedAlpha0, nFbFixedAlpha1, _force); uMSTexEnabled.set(nMSTex0Enabled, nMSTex1Enabled, _force); gDP.changed &= ~CHANGED_FB_TEXTURE; }
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; }
void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture * _pTexture, bool _multisample) { if (_pBuffer != NULL) { _pTexture->width = (uint32_t)(_pBuffer->m_pTexture->width); _pTexture->height = (uint32_t)(_pBuffer->m_pTexture->height); _pTexture->address = _pBuffer->m_startAddress; _pTexture->clampWidth = _pBuffer->m_width; _pTexture->clampHeight = _pBuffer->m_height; } else { _pTexture->width = video().getWidth(); _pTexture->height = video().getHeight(); _pTexture->address = gDP.depthImageAddress; _pTexture->clampWidth = VI.width; _pTexture->clampHeight = VI.height; } _pTexture->format = 0; _pTexture->size = 2; _pTexture->clampS = 1; _pTexture->clampT = 1; _pTexture->frameBufferTexture = CachedTexture::fbOneSample; _pTexture->maskS = 0; _pTexture->maskT = 0; _pTexture->mirrorS = 0; _pTexture->mirrorT = 0; _pTexture->realWidth = _pTexture->width; _pTexture->realHeight = _pTexture->height; _pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * fboFormats.depthFormatBytes; textureCache().addFrameBufferTextureSize(_pTexture->textureBytes); #ifdef GL_MULTISAMPLING_SUPPORT if (_multisample) { glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName); #if defined(HAVE_OPENGLES_3_1) if (_pBuffer != NULL) glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, false); else glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT, video().getWidth(), video().getHeight(), false); #else if (_pBuffer != NULL) glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, false); else glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT, video().getWidth(), video().getHeight(), false); #endif _pTexture->frameBufferTexture = CachedTexture::fbMultiSample; } else #endif // GL_MULTISAMPLING_SUPPORT { glBindTexture(GL_TEXTURE_2D, _pTexture->glName); if (_pBuffer != NULL) glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, _pBuffer->m_pTexture->realWidth, _pBuffer->m_pTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL); else glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, video().getWidth(), video().getHeight(), 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } glBindTexture(GL_TEXTURE_2D, 0); }
void UniformSet::_updateTextureSize(UniformSetLocation & _location, bool _bUsesT0, bool _bUsesT1, bool _bForce) { TextureCache & cache = textureCache(); if (_bUsesT0 && cache.current[0] != NULL) _location.uTextureSize[0].set((float)cache.current[0]->realWidth, (float)cache.current[0]->realHeight, _bForce); if (_bUsesT1 && cache.current[1] != NULL) _location.uTextureSize[1].set((float)cache.current[1]->realWidth, (float)cache.current[1]->realHeight, _bForce); }
void update(bool _force) override { TextureCache & cache = textureCache(); if (m_useT0 && cache.current[0] != NULL) uTextureSize[0].set((float)cache.current[0]->realWidth, (float)cache.current[0]->realHeight, _force); if (m_useT1 && cache.current[1] != NULL) uTextureSize[1].set((float)cache.current[1]->realWidth, (float)cache.current[1]->realHeight, _force); }
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; }
void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer) { #ifdef GL_IMAGE_TEXTURES_SUPPORT if (!video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0 || m_pDepthImageTexture != NULL) return; m_pDepthImageTexture = textureCache().addFrameBufferTexture(); m_pDepthImageTexture->width = (uint32_t)(_pBuffer->m_pTexture->width); m_pDepthImageTexture->height = (uint32_t)(_pBuffer->m_pTexture->height); m_pDepthImageTexture->format = 0; m_pDepthImageTexture->size = 2; m_pDepthImageTexture->clampS = 1; m_pDepthImageTexture->clampT = 1; m_pDepthImageTexture->address = _pBuffer->m_startAddress; m_pDepthImageTexture->clampWidth = _pBuffer->m_width; m_pDepthImageTexture->clampHeight = _pBuffer->m_height; m_pDepthImageTexture->frameBufferTexture = CachedTexture::fbOneSample; m_pDepthImageTexture->maskS = 0; m_pDepthImageTexture->maskT = 0; m_pDepthImageTexture->mirrorS = 0; m_pDepthImageTexture->mirrorT = 0; m_pDepthImageTexture->realWidth = m_pDepthImageTexture->width; m_pDepthImageTexture->realHeight = m_pDepthImageTexture->height; m_pDepthImageTexture->textureBytes = m_pDepthImageTexture->realWidth * m_pDepthImageTexture->realHeight * fboFormats.depthImageFormatBytes; textureCache().addFrameBufferTextureSize(m_pDepthImageTexture->textureBytes); glBindTexture(GL_TEXTURE_2D, m_pDepthImageTexture->glName); glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthImageInternalFormat, m_pDepthImageTexture->realWidth, m_pDepthImageTexture->realHeight, 0, fboFormats.depthImageFormat, fboFormats.depthImageType, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pDepthImageTexture->glName, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO); depthBufferList().clearBuffer(0, VI.height); #endif // GL_IMAGE_TEXTURES_SUPPORT }
void PostProcessor::_destroyCommon() { if (m_copyProgram != 0) glDeleteProgram(m_copyProgram); m_copyProgram = 0; if (m_FBO_original != 0) glDeleteFramebuffers(1, &m_FBO_original); m_FBO_original = 0; if (m_pTextureOriginal != nullptr) textureCache().removeFrameBufferTexture(m_pTextureOriginal); }
void PostProcessor::destroy() { if (m_copyProgram != 0) glDeleteProgram(m_copyProgram); m_copyProgram = 0; if (m_extractBloomProgram != 0) glDeleteProgram(m_extractBloomProgram); m_extractBloomProgram = 0; if (m_seperableBlurProgram != 0) glDeleteProgram(m_seperableBlurProgram); m_seperableBlurProgram = 0; if (m_glowProgram != 0) glDeleteProgram(m_glowProgram); m_glowProgram = 0; if (m_bloomProgram != 0) glDeleteProgram(m_bloomProgram); m_bloomProgram = 0; if (m_FBO_original != 0) glDeleteFramebuffers(1, &m_FBO_original); m_FBO_original = 0; if (m_FBO_glowMap != 0) glDeleteFramebuffers(1, &m_FBO_glowMap); m_FBO_glowMap = 0; if (m_FBO_blur != 0) glDeleteFramebuffers(1, &m_FBO_blur); m_FBO_blur = 0; if (m_pTextureOriginal != NULL) textureCache().removeFrameBufferTexture(m_pTextureOriginal); m_pTextureOriginal = NULL; if (m_pTextureGlowMap != NULL) textureCache().removeFrameBufferTexture(m_pTextureGlowMap); m_pTextureGlowMap = NULL; if (m_pTextureBlur != NULL) textureCache().removeFrameBufferTexture(m_pTextureBlur); m_pTextureBlur = NULL; }
void PostProcessor::process(FrameBuffer * _pBuffer) { if (config.bloomFilter.enable == 0) return; if (_pBuffer == NULL || _pBuffer->m_postProcessed) return; _pBuffer->m_postProcessed = true; _setGLState(); OGLVideo & ogl = video(); #ifdef GLES2 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_original); textureCache().activateTexture(0, _pBuffer->m_pTexture); glUseProgram(m_copyProgram); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_original); glBlitFramebuffer( 0, 0, ogl.getWidth(), ogl.getHeight(), 0, 0, ogl.getWidth(), ogl.getHeight(), GL_COLOR_BUFFER_BIT, GL_LINEAR ); #endif glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); 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, _pBuffer->m_FBO); textureCache().activateTexture(0, m_pTextureOriginal); textureCache().activateTexture(1, m_pTextureGlowMap); glUseProgram(m_glowProgram); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); video().getRender().dropRenderState(); glUseProgram(0); }
void PostProcessor::_destroyCommon() { if (m_FBO_resolved != 0) glDeleteFramebuffers(1, &m_FBO_resolved); m_FBO_resolved = 0; if (m_pTextureResolved != nullptr) textureCache().removeFrameBufferTexture(m_pTextureResolved); m_pTextureResolved = nullptr; delete m_pResultBuffer; m_pResultBuffer = nullptr; m_pTextureOriginal = nullptr; }
static CachedTexture * _createTexture() { CachedTexture * pTexture = textureCache().addFrameBufferTexture(); pTexture->format = G_IM_FMT_RGBA; pTexture->clampS = 1; pTexture->clampT = 1; pTexture->frameBufferTexture = CachedTexture::fbOneSample; pTexture->maskS = 0; pTexture->maskT = 0; pTexture->mirrorS = 0; pTexture->mirrorT = 0; pTexture->realWidth = video().getWidth(); pTexture->realHeight = video().getHeight(); pTexture->textureBytes = pTexture->realWidth * pTexture->realHeight * 4; textureCache().addFrameBufferTextureSize(pTexture->textureBytes); glBindTexture(GL_TEXTURE_2D, pTexture->glName); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pTexture->realWidth, pTexture->realHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); return pTexture; }
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(); }
void UniformSet::_updateTextureUniforms(UniformSetLocation & _location, bool _bUsesT0, bool _bUsesT1, bool _bForce) { int nFB[2] = { 0, 0 }; const bool bUsesTile[2] = { _bUsesT0, _bUsesT1 }; TextureCache & cache = textureCache(); for (u32 t = 0; t < 2; ++t) { if (!bUsesTile[t]) continue; if (gSP.textureTile[t] != NULL) { if (gSP.textureTile[t]->textureMode == TEXTUREMODE_BGIMAGE || gSP.textureTile[t]->textureMode == TEXTUREMODE_FRAMEBUFFER_BG) _location.uTexOffset[t].set(0.0f, 0.0f, _bForce); else { float fuls = gSP.textureTile[t]->fuls; float fult = gSP.textureTile[t]->fult; FrameBuffer * pBuffer = gSP.textureTile[t]->frameBuffer; if (pBuffer != NULL) { if (gSP.textureTile[t]->masks > 0 && gSP.textureTile[t]->clamps == 0) fuls = float(gSP.textureTile[t]->uls % (1 << gSP.textureTile[t]->masks)); if (gSP.textureTile[t]->maskt > 0 && gSP.textureTile[t]->clampt == 0) fult = float(gSP.textureTile[t]->ult % (1 << gSP.textureTile[t]->maskt)); } _location.uTexOffset[t].set(fuls, fult, _bForce); } } if (cache.current[t] != NULL) { f32 shiftScaleS = 1.0f; f32 shiftScaleT = 1.0f; getTextureShiftScale(t, cache, shiftScaleS, shiftScaleT); _location.uCacheShiftScale[t].set(shiftScaleS, shiftScaleT, _bForce); _location.uCacheScale[t].set(cache.current[t]->scaleS, cache.current[t]->scaleT, _bForce); _location.uCacheOffset[t].set(cache.current[t]->offsetS, cache.current[t]->offsetT, _bForce); nFB[t] = cache.current[t]->frameBufferTexture; } } _location.uCacheFrameBuffer.set(nFB[0], nFB[1], _bForce); _location.uTexScale.set(gSP.texture.scales, gSP.texture.scalet, _bForce); }
void update(bool _force) override { int nFB[2] = { 0, 0 }; TextureCache & cache = textureCache(); for (u32 t = 0; t < 2; ++t) { if (!m_useTile[t]) continue; if (gSP.textureTile[t] != NULL) { if (gSP.textureTile[t]->textureMode == TEXTUREMODE_BGIMAGE || gSP.textureTile[t]->textureMode == TEXTUREMODE_FRAMEBUFFER_BG) uTexOffset[t].set(0.0f, 0.0f, _force); else { float fuls = gSP.textureTile[t]->fuls; float fult = gSP.textureTile[t]->fult; FrameBuffer * pBuffer = gSP.textureTile[t]->frameBuffer; if (pBuffer != NULL) { if (gSP.textureTile[t]->masks > 0 && gSP.textureTile[t]->clamps == 0) fuls = float(gSP.textureTile[t]->uls % (1 << gSP.textureTile[t]->masks)); if (gSP.textureTile[t]->maskt > 0 && gSP.textureTile[t]->clampt == 0) fult = float(gSP.textureTile[t]->ult % (1 << gSP.textureTile[t]->maskt)); } uTexOffset[t].set(fuls, fult, _force); } } if (cache.current[t] != NULL) { f32 shiftScaleS = 1.0f; f32 shiftScaleT = 1.0f; getTextureShiftScale(t, cache, shiftScaleS, shiftScaleT); uCacheShiftScale[t].set(shiftScaleS, shiftScaleT, _force); uCacheScale[t].set(cache.current[t]->scaleS, cache.current[t]->scaleT, _force); uCacheOffset[t].set(cache.current[t]->offsetS, cache.current[t]->offsetT, _force); nFB[t] = cache.current[t]->frameBufferTexture; } } uCacheFrameBuffer.set(nFB[0], nFB[1], _force); uTexScale.set(gSP.texture.scales, gSP.texture.scalet, _force); }
void PostProcessor::_preDraw(FrameBuffer * _pBuffer) { _setGLState(); OGLVideo & ogl = video(); #ifdef HAVE_OPENGLES2 glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_original); textureCache().activateTexture(0, _pBuffer->m_pTexture); glUseProgram(m_copyProgram); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); #else glBindFramebuffer(GL_READ_FRAMEBUFFER, _pBuffer->m_FBO); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO_original); glBlitFramebuffer( 0, 0, ogl.getWidth(), ogl.getHeight(), 0, 0, ogl.getWidth(), ogl.getHeight(), GL_COLOR_BUFFER_BIT, GL_LINEAR ); #endif glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); }
void DepthBuffer::activateDepthBufferTexture(FrameBuffer * _pBuffer) { textureCache().activateTexture(0, resolveDepthBufferTexture(_pBuffer)); }