1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Use floating point frame buffer format for Adreno 500 series GPUs

This commit is contained in:
Francisco Zurita 2017-04-15 23:05:15 -04:00 committed by Sergey Lipskiy
parent 38060cc368
commit 4a8ae7e1cf
3 changed files with 22 additions and 7 deletions

View File

@ -469,7 +469,8 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
return _glinfo.isGLESX && !_glinfo.isGLES2;
}
FramebufferTextureFormatsGLES3()
FramebufferTextureFormatsGLES3(const GLInfo & _glinfo):
m_glinfo(_glinfo)
{
init();
}
@ -477,10 +478,17 @@ struct FramebufferTextureFormatsGLES3 : public graphics::FramebufferTextureForma
protected:
void init() override
{
colorInternalFormat = GL_RGBA8;
colorFormat = GL_RGBA;
colorType = GL_UNSIGNED_BYTE;
colorFormatBytes = 4;
if (m_glinfo.renderer == Renderer::Adreno500) {
colorInternalFormat = GL_RGBA32F;
colorFormat = GL_RGBA;
colorType = GL_FLOAT;
colorFormatBytes = 16;
} else {
colorInternalFormat = GL_RGBA8;
colorFormat = GL_RGBA;
colorType = GL_UNSIGNED_BYTE;
colorFormatBytes = 4;
}
monochromeInternalFormat = GL_R8;
monochromeFormat = GL_RED;
@ -507,6 +515,8 @@ protected:
noiseType = GL_UNSIGNED_BYTE;
noiseFormatBytes = 1;
}
const GLInfo & m_glinfo;
};
struct FramebufferTextureFormatsOpenGL : public graphics::FramebufferTextureFormats
@ -629,7 +639,7 @@ graphics::FramebufferTextureFormats * BufferManipulationObjectFactory::getFrameb
return new FramebufferTextureFormatsOpenGL;
if (FramebufferTextureFormatsGLES3::Check(m_glInfo))
return new FramebufferTextureFormatsGLES3;
return new FramebufferTextureFormatsGLES3(m_glInfo);
if (FramebufferTextureFormatsGLES2::Check(m_glInfo))
return new FramebufferTextureFormatsGLES2(m_glInfo);

View File

@ -2,6 +2,7 @@
#include <Config.h>
#include "opengl_Utils.h"
#include "opengl_GLInfo.h"
#include <regex>
#ifdef EGL
#include <EGL/egl.h>
#endif
@ -25,7 +26,10 @@ void GLInfo::init() {
LOG(LOG_VERBOSE, "OpenGL vendor: %s\n", glGetString(GL_VENDOR));
const GLubyte * strRenderer = glGetString(GL_RENDERER);
if (strstr((const char*)strRenderer, "Adreno") != nullptr)
if (std::regex_match((const char*)strRenderer, std::regex("Adreno.*5\\d\\d") ))
renderer = Renderer::Adreno500;
else if (strstr((const char*)strRenderer, "Adreno") != nullptr)
renderer = Renderer::Adreno;
else if (strstr((const char*)strRenderer, "VideoCore IV") != nullptr)
renderer = Renderer::VideoCore;

View File

@ -4,6 +4,7 @@
namespace opengl {
enum class Renderer {
Adreno500,
Adreno,
VideoCore,
Intel,