Make supports SP checking global

This commit is contained in:
Benau 2018-01-12 01:28:13 +08:00
parent 4252895d8b
commit 7f3722d90b
3 changed files with 13 additions and 12 deletions

View File

@ -24,6 +24,8 @@
#include "graphics/glwrap.hpp"
#include "graphics/graphics_restrictions.hpp"
bool CentralVideoSettings::m_supports_sp = true;
CentralVideoSettings *CVS = new CentralVideoSettings();
void CentralVideoSettings::init()
@ -214,6 +216,12 @@ void CentralVideoSettings::init()
// Compiler crashes with a big loop in RH or GI shaders
m_need_rh_workaround = true;
}
// Check all extensions required by SP
m_supports_sp = isARBInstancedArraysUsable() &&
isARBVertexType2101010RevUsable() && isARBSamplerObjectsUsable() &&
isARBExplicitAttribLocationUsable();
#else
if (m_glsl == true)
{
@ -489,16 +497,6 @@ bool CentralVideoSettings::isARBInstancedArraysUsable() const
(m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 2));
}
bool CentralVideoSettings::supportsSP() const
{
#ifdef USE_GLES2
return true;
#else
return isARBInstancedArraysUsable() && isARBVertexType2101010RevUsable() &&
isARBSamplerObjectsUsable() && isARBExplicitAttribLocationUsable();
#endif
}
bool CentralVideoSettings::useArrayTextures() const
{
return false;

View File

@ -58,6 +58,8 @@ private:
bool m_need_vertex_id_workaround;
bool m_GI_has_artifact;
public:
static bool m_supports_sp;
void init();
bool isGLSL() const;
unsigned getGLSLVersion() const;
@ -103,7 +105,6 @@ public:
bool supportsComputeShadersFiltering() const;
bool supportsHardwareSkinning() const;
bool supportsTextureCompression() const;
bool supportsSP() const;
bool supportsGLLayerInVertexShader() const;

View File

@ -463,6 +463,8 @@ void IrrDriver::initDevice()
}
#ifndef SERVER_ONLY
// Assume sp is supported
CentralVideoSettings::m_supports_sp = true;
CVS->init();
bool recreate_device = false;
@ -473,7 +475,7 @@ void IrrDriver::initDevice()
// fixed pipeline in this case.
if (!ProfileWorld::isNoGraphics() &&
(GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FORCE_LEGACY_DEVICE) ||
!CVS->supportsSP()))
!CentralVideoSettings::m_supports_sp))
{
Log::warn("irr_driver", "Driver doesn't support shader-based pipeline. "
"Re-creating device to workaround the issue.");