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

PowerVR performance improvement

This commit is contained in:
Francisco Zurita 2016-06-24 02:01:12 -04:00 committed by Sergey Lipskiy
parent f235d9b07c
commit 93be54a54d
4 changed files with 32 additions and 12 deletions

View File

@ -31,7 +31,8 @@ const char * strLightUniforms[UniformBlock::luTotal] = {
"uLightColor"
};
UniformBlock::UniformBlock() : m_currentBuffer(0), m_renderer(video().getRender().getRenderer())
UniformBlock::UniformBlock() : m_currentBuffer(0),
m_isBufferSubDataSupported(video().getRender().isBufferSubDataSupported())
{
}
@ -148,7 +149,7 @@ void UniformBlock::setColorData(ColorUniforms _index, u32 _dataSize, const void
glBindBuffer(GL_UNIFORM_BUFFER, m_colorsBlock.m_buffer);
}
if (m_renderer != OGLRender::glrAdreno)
if (m_isBufferSubDataSupported)
glBufferSubData(GL_UNIFORM_BUFFER, m_colorsBlock.m_offsets[_index], _dataSize, _data);
else
glBufferData(GL_UNIFORM_BUFFER, m_colorsBlockData.size(), m_colorsBlockData.data(), GL_STATIC_DRAW);
@ -159,7 +160,8 @@ void UniformBlock::updateTextureParameters()
if (m_textureBlock.m_buffer == 0)
return;
GLbyte * pData = m_textureBlockData.data();
std::vector<GLbyte> temp(m_textureBlockData.size(), 0);
GLbyte * pData = temp.data();
f32 texScale[4] = { gSP.texture.scales, gSP.texture.scalet, 0, 0 };
memcpy(pData + m_textureBlock.m_offsets[tuTexScale], texScale, m_textureBlock.m_offsets[tuTexOffset] - m_textureBlock.m_offsets[tuTexScale]);
@ -230,11 +232,14 @@ void UniformBlock::updateTextureParameters()
m_currentBuffer = m_textureBlock.m_buffer;
glBindBuffer(GL_UNIFORM_BUFFER, m_textureBlock.m_buffer);
}
if (m_renderer != OGLRender::glrAdreno)
glBufferSubData(GL_UNIFORM_BUFFER, m_textureBlock.m_offsets[tuTexScale], m_textureBlockData.size(), pData);
else
glBufferData(GL_UNIFORM_BUFFER, m_textureBlockData.size(), m_textureBlockData.data(), GL_STATIC_DRAW);
if(temp != m_textureBlockData) {
m_textureBlockData = temp;
if (m_isBufferSubDataSupported)
glBufferSubData(GL_UNIFORM_BUFFER, m_textureBlock.m_offsets[tuTexScale], m_textureBlockData.size(), pData);
else
glBufferData(GL_UNIFORM_BUFFER, m_textureBlockData.size(), m_textureBlockData.data(), GL_STATIC_DRAW);
}
}
void UniformBlock::updateLightParameters()
@ -253,7 +258,7 @@ void UniformBlock::updateLightParameters()
glBindBuffer(GL_UNIFORM_BUFFER, m_lightBlock.m_buffer);
}
if (m_renderer != OGLRender::glrAdreno)
if (m_isBufferSubDataSupported)
glBufferSubData(GL_UNIFORM_BUFFER, m_lightBlock.m_offsets[luLightDirection], m_lightBlockData.size(), pData);
else
glBufferData(GL_UNIFORM_BUFFER, m_lightBlockData.size(), m_lightBlockData.data(), GL_STATIC_DRAW);

View File

@ -63,7 +63,7 @@ private:
};
GLuint m_currentBuffer;
OGLRender::OGL_RENDERER m_renderer;
bool m_isBufferSubDataSupported;
UniformBlockData<tuTotal, 1> m_textureBlock;
UniformBlockData<cuTotal, 2> m_colorsBlock;

View File

@ -1723,8 +1723,16 @@ void OGLRender::_initExtensions()
const GLubyte * strRenderer = glGetString(GL_RENDERER);
if (strstr((const char*)strRenderer, "Adreno") != nullptr)
m_oglRenderer = glrAdreno;
else if (strstr((const char*)strRenderer, "PowerVR") != nullptr)
m_oglRenderer = glrPowerVR;
else if (strstr((const char*)strRenderer, "Mali") != nullptr)
m_oglRenderer = glrMali;
LOG(LOG_VERBOSE, "OpenGL renderer: %s\n", strRenderer);
m_isBufferSubDataSupported = m_oglRenderer != OGLRender::glrAdreno &&
m_oglRenderer != OGLRender::glrPowerVR &&
m_oglRenderer != OGLRender::glrMali;
fboFormats.init();
#ifndef GLES2

View File

@ -166,10 +166,14 @@ public:
enum OGL_RENDERER {
glrOther,
glrAdreno
glrAdreno,
glrPowerVR,
glrMali
};
OGL_RENDERER getRenderer() const { return m_oglRenderer; }
bool isBufferSubDataSupported() const {return m_isBufferSubDataSupported;}
void dropRenderState() {m_renderState = rsNone;}
private:
@ -177,7 +181,8 @@ private:
: m_oglRenderer(glrOther)
, m_modifyVertices(0)
, m_bImageTexture(false)
, m_bFlatColors(false) {
, m_bFlatColors(false)
, m_isBufferSubDataSupported(true){
}
OGLRender(const OGLRender &);
friend class OGLVideo;
@ -260,6 +265,8 @@ private:
TexrectDrawer m_texrectDrawer;
GLuint m_programCopyTex;
bool m_isBufferSubDataSupported;
};
class OGLVideo