first try of primitive restart index generator

Convert all quads+triangles into trangle_strip and uses primitive restart to split them.
Speed up triangle_strip, but slows down all others primitive formats.
Only implemented in ogl.
This commit is contained in:
degasus
2013-03-29 14:27:33 +01:00
parent c743e75d92
commit ca8554e7d1
8 changed files with 102 additions and 33 deletions

View File

@ -293,6 +293,7 @@ Renderer::Renderer()
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
g_Config.backend_info.bSupportsPrimitiveRestart = false; //GLEW_VERSION_3_1;
g_ogl_config.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
g_ogl_config.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
@ -328,9 +329,10 @@ Renderer::Renderer()
g_ogl_config.gl_renderer,
g_ogl_config.gl_version).c_str(), 5000);
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s%s%s",
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s%s%s%s",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
g_ogl_config.bSupportsGLSLCache ? "" : "ShaderCache ",
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
@ -1391,6 +1393,12 @@ void Renderer::ResetAPIState()
glDisable(GL_BLEND);
glDepthMask(GL_FALSE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
{
glDisable(GL_PRIMITIVE_RESTART);
}
}
void Renderer::RestoreAPIState()
@ -1411,6 +1419,12 @@ void Renderer::RestoreAPIState()
vm->m_last_vao = 0;
TextureCache::SetStage();
if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
{
glEnable(GL_PRIMITIVE_RESTART);
glPrimitiveRestartIndex(65535);
}
}
void Renderer::SetGenerationMode()