mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Use glTexStorage2DMultisample instead of glTexImage2DMultisample for OpenGL.
The same code with GLES3X.
This commit is contained in:
parent
8a92860271
commit
263ddf4baa
|
@ -145,11 +145,7 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
||||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||||
if (_multisample) {
|
if (_multisample) {
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _pTexture->glName);
|
||||||
#if defined(GLES3_1)
|
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, false);
|
||||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT24, _pTexture->realWidth, _pTexture->realHeight, false);
|
|
||||||
#else
|
|
||||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_DEPTH_COMPONENT, _pTexture->realWidth, _pTexture->realHeight, false);
|
|
||||||
#endif
|
|
||||||
_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||||
} else
|
} else
|
||||||
#endif // GL_MULTISAMPLING_SUPPORT
|
#endif // GL_MULTISAMPLING_SUPPORT
|
||||||
|
|
|
@ -141,17 +141,10 @@ void FrameBuffer::init(u32 _address, u32 _endAddress, u16 _format, u16 _size, u1
|
||||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||||
if (config.video.multisampling != 0) {
|
if (config.video.multisampling != 0) {
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName);
|
||||||
#if defined(GLES3_1)
|
|
||||||
if (_size > G_IM_SIZ_8b)
|
if (_size > G_IM_SIZ_8b)
|
||||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_RGBA8, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, GL_RGBA8, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
||||||
else
|
else
|
||||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling, fboFormats.monochromeInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, false);
|
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, GL_RGBA8, 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;
|
m_pTexture->frameBufferTexture = CachedTexture::fbMultiSample;
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, m_pTexture->glName, 0);
|
||||||
|
|
||||||
|
|
|
@ -489,13 +489,8 @@ void TextureCache::init()
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pMSDummy->glName);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_pMSDummy->glName);
|
||||||
|
|
||||||
#if defined(GLES3_1)
|
|
||||||
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling,
|
glTexStorage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, config.video.multisampling,
|
||||||
GL_RGBA8, m_pMSDummy->realWidth, m_pMSDummy->realHeight, false);
|
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(0);
|
||||||
activateMSDummy(1);
|
activateMSDummy(1);
|
||||||
|
|
|
@ -84,6 +84,7 @@ PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||||
PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
|
||||||
PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||||
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
||||||
|
PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample;
|
||||||
PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
||||||
PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
||||||
PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
||||||
|
@ -190,6 +191,10 @@ void initGLFunctions()
|
||||||
glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)glGetProcAddress( "glGenFramebuffers" );
|
glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)glGetProcAddress( "glGenFramebuffers" );
|
||||||
glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glGetProcAddress( "glFramebufferTexture2D" );
|
glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)glGetProcAddress( "glFramebufferTexture2D" );
|
||||||
glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)glGetProcAddress("glTexImage2DMultisample");
|
glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)glGetProcAddress("glTexImage2DMultisample");
|
||||||
|
glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glGetProcAddress("glTexStorage2DMultisample");
|
||||||
|
if (glTexStorage2DMultisample == nullptr)
|
||||||
|
// Dirty hack to enable MSAA for GL below 4.3
|
||||||
|
glTexStorage2DMultisample = (PFNGLTEXSTORAGE2DMULTISAMPLEPROC)glTexImage2DMultisample;
|
||||||
glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)glGetProcAddress( "glGenRenderbuffers" );
|
glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)glGetProcAddress( "glGenRenderbuffers" );
|
||||||
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)glGetProcAddress( "glBindRenderbuffer" );
|
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)glGetProcAddress( "glBindRenderbuffer" );
|
||||||
glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)glGetProcAddress( "glRenderbufferStorage" );
|
glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)glGetProcAddress( "glRenderbufferStorage" );
|
||||||
|
|
|
@ -74,6 +74,7 @@ extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
|
||||||
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
|
||||||
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
|
||||||
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
|
||||||
|
extern PFNGLTEXSTORAGE2DMULTISAMPLEPROC glTexStorage2DMultisample;
|
||||||
extern PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
extern PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers;
|
||||||
extern PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
extern PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer;
|
||||||
extern PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
extern PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user