mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
OGL: Move primitive restart enable logic to GLUtil
This commit is contained in:
parent
51a586d11a
commit
93ab50c555
@ -102,4 +102,27 @@ GLuint CompileProgram(const std::string& vertexShader, const std::string& fragme
|
||||
|
||||
return programID;
|
||||
}
|
||||
|
||||
void EnablePrimitiveRestart()
|
||||
{
|
||||
constexpr GLuint PRIMITIVE_RESTART_INDEX = 65535;
|
||||
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GLExtensions::Version() >= 310)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(PRIMITIVE_RESTART_INDEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
glPrimitiveRestartIndexNV(PRIMITIVE_RESTART_INDEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,4 +12,5 @@ namespace GLUtil
|
||||
{
|
||||
void InitInterface();
|
||||
GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
void EnablePrimitiveRestart();
|
||||
}
|
||||
|
@ -824,25 +824,7 @@ bool SharedContextAsyncShaderCompiler::WorkerThreadInitWorkerThread(void* param)
|
||||
|
||||
s_is_shared_context = true;
|
||||
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
{
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GLExtensions::Version() >= 310)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(65535);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
glPrimitiveRestartIndexNV(65535);
|
||||
}
|
||||
}
|
||||
}
|
||||
GLUtil::EnablePrimitiveRestart();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -788,25 +788,7 @@ Renderer::Renderer()
|
||||
glClearDepthf(1.0f);
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
{
|
||||
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGLES3)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GLExtensions::Version() >= 310)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(65535);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
glPrimitiveRestartIndexNV(65535);
|
||||
}
|
||||
}
|
||||
}
|
||||
GLUtil::EnablePrimitiveRestart();
|
||||
IndexGenerator::Init();
|
||||
|
||||
UpdateActiveConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user