Auto fallback to legacy pipeline if not supports all functions required by SP
This commit is contained in:
parent
26a481e478
commit
49568f3fd9
@ -32,9 +32,7 @@ void CentralVideoSettings::init()
|
||||
m_gl_minor_version = 1;
|
||||
|
||||
// Parse extensions
|
||||
hasBaseInstance = false;
|
||||
hasBufferStorage = false;
|
||||
hasDrawIndirect = false;
|
||||
hasComputeShaders = false;
|
||||
hasArraysOfArrays = false;
|
||||
hasTextureStorage = false;
|
||||
@ -43,7 +41,6 @@ void CentralVideoSettings::init()
|
||||
hasAtomics = false;
|
||||
hasSSBO = false;
|
||||
hasImageLoadStore = false;
|
||||
hasMultiDrawIndirect = false;
|
||||
hasTextureCompression = false;
|
||||
hasUBO = false;
|
||||
hasExplicitAttribLocation = false;
|
||||
@ -54,7 +51,7 @@ void CentralVideoSettings::init()
|
||||
hasSRGBFramebuffer = false;
|
||||
hasSamplerObjects = false;
|
||||
hasVertexType2101010Rev = false;
|
||||
hasNVGPUShader5 = false;
|
||||
hasInstancedArrays = false;
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
hasBGRA = false;
|
||||
@ -63,8 +60,6 @@ void CentralVideoSettings::init()
|
||||
|
||||
m_GI_has_artifact = false;
|
||||
m_need_rh_workaround = false;
|
||||
m_need_srgb_workaround = false;
|
||||
m_need_srgb_visual_workaround = false;
|
||||
m_need_vertex_id_workaround = false;
|
||||
|
||||
// Call to glGetIntegerv should not be made if --no-graphics is used
|
||||
@ -119,16 +114,6 @@ void CentralVideoSettings::init()
|
||||
hasBufferStorage = true;
|
||||
Log::info("GLDriver", "ARB Buffer Storage Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BASE_INSTANCE) &&
|
||||
hasGLExtension("GL_ARB_base_instance")) {
|
||||
hasBaseInstance = true;
|
||||
Log::info("GLDriver", "ARB Base Instance Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_DRAW_INDIRECT) &&
|
||||
hasGLExtension("GL_ARB_draw_indirect")) {
|
||||
hasDrawIndirect = true;
|
||||
Log::info("GLDriver", "ARB Draw Indirect Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_COMPUTE_SHADER) &&
|
||||
hasGLExtension("GL_ARB_compute_shader")) {
|
||||
hasComputeShaders = true;
|
||||
@ -149,11 +134,6 @@ void CentralVideoSettings::init()
|
||||
hasTextureView = true;
|
||||
Log::info("GLDriver", "ARB Texture View Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BINDLESS_TEXTURE) &&
|
||||
hasGLExtension("GL_ARB_bindless_texture")) {
|
||||
hasBindlessTexture = true;
|
||||
Log::info("GLDriver", "ARB Bindless Texture Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_IMAGE_LOAD_STORE) &&
|
||||
hasGLExtension("GL_ARB_shader_image_load_store")) {
|
||||
hasImageLoadStore = true;
|
||||
@ -169,11 +149,6 @@ void CentralVideoSettings::init()
|
||||
hasSSBO = true;
|
||||
Log::info("GLDriver", "ARB Shader Storage Buffer Object Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_MULTI_DRAW_INDIRECT) &&
|
||||
hasGLExtension("GL_ARB_multi_draw_indirect")) {
|
||||
hasMultiDrawIndirect = true;
|
||||
Log::info("GLDriver", "ARB Multi Draw Indirect Present");
|
||||
}
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXT_TEXTURE_COMPRESSION_S3TC) &&
|
||||
hasGLExtension("GL_EXT_texture_compression_s3tc") &&
|
||||
hasGLExtension("GL_ARB_texture_compression_rgtc"))
|
||||
@ -222,10 +197,10 @@ void CentralVideoSettings::init()
|
||||
hasVertexType2101010Rev = true;
|
||||
Log::info("GLDriver", "ARB Vertex Type 2_10_10_10_rev Present");
|
||||
}
|
||||
if (hasGLExtension("GL_NV_gpu_shader5"))
|
||||
if (hasGLExtension("GL_ARB_instanced_arrays"))
|
||||
{
|
||||
hasNVGPUShader5 = true;
|
||||
Log::info("GLDriver", "GL_NV_gpu_shader5 Present");
|
||||
hasInstancedArrays = true;
|
||||
Log::info("GLDriver", "ARB Instanced Arrays Present");
|
||||
}
|
||||
if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_GI))
|
||||
{
|
||||
@ -239,13 +214,6 @@ void CentralVideoSettings::init()
|
||||
// Compiler crashes with a big loop in RH or GI shaders
|
||||
m_need_rh_workaround = true;
|
||||
}
|
||||
|
||||
if (strstr((const char *)glGetString(GL_VENDOR), "ATI") != NULL)
|
||||
{
|
||||
// Bindless textures are all treated RGB even sRGB one
|
||||
m_need_srgb_workaround = true;
|
||||
}
|
||||
|
||||
#else
|
||||
if (m_glsl == true)
|
||||
{
|
||||
@ -253,6 +221,7 @@ void CentralVideoSettings::init()
|
||||
hasTextureSwizzle = true;
|
||||
hasSamplerObjects = true;
|
||||
hasVertexType2101010Rev = true;
|
||||
hasInstancedArrays = true;
|
||||
}
|
||||
|
||||
if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXPLICIT_ATTRIB_LOCATION) &&
|
||||
@ -336,16 +305,6 @@ bool CentralVideoSettings::needRHWorkaround() const
|
||||
return m_need_rh_workaround;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::needsRGBBindlessWorkaround() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::needsSRGBCapableVisualWorkaround() const
|
||||
{
|
||||
return m_need_srgb_visual_workaround;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::needsVertexIdWorkaround() const
|
||||
{
|
||||
return m_need_vertex_id_workaround;
|
||||
@ -364,7 +323,8 @@ bool CentralVideoSettings::isARBUniformBufferObjectUsable() const
|
||||
|
||||
bool CentralVideoSettings::isARBExplicitAttribLocationUsable() const
|
||||
{
|
||||
return hasExplicitAttribLocation;
|
||||
return hasExplicitAttribLocation ||
|
||||
(m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 3));
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isEXTTextureCompressionS3TCUsable() const
|
||||
@ -372,16 +332,6 @@ bool CentralVideoSettings::isEXTTextureCompressionS3TCUsable() const
|
||||
return hasTextureCompression;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isARBBaseInstanceUsable() const
|
||||
{
|
||||
return hasBaseInstance;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isARBDrawIndirectUsable() const
|
||||
{
|
||||
return hasDrawIndirect;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsGLLayerInVertexShader() const
|
||||
{
|
||||
return !m_vs_layer_extension.empty();
|
||||
@ -415,7 +365,6 @@ bool CentralVideoSettings::isARBTextureViewUsable() const
|
||||
bool CentralVideoSettings::isARBBindlessTextureUsable() const
|
||||
{
|
||||
return false;
|
||||
//return hasBindlessTexture && hasNVGPUShader5;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isARBShaderAtomicCountersUsable() const
|
||||
@ -433,11 +382,6 @@ bool CentralVideoSettings::isARBImageLoadStoreUsable() const
|
||||
return hasImageLoadStore;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isARBMultiDrawIndirectUsable() const
|
||||
{
|
||||
return hasMultiDrawIndirect;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isEXTTextureFilterAnisotropicUsable() const
|
||||
{
|
||||
return hasTextureFilterAnisotropic;
|
||||
@ -470,21 +414,11 @@ bool CentralVideoSettings::supportsGlobalIllumination() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsIndirectInstancingRendering() const
|
||||
{
|
||||
return isARBBaseInstanceUsable() && isARBDrawIndirectUsable();
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsComputeShadersFiltering() const
|
||||
{
|
||||
return isARBBufferStorageUsable() && isARBImageLoadStoreUsable() && isARBComputeShaderUsable() && isARBArraysOfArraysUsable();
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsAsyncInstanceUpload() const
|
||||
{
|
||||
return isARBBufferStorageUsable() && isARBImageLoadStoreUsable();
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsTextureCompression() const
|
||||
{
|
||||
return isEXTTextureCompressionS3TCUsable();
|
||||
@ -511,12 +445,6 @@ bool CentralVideoSettings::isSDSMEnabled() const
|
||||
return isShadowEnabled() && isARBShaderAtomicCountersUsable() && isARBShaderStorageBufferObjectUsable() && isARBComputeShaderUsable() && isARBImageLoadStoreUsable() && UserConfigParams::m_sdsm;
|
||||
}
|
||||
|
||||
// See http://fr.slideshare.net/CassEveritt/approaching-zero-driver-overhead
|
||||
bool CentralVideoSettings::isAZDOEnabled() const
|
||||
{
|
||||
return supportsIndirectInstancingRendering() && isARBBindlessTextureUsable() && isARBMultiDrawIndirectUsable() && UserConfigParams::m_azdo;
|
||||
}
|
||||
|
||||
// Switch between Exponential Shadow Map (better but slower filtering) and Percentage Closer Filtering (faster but with some stability issue)
|
||||
bool CentralVideoSettings::isESMEnabled() const
|
||||
{
|
||||
@ -555,14 +483,20 @@ bool CentralVideoSettings::isARBVertexType2101010RevUsable() const
|
||||
(m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 3));
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::isNVGPUShader5Usable() const
|
||||
bool CentralVideoSettings::isARBInstancedArraysUsable() const
|
||||
{
|
||||
return hasNVGPUShader5;
|
||||
return hasInstancedArrays ||
|
||||
(m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 2));
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::supportsThreadedTextureLoading() const
|
||||
bool CentralVideoSettings::supportsSP() const
|
||||
{
|
||||
return false;
|
||||
#ifdef USE_GLES2
|
||||
return true;
|
||||
#else
|
||||
return isARBInstancedArraysUsable() && isARBVertexType2101010RevUsable() &&
|
||||
isARBSamplerObjectsUsable() && isARBExplicitAttribLocationUsable();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CentralVideoSettings::useArrayTextures() const
|
||||
|
@ -28,8 +28,6 @@ private:
|
||||
|
||||
int m_gl_major_version, m_gl_minor_version;
|
||||
std::string m_vs_layer_extension;
|
||||
bool hasBaseInstance;
|
||||
bool hasDrawIndirect;
|
||||
bool hasBufferStorage;
|
||||
bool hasComputeShaders;
|
||||
bool hasArraysOfArrays;
|
||||
@ -43,14 +41,13 @@ private:
|
||||
bool hasAtomics;
|
||||
bool hasSSBO;
|
||||
bool hasImageLoadStore;
|
||||
bool hasMultiDrawIndirect;
|
||||
bool hasTextureFilterAnisotropic;
|
||||
bool hasTextureSwizzle;
|
||||
bool hasPixelBufferObject;
|
||||
bool hasSRGBFramebuffer;
|
||||
bool hasSamplerObjects;
|
||||
bool hasVertexType2101010Rev;
|
||||
bool hasNVGPUShader5;
|
||||
bool hasInstancedArrays;
|
||||
|
||||
#if defined(USE_GLES2)
|
||||
bool hasBGRA;
|
||||
@ -58,8 +55,6 @@ private:
|
||||
#endif
|
||||
|
||||
bool m_need_rh_workaround;
|
||||
bool m_need_srgb_workaround;
|
||||
bool m_need_srgb_visual_workaround;
|
||||
bool m_need_vertex_id_workaround;
|
||||
bool m_GI_has_artifact;
|
||||
public:
|
||||
@ -69,8 +64,6 @@ public:
|
||||
|
||||
// Needs special handle ?
|
||||
bool needRHWorkaround() const;
|
||||
bool needsRGBBindlessWorkaround() const;
|
||||
bool needsSRGBCapableVisualWorkaround() const;
|
||||
bool needsVertexIdWorkaround() const;
|
||||
|
||||
// Extension is available and safe to use
|
||||
@ -83,12 +76,9 @@ public:
|
||||
bool isARBArraysOfArraysUsable() const;
|
||||
bool isARBBindlessTextureUsable() const;
|
||||
bool isARBBufferStorageUsable() const;
|
||||
bool isARBBaseInstanceUsable() const;
|
||||
bool isARBDrawIndirectUsable() const;
|
||||
bool isARBShaderAtomicCountersUsable() const;
|
||||
bool isARBShaderStorageBufferObjectUsable() const;
|
||||
bool isARBImageLoadStoreUsable() const;
|
||||
bool isARBMultiDrawIndirectUsable() const;
|
||||
bool isARBExplicitAttribLocationUsable() const;
|
||||
bool isEXTTextureFilterAnisotropicUsable() const;
|
||||
bool isARBTextureSwizzleUsable() const;
|
||||
@ -97,7 +87,7 @@ public:
|
||||
bool isARBSamplerObjectsUsable() const;
|
||||
bool isARBVertexType2101010RevUsable() const;
|
||||
bool useArrayTextures() const;
|
||||
bool isNVGPUShader5Usable() const;
|
||||
bool isARBInstancedArraysUsable() const;
|
||||
|
||||
const std::string& getVSLayerExtension() const { return m_vs_layer_extension; }
|
||||
|
||||
@ -110,12 +100,10 @@ public:
|
||||
// Are all required extensions available for feature support
|
||||
bool supportsShadows() const;
|
||||
bool supportsGlobalIllumination() const;
|
||||
bool supportsIndirectInstancingRendering() const;
|
||||
bool supportsComputeShadersFiltering() const;
|
||||
bool supportsAsyncInstanceUpload() const;
|
||||
bool supportsHardwareSkinning() const;
|
||||
bool supportsThreadedTextureLoading() const;
|
||||
bool supportsTextureCompression() const;
|
||||
bool supportsSP() const;
|
||||
|
||||
bool supportsGLLayerInVertexShader() const;
|
||||
|
||||
@ -124,7 +112,6 @@ public:
|
||||
bool isGlobalIlluminationEnabled() const;
|
||||
bool isTextureCompressionEnabled() const;
|
||||
bool isSDSMEnabled() const;
|
||||
bool isAZDOEnabled() const;
|
||||
bool isESMEnabled() const;
|
||||
bool isDefferedEnabled() const;
|
||||
};
|
||||
|
@ -479,13 +479,15 @@ void IrrDriver::initDevice()
|
||||
// support only GLSL 1.3 and it causes STK to crash. We should force to use
|
||||
// fixed pipeline in this case.
|
||||
if (!ProfileWorld::isNoGraphics() &&
|
||||
GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FORCE_LEGACY_DEVICE))
|
||||
(GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FORCE_LEGACY_DEVICE) ||
|
||||
!CVS->supportsSP()))
|
||||
{
|
||||
Log::warn("irr_driver", "Driver doesn't support shader-based pipeline. "
|
||||
"Re-creating device to workaround the issue.");
|
||||
|
||||
params.ForceLegacyDevice = true;
|
||||
recreate_device = true;
|
||||
UserConfigParams::m_force_legacy_device = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef SERVER_ONLY
|
||||
|
||||
#include "graphics/shader.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/spherical_harmonics.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef HEADER_SHADER_HPP
|
||||
#define HEADER_SHADER_HPP
|
||||
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/gl_headers.hpp"
|
||||
#include "graphics/shader_files_manager.hpp"
|
||||
#include "graphics/shared_gpu_objects.hpp"
|
||||
@ -171,8 +170,6 @@ public:
|
||||
/** Sets the uniforms for this shader. */
|
||||
void setUniforms(const Args & ... args) const
|
||||
{
|
||||
if (!CVS->isARBUniformBufferObjectUsable())
|
||||
bypassUBO();
|
||||
setUniformsImpl(args...);
|
||||
} // setUniforms
|
||||
// ------------------------------------------------------------------------
|
||||
@ -349,8 +346,6 @@ public:
|
||||
{
|
||||
m_program = glCreateProgram();
|
||||
loadAndAttachShader(args...);
|
||||
if (!CVS->isARBExplicitAttribLocationUsable())
|
||||
setAttribute(type);
|
||||
glLinkProgram(m_program);
|
||||
|
||||
GLint Result = GL_FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user