mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Remove old-style code.
This commit is contained in:
parent
c39b639d7c
commit
43e8aef6ea
|
@ -75,22 +75,6 @@ void ColorBufferToRDRAM::_initFBTexture(void)
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
#if defined(GLES3) || defined (GLES3_1)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
#endif
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pTexture->glName, 0);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
{
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(m_pTexture->glName);
|
||||
|
@ -119,7 +103,6 @@ void ColorBufferToRDRAM::_initFBTexture(void)
|
|||
bufTarget.textureHandle = graphics::ObjectHandle(m_pTexture->glName);
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
}
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
// check if everything is OK
|
||||
assert(checkFBO());
|
||||
|
|
|
@ -68,28 +68,6 @@ void DepthBufferToRDRAM::init()
|
|||
m_pDepthTexture->textureBytes = m_pDepthTexture->realWidth * m_pDepthTexture->realHeight * sizeof(float);
|
||||
textureCache().addFrameBufferTextureSize(m_pDepthTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pColorTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pColorTexture->realWidth, m_pColorTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pDepthTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, m_pDepthTexture->realWidth, m_pDepthTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, nullptr);
|
||||
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);
|
||||
|
||||
// generate a framebuffer
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glGenFramebuffers(1, &m_FBO);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pColorTexture->glName, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthTexture->glName, 0);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams initParams;
|
||||
initParams.handle = graphics::ObjectHandle(m_pColorTexture->glName);
|
||||
initParams.width = m_pColorTexture->realWidth;
|
||||
|
@ -132,8 +110,6 @@ void DepthBufferToRDRAM::init()
|
|||
bufTarget.textureHandle = graphics::ObjectHandle(m_pDepthTexture->glName);
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
// check if everything is OK
|
||||
assert(checkFBO());
|
||||
assert(!isGLError());
|
||||
|
|
|
@ -40,15 +40,6 @@ void RDRAMtoColorBuffer::init()
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams initParams;
|
||||
initParams.handle = graphics::ObjectHandle(m_pTexture->glName);
|
||||
initParams.width = m_pTexture->realWidth;
|
||||
|
@ -66,8 +57,6 @@ void RDRAMtoColorBuffer::init()
|
|||
setParams.magFilter = graphics::textureParameters::FILTER_LINEAR;
|
||||
gfxContext.setTextureParameters(setParams);
|
||||
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
// Generate Pixel Buffer Object. Initialize it later
|
||||
#ifndef GLES2
|
||||
glGenBuffers(1, &m_PBO);
|
||||
|
|
|
@ -25,15 +25,9 @@ DepthBuffer::DepthBuffer() : m_address(0), m_width(0), m_ulx(0), m_uly(0), m_lrx
|
|||
m_cleared(false), m_pResolveDepthBufferTexture(nullptr), m_resolved(false),
|
||||
m_pDepthBufferCopyTexture(nullptr), m_copied(false)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glGenFramebuffers(1, &m_copyFBO);
|
||||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
glGenFramebuffers(1, &m_depthImageFBO);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
m_copyFBO = GLuint(gfxContext.createFramebuffer());
|
||||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
m_depthImageFBO = GLuint(gfxContext.createFramebuffer());
|
||||
#endif
|
||||
}
|
||||
|
||||
DepthBuffer::DepthBuffer(DepthBuffer && _other) :
|
||||
|
@ -56,18 +50,9 @@ DepthBuffer::DepthBuffer(DepthBuffer && _other) :
|
|||
|
||||
DepthBuffer::~DepthBuffer()
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
if (m_depthImageFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_depthImageFBO);
|
||||
if (m_depthRenderbuffer != 0)
|
||||
glDeleteRenderbuffers(1, &m_depthRenderbuffer);
|
||||
if (m_copyFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_copyFBO);
|
||||
#else
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_depthImageFBO));
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_depthRenderbuffer));
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_copyFBO));
|
||||
#endif
|
||||
|
||||
textureCache().removeFrameBufferTexture(m_pDepthImageTexture);
|
||||
textureCache().removeFrameBufferTexture(m_pDepthBufferTexture);
|
||||
|
@ -102,19 +87,6 @@ void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
|
|||
m_pDepthImageTexture->textureBytes = m_pDepthImageTexture->realWidth * m_pDepthImageTexture->realHeight * fboFormats.depthImageFormatBytes;
|
||||
textureCache().addFrameBufferTextureSize(m_pDepthImageTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
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, nullptr);
|
||||
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_depthImageFBO);
|
||||
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);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
{
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(m_pDepthImageTexture->glName);
|
||||
|
@ -145,7 +117,6 @@ void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
|
|||
}
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _pBuffer->m_FBO);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
|
||||
depthBufferList().clearBuffer(0, 0, VI.width, VI.height);
|
||||
|
@ -187,27 +158,6 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
_pTexture->textureBytes = _pTexture->realWidth * _pTexture->realHeight * fboFormats.depthFormatBytes;
|
||||
textureCache().addFrameBufferTextureSize(_pTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (_multisample) {
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName);
|
||||
#if defined(GLESX)
|
||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, false);
|
||||
#else
|
||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, false);
|
||||
#endif
|
||||
_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||
} else
|
||||
#endif // GL_MULTISAMPLING_SUPPORT
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, nullptr);
|
||||
|
||||
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);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
{
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
|
@ -229,7 +179,6 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
params.magFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
gfxContext.setTextureParameters(params);
|
||||
}
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
}
|
||||
|
||||
|
@ -251,11 +200,6 @@ void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glGenRenderbuffers(1, &m_depthRenderbuffer);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, m_depthRenderbuffer);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, fboFormats.depthInternalFormat, m_depthRenderbufferWidth, height);
|
||||
#else
|
||||
graphics::ObjectHandle renderbufHandle = gfxContext.createRenderbuffer();
|
||||
m_depthRenderbuffer = GLuint(renderbufHandle);
|
||||
graphics::Context::InitRenderbufferParams params;
|
||||
|
@ -265,26 +209,10 @@ void DepthBuffer::_initDepthBufferRenderbuffer(FrameBuffer * _pBuffer)
|
|||
params.width = m_depthRenderbufferWidth;
|
||||
params.height = height;
|
||||
gfxContext.initRenderbuffer(params);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DepthBuffer::setDepthAttachment(GLuint _fbo, GLenum _target)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
#ifndef USE_DEPTH_RENDERBUFFER
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (config.video.multisampling != 0)
|
||||
glFramebufferTexture2D(_target, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_MULTISAMPLE, m_pDepthBufferTexture->glName, 0);
|
||||
else
|
||||
#endif
|
||||
glFramebufferTexture2D(_target, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_pDepthBufferTexture->glName, 0);
|
||||
#else
|
||||
glFramebufferRenderbuffer(_target, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthRenderbuffer);
|
||||
#endif
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
|
||||
graphics::Context::FrameBufferRenderTarget params;
|
||||
params.attachment = graphics::bufferAttachment::DEPTH_ATTACHMENT;
|
||||
params.bufferHandle = graphics::ObjectHandle(_fbo);
|
||||
|
@ -298,8 +226,6 @@ void DepthBuffer::setDepthAttachment(GLuint _fbo, GLenum _target)
|
|||
#endif // USE_DEPTH_RENDERBUFFER
|
||||
gfxContext.addFrameBufferRenderTarget(params);
|
||||
|
||||
#endif //GRAPHICS_CONTEXT
|
||||
|
||||
m_copied = false;
|
||||
m_resolved = false;
|
||||
}
|
||||
|
|
|
@ -41,27 +41,15 @@ FrameBuffer::FrameBuffer() :
|
|||
{
|
||||
m_loadTileOrigin.uls = m_loadTileOrigin.ult = 0;
|
||||
m_pTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0);
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glGenFramebuffers(1, &m_FBO);
|
||||
#else
|
||||
m_FBO = GLuint(gfxContext.createFramebuffer());
|
||||
#endif
|
||||
}
|
||||
|
||||
FrameBuffer::~FrameBuffer()
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
if (m_FBO != 0)
|
||||
glDeleteFramebuffers(1, &m_FBO);
|
||||
if (m_resolveFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_resolveFBO);
|
||||
if (m_SubFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_SubFBO);
|
||||
#else
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_FBO));
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_resolveFBO));
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_SubFBO));
|
||||
#endif
|
||||
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
textureCache().removeFrameBufferTexture(m_pResolveTexture);
|
||||
textureCache().removeFrameBufferTexture(m_pSubTexture);
|
||||
|
@ -95,31 +83,6 @@ void FrameBuffer::_initTexture(u16 _width, u16 _height, u16 _format, u16 _size,
|
|||
|
||||
void FrameBuffer::_setAndAttachTexture(u32 _fbo, CachedTexture *_pTexture, u32 _t, bool _multisampling)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
if (_pTexture->size > G_IM_SIZ_8b) {
|
||||
|
||||
#if defined(GLES3) || defined (GLES3_1)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, fboFormats.colorInternalFormat, _pTexture->realWidth, _pTexture->realHeight);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0,
|
||||
fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
#if defined(GLES3) || defined (GLES3_1)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, fboFormats.monochromeInternalFormat, _pTexture->realWidth, _pTexture->realHeight);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, _pTexture->realWidth, _pTexture->realHeight,
|
||||
0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
#endif
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, _fbo);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _pTexture->glName, 0);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
{
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
|
@ -158,7 +121,6 @@ void FrameBuffer::_setAndAttachTexture(u32 _fbo, CachedTexture *_pTexture, u32 _
|
|||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
}
|
||||
assert(checkFBO());
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
}
|
||||
|
||||
bool FrameBuffer::_isMarioTennisScoreboard() const
|
||||
|
@ -200,40 +162,6 @@ void FrameBuffer::init(u32 _address, u32 _endAddress, u16 _format, u16 _size, u1
|
|||
m_fingerprint = false;
|
||||
|
||||
_initTexture(_width, _height, _format, _size, m_pTexture);
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_FBO);
|
||||
|
||||
if (config.video.multisampling != 0) {
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName);
|
||||
#if defined(GLESX)
|
||||
if (_size > G_IM_SIZ_8b)
|
||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
||||
else
|
||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.monochromeInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
||||
#else
|
||||
if (_size > G_IM_SIZ_8b)
|
||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
||||
else
|
||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.monochromeInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
||||
#endif
|
||||
m_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName, 0);
|
||||
|
||||
m_pResolveTexture = textureCache().addFrameBufferTexture(false);
|
||||
_initTexture(_width, _height, _format, _size, m_pResolveTexture);
|
||||
glGenFramebuffers(1, &m_resolveFBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_resolveFBO);
|
||||
_setAndAttachTexture(m_resolveFBO, m_pResolveTexture, 0, false);
|
||||
assert(checkFBO());
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_FBO);
|
||||
} else
|
||||
#endif // GL_MULTISAMPLING_SUPPORT
|
||||
_setAndAttachTexture(m_FBO, m_pTexture, 0, false);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
|
||||
if (config.video.multisampling != 0) {
|
||||
_setAndAttachTexture(m_FBO, m_pTexture, 0, true);
|
||||
|
@ -249,8 +177,6 @@ void FrameBuffer::init(u32 _address, u32 _endAddress, u16 _format, u16 _size, u1
|
|||
} else
|
||||
_setAndAttachTexture(m_FBO, m_pTexture, 0, false);
|
||||
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
ogl.getRender().clearColorBuffer(nullptr);
|
||||
}
|
||||
|
||||
|
@ -260,12 +186,7 @@ void FrameBuffer::reinit(u16 _height)
|
|||
const u32 endAddress = m_startAddress + ((m_width * _height) << m_size >> 1) - 1;
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
if (m_resolveFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_resolveFBO);
|
||||
#else
|
||||
gfxContext.deleteFramebuffer(graphics::ObjectHandle(m_resolveFBO));
|
||||
#endif
|
||||
|
||||
textureCache().removeFrameBufferTexture(m_pResolveTexture);
|
||||
m_pTexture = textureCache().addFrameBufferTexture(config.video.multisampling != 0);
|
||||
|
@ -397,13 +318,8 @@ void FrameBuffer::resolveMultisampledTexture(bool _bForce)
|
|||
|
||||
bool FrameBuffer::_initSubTexture(u32 _t)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
if (m_SubFBO == 0)
|
||||
glGenFramebuffers(1, &m_SubFBO);
|
||||
#else
|
||||
if (m_SubFBO == 0)
|
||||
m_SubFBO = GLuint(gfxContext.createFramebuffer());
|
||||
#endif
|
||||
|
||||
gDPTile * pTile = gSP.textureTile[_t];
|
||||
if (pTile->lrs < pTile->uls || pTile->lrt < pTile->ult)
|
||||
|
@ -427,37 +343,9 @@ bool FrameBuffer::_initSubTexture(u32 _t)
|
|||
m_pSubTexture->offsetS = 0.0f;
|
||||
m_pSubTexture->offsetT = m_pSubTexture->clampHeight;
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + _t);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pSubTexture->glName);
|
||||
if (m_pSubTexture->size > G_IM_SIZ_8b) {
|
||||
#if defined(GLES3) || defined (GLES3_1)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, fboFormats.colorInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pSubTexture->realWidth,
|
||||
m_pSubTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
#endif
|
||||
} else {
|
||||
#if defined(GLES3) || defined (GLES3_1)
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, fboFormats.monochromeInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pSubTexture->realWidth,
|
||||
m_pSubTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_SubFBO);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pSubTexture->glName, 0);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
|
||||
_setAndAttachTexture(m_SubFBO, m_pSubTexture, _t, false);
|
||||
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -398,23 +398,6 @@ void OGLRender::TexrectDrawer::init()
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// generate a framebuffer
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glGenFramebuffers(1, &m_FBO);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_pTexture->glName, 0);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
|
||||
graphics::Context::InitTextureParams initParams;
|
||||
initParams.handle = graphics::ObjectHandle(m_pTexture->glName);
|
||||
initParams.width = m_pTexture->realWidth;
|
||||
|
@ -440,7 +423,6 @@ void OGLRender::TexrectDrawer::init()
|
|||
bufTarget.textureTarget = graphics::target::TEXTURE_2D;
|
||||
bufTarget.textureHandle = graphics::ObjectHandle(m_pTexture->glName);
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
// check if everything is OK
|
||||
assert(checkFBO());
|
||||
|
|
|
@ -83,13 +83,6 @@ typedef char GLchar;
|
|||
#define VERTBUFF_SIZE 256U
|
||||
#define ELEMBUFF_SIZE 1024U
|
||||
|
||||
extern const char * strTexrectDrawerVertexShader;
|
||||
extern const char * strTexrectDrawerTex3PointFilter;
|
||||
extern const char * strTexrectDrawerTexBilinearFilter;
|
||||
extern const char * strTexrectDrawerFragmentShaderTex;
|
||||
extern const char * strTexrectDrawerFragmentShaderClean;
|
||||
extern const char * strTextureCopyShader;
|
||||
|
||||
struct CachedTexture;
|
||||
class OGLRender
|
||||
{
|
||||
|
|
|
@ -281,15 +281,6 @@ void _initTexture(CachedTexture * pTexture)
|
|||
pTexture->textureBytes = pTexture->realWidth * pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(pTexture->textureBytes);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pTexture->realWidth, pTexture->realHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
||||
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);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams initParams;
|
||||
initParams.handle = graphics::ObjectHandle(pTexture->glName);
|
||||
initParams.width = pTexture->realWidth;
|
||||
|
@ -305,7 +296,6 @@ void _initTexture(CachedTexture * pTexture)
|
|||
setParams.minFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
setParams.magFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
gfxContext.setTextureParameters(setParams);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -319,10 +309,6 @@ CachedTexture * _createTexture()
|
|||
static
|
||||
void _initFBO(GLuint _FBO, CachedTexture * _pTexture)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _FBO);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _pTexture->glName, 0);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::FrameBufferRenderTarget bufTarget;
|
||||
bufTarget.bufferHandle = graphics::ObjectHandle(_FBO);
|
||||
bufTarget.bufferTarget = graphics::bufferTarget::DRAW_FRAMEBUFFER;
|
||||
|
@ -330,19 +316,13 @@ void _initFBO(GLuint _FBO, CachedTexture * _pTexture)
|
|||
bufTarget.textureTarget = graphics::target::TEXTURE_2D;
|
||||
bufTarget.textureHandle = graphics::ObjectHandle(_pTexture->glName);
|
||||
gfxContext.addFrameBufferRenderTarget(bufTarget);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
assert(checkFBO());
|
||||
}
|
||||
|
||||
static
|
||||
GLuint _createFBO(CachedTexture * _pTexture)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
GLuint FBO;
|
||||
glGenFramebuffers(1, &FBO);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
GLuint FBO = GLuint(gfxContext.createFramebuffer());
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
_initFBO(FBO, _pTexture);
|
||||
return FBO;
|
||||
}
|
||||
|
|
|
@ -156,26 +156,6 @@ struct Atlas {
|
|||
|
||||
/* Create a texture that will be used to hold all ASCII glyphs */
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, monohromeInternalformat, w, h, 0, monohromeformat, GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
/* We require 1 byte alignment when uploading texture data */
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
/* Clamping to edges is important to prevent artifacts when scaling */
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
/* Linear filtering usually looks best for text */
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::ObjectHandle texHandle = gfxContext.createTexture(graphics::target::TEXTURE_2D);
|
||||
tex = GLuint(texHandle);
|
||||
|
||||
|
@ -199,7 +179,6 @@ struct Atlas {
|
|||
setParams.wrapS = graphics::textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
setParams.wrapT = graphics::textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
gfxContext.setTextureParameters(setParams);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
|
||||
/* Paste all glyph bitmaps into the texture, remembering the offset */
|
||||
int ox = 0;
|
||||
|
@ -240,11 +219,7 @@ struct Atlas {
|
|||
}
|
||||
|
||||
~Atlas() {
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glDeleteTextures(1, &tex);
|
||||
#else
|
||||
gfxContext.deleteTexture(graphics::ObjectHandle(tex));
|
||||
#endif
|
||||
gfxContext.deleteTexture(graphics::ObjectHandle(tex));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
177
src/Textures.cpp
177
src/Textures.cpp
|
@ -477,10 +477,6 @@ void TextureCache::init()
|
|||
m_pDummy = addFrameBufferTexture(false); // we don't want to remove dummy texture
|
||||
_initDummyTexture(m_pDummy);
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glBindTexture(GL_TEXTURE_2D, m_pDummy->glName);
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, dummyTexture );
|
||||
#else
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(m_pDummy->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -492,7 +488,6 @@ void TextureCache::init()
|
|||
params.dataType = graphics::datatype::UNSIGNED_BYTE;
|
||||
params.data = dummyTexture;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif
|
||||
|
||||
m_cachedBytes = m_pDummy->textureBytes;
|
||||
activateDummy( 0 );
|
||||
|
@ -500,30 +495,6 @@ void TextureCache::init()
|
|||
current[0] = current[1] = nullptr;
|
||||
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (config.video.multisampling != 0) {
|
||||
m_pMSDummy = addFrameBufferTexture(); // we don't want to remove dummy texture
|
||||
_initDummyTexture(m_pMSDummy);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pMSDummy->glName);
|
||||
|
||||
#if defined(GLESX)
|
||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling,
|
||||
GL_RGBA8, m_pMSDummy->realWidth, m_pMSDummy->realHeight, false);
|
||||
#else
|
||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling,
|
||||
GL_RGBA8, m_pMSDummy->realWidth, m_pMSDummy->realHeight, false);
|
||||
#endif
|
||||
activateMSDummy(0);
|
||||
activateMSDummy(1);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
m_pMSDummy = nullptr;
|
||||
|
||||
#else
|
||||
m_pMSDummy = nullptr;
|
||||
if (config.video.multisampling != 0 && gfxContext.isMultisamplingSupported()) {
|
||||
m_pMSDummy = addFrameBufferTexture(true); // we don't want to remove dummy texture
|
||||
|
@ -543,7 +514,6 @@ void TextureCache::init()
|
|||
activateMSDummy(0);
|
||||
activateMSDummy(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(!isGLError());
|
||||
}
|
||||
|
@ -783,11 +753,6 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
|
|||
bpl, paladdr);
|
||||
GHQTexInfo ghqTexInfo;
|
||||
if (txfilter_hirestex(_pTexture->crc, ricecrc, palette, &ghqTexInfo)) {
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, ghqTexInfo.format,
|
||||
ghqTexInfo.width, ghqTexInfo.height, 0, ghqTexInfo.texture_format,
|
||||
ghqTexInfo.pixel_type, ghqTexInfo.data);
|
||||
#else
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -799,7 +764,6 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
|
|||
params.dataType = graphics::Parameter(ghqTexInfo.pixel_type);
|
||||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif
|
||||
|
||||
assert(!isGLError());
|
||||
_updateCachedTexture(ghqTexInfo, _pTexture);
|
||||
|
@ -876,12 +840,6 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
ghqTexInfo.format != GL_RGBA &&
|
||||
m_curUnpackAlignment > 1)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, ghqTexInfo.format,
|
||||
ghqTexInfo.width, ghqTexInfo.height, 0,
|
||||
ghqTexInfo.texture_format, ghqTexInfo.pixel_type,
|
||||
ghqTexInfo.data);
|
||||
#else
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -893,7 +851,6 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
params.dataType = graphics::Parameter(ghqTexInfo.pixel_type);
|
||||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif
|
||||
_updateCachedTexture(ghqTexInfo, pTexture);
|
||||
bLoaded = true;
|
||||
}
|
||||
|
@ -901,15 +858,6 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
if (!bLoaded) {
|
||||
if (pTexture->realWidth % 2 != 0 && glInternalFormat != GL_RGBA)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GLES2
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pTexture->realWidth,
|
||||
pTexture->realHeight, 0, GL_RGBA, glType, pDest);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glInternalFormat, pTexture->realWidth,
|
||||
pTexture->realHeight, 0, GL_RGBA, glType, pDest);
|
||||
#endif
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -921,7 +869,6 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
params.dataType = graphics::Parameter(glType);
|
||||
params.data = pDest;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
}
|
||||
if (m_curUnpackAlignment > 1)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, m_curUnpackAlignment);
|
||||
|
@ -973,15 +920,6 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
|
|||
_ricecrc = txfilter_checksum(addr, tile_width, tile_height, (unsigned short)(_pTexture->format << 8 | _pTexture->size), bpl, paladdr);
|
||||
GHQTexInfo ghqTexInfo;
|
||||
if (txfilter_hirestex(_pTexture->crc, _ricecrc, palette, &ghqTexInfo)) {
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GLES2
|
||||
#ifdef GLES2
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ghqTexInfo.width, ghqTexInfo.height, 0, GL_RGBA, ghqTexInfo.pixel_type, ghqTexInfo.data);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, ghqTexInfo.format, ghqTexInfo.width, ghqTexInfo.height, 0, ghqTexInfo.texture_format, ghqTexInfo.pixel_type, ghqTexInfo.data);
|
||||
#endif
|
||||
#endif
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -993,7 +931,6 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
|
|||
params.dataType = graphics::Parameter(ghqTexInfo.pixel_type);
|
||||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
assert(!isGLError());
|
||||
_updateCachedTexture(ghqTexInfo, _pTexture);
|
||||
return true;
|
||||
|
@ -1013,9 +950,6 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
|
|||
for (u32 t = 0; t < numTexels; ++t)
|
||||
pDestF[t] = _pDest[t] / 65535.0f;
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, _pTexture->realWidth, _pTexture->realHeight, 0, GL_RED, GL_FLOAT, pDestF);
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -1027,7 +961,6 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
|
|||
params.dataType = graphics::datatype::FLOAT;
|
||||
params.data = pDestF;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
free(pDestF);
|
||||
#endif
|
||||
}
|
||||
|
@ -1221,19 +1154,6 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
if (txfilter_filter((u8*)pDest, tmptex.realWidth, tmptex.realHeight,
|
||||
glInternalFormat, (uint64)_pTexture->crc,
|
||||
&ghqTexInfo) != 0 && ghqTexInfo.data != nullptr) {
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GLES2
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
ghqTexInfo.width, ghqTexInfo.height,
|
||||
0, GL_RGBA, ghqTexInfo.pixel_type,
|
||||
ghqTexInfo.data);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, ghqTexInfo.format,
|
||||
ghqTexInfo.width, ghqTexInfo.height,
|
||||
0, ghqTexInfo.texture_format, ghqTexInfo.pixel_type,
|
||||
ghqTexInfo.data);
|
||||
#endif
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
params.mipMapLevel = 0;
|
||||
|
@ -1245,7 +1165,6 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
params.dataType = graphics::Parameter(ghqTexInfo.pixel_type);
|
||||
params.data = ghqTexInfo.data;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
_updateCachedTexture(ghqTexInfo, _pTexture);
|
||||
bLoaded = true;
|
||||
}
|
||||
|
@ -1255,15 +1174,6 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
glInternalFormat != GL_RGBA &&
|
||||
m_curUnpackAlignment > 1)
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GLES2
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tmptex.realWidth,
|
||||
tmptex.realHeight, 0, GL_RGBA, glType, pDest);
|
||||
#else
|
||||
glTexImage2D(GL_TEXTURE_2D, mipLevel, glInternalFormat, tmptex.realWidth,
|
||||
tmptex.realHeight, 0, GL_RGBA, glType, pDest);
|
||||
#endif
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::InitTextureParams params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
params.mipMapLevel = mipLevel;
|
||||
|
@ -1276,7 +1186,6 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
params.dataType = graphics::Parameter(glType);
|
||||
params.data = pDest;
|
||||
gfxContext.init2DTexture(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
}
|
||||
if (mipLevel == _pTexture->max_level)
|
||||
break;
|
||||
|
@ -1345,69 +1254,6 @@ u32 _calculateCRC(u32 _t, const TextureParams & _params, u32 _bytes)
|
|||
void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
|
||||
{
|
||||
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (config.video.multisampling > 0 && _pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
||||
glActiveTexture(GL_TEXTURE0 + g_MSTex0Index + _t);
|
||||
// Bind the cached texture
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + _t);
|
||||
// Bind the cached texture
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
}
|
||||
|
||||
const bool bUseBilinear = (gDP.otherMode.textureFilter | (gSP.objRendermode&G_OBJRM_BILERP)) != 0;
|
||||
const bool bUseLOD = currentCombiner()->usesLOD();
|
||||
const GLint texLevel = bUseLOD ? _pTexture->max_level : 0;
|
||||
|
||||
#ifndef GLES2
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, texLevel);
|
||||
#endif
|
||||
if (config.texture.bilinearMode == BILINEAR_STANDARD) {
|
||||
if (bUseBilinear) {
|
||||
if (texLevel > 0)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
else
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
if (texLevel > 0)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
|
||||
else
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
} else { // 3 point filter
|
||||
if (texLevel > 0) { // Apply standard bilinear to mipmap textures
|
||||
if (bUseBilinear) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
} else {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
} else if (bUseBilinear && config.generalEmulation.enableLOD != 0 && bUseLOD) { // Apply standard bilinear to first tile of mipmap texture
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
} else { // Don't use texture filter. Texture will be filtered by 3 point filter shader
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set clamping modes
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _pTexture->clampS ? GL_CLAMP_TO_EDGE : _pTexture->mirrorS ? GL_MIRRORED_REPEAT : GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _pTexture->clampT ? GL_CLAMP_TO_EDGE : _pTexture->mirrorT ? GL_MIRRORED_REPEAT : GL_REPEAT);
|
||||
|
||||
if (video().getRender().getRenderState() == OGLRender::rsTriangle && config.texture.maxAnisotropyF > 0.0f)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, config.texture.maxAnisotropyF);
|
||||
|
||||
#else //GRAPHICS_CONTEXT
|
||||
graphics::Context::TexParameters params;
|
||||
params.handle = graphics::ObjectHandle(_pTexture->glName);
|
||||
if (config.video.multisampling > 0 && _pTexture->frameBufferTexture == CachedTexture::fbMultiSample) {
|
||||
|
@ -1473,21 +1319,12 @@ void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
|
|||
params.maxAnisotropy = graphics::Parameter(config.texture.maxAnisotropyF);
|
||||
|
||||
gfxContext.setTextureParameters(params);
|
||||
#endif //GRAPHICS_CONTEXT
|
||||
|
||||
current[_t] = _pTexture;
|
||||
}
|
||||
|
||||
void TextureCache::activateDummy(u32 _t)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
glActiveTexture(GL_TEXTURE0 + _t);
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, m_pDummy->glName );
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::TexParameters params;
|
||||
params.handle = graphics::ObjectHandle(m_pDummy->glName);
|
||||
params.target = graphics::target::TEXTURE_2D;
|
||||
|
@ -1495,23 +1332,10 @@ void TextureCache::activateDummy(u32 _t)
|
|||
params.minFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
params.magFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
gfxContext.setTextureParameters(params);
|
||||
#endif // GRAPHICS_CONTEXT
|
||||
}
|
||||
|
||||
void TextureCache::activateMSDummy(u32 _t)
|
||||
{
|
||||
#ifndef GRAPHICS_CONTEXT
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
glActiveTexture(GL_TEXTURE0 + g_MSTex0Index + _t);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pMSDummy->glName);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
|
||||
#endif
|
||||
#else // GRAPHICS_CONTEXT
|
||||
graphics::Context::TexParameters params;
|
||||
params.handle = graphics::ObjectHandle(m_pMSDummy->glName);
|
||||
params.target = graphics::target::TEXTURE_2D_MULTISAMPLE;
|
||||
|
@ -1519,7 +1343,6 @@ void TextureCache::activateMSDummy(u32 _t)
|
|||
params.minFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
params.magFilter = graphics::textureParameters::FILTER_NEAREST;
|
||||
gfxContext.setTextureParameters(params);
|
||||
#endif //GRAPHICS_CONTEXT
|
||||
}
|
||||
|
||||
void TextureCache::_updateBackground()
|
||||
|
|
Loading…
Reference in New Issue
Block a user