Use graphic restrictions system for all CVS query

This commit is contained in:
Vincent Lejeune 2015-01-06 23:46:36 +01:00
parent 596366c3e0
commit 02cf7afcf3
4 changed files with 65 additions and 49 deletions

View File

@ -1,9 +1,13 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<graphical-restrictions> <graphical-restrictions>
<card is="Intel(R) HD Graphics 3000" os="windows" version="<9.17.11" disable="a b c"/> <card is="Intel(R) HD Graphics 3000" os="windows" disable="UniformBufferObject"/>
<card contains="Intel" disable="TextureCompressionS3TC"/>
<card contains="NVIDIA" os="windows" version="<344.65" disable="BufferStorage"/> <card contains="NVIDIA" os="windows" version="<344.65" disable="BufferStorage"/>
<card contains="NVIDIA" os="linux" version="<343.22" disable="BufferStorage"/> <card contains="NVIDIA" os="linux" version="<343.22" disable="BufferStorage"/>
<card contains="NVIDIA" disable="ShaderAtomicCounters"/>
<card contains="Mesa" os="linux" version="<10.3" disable="BufferStorage"/> <card contains="Mesa" os="linux" version="<10.3" disable="BufferStorage"/>
<card contains="Mesa" os="linux" version="<10.6" disable="GeometryShader4"/>
<card is="Intel(R) HD Graphics 3000" os="osx" version="<=9.17.10" disable="a b c"/> <card is="Intel(R) HD Graphics 3000" os="osx" version="<=9.17.10" disable="a b c"/>
<card is="" os="bsd" version="<1.2.3" disable="a b c"/> <card is="" os="bsd" version="<1.2.3" disable="a b c"/>

View File

@ -67,85 +67,78 @@ void CentralVideoSettings::init()
hasBuffserStorage = true; hasBuffserStorage = true;
Log::info("GLDriver", "ARB Buffer Storage Present"); Log::info("GLDriver", "ARB Buffer Storage Present");
} }
if (hasGLExtension("GL_ARB_base_instance")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BASE_INSTANCE) &&
hasGLExtension("GL_ARB_base_instance")) {
hasBaseInstance = true; hasBaseInstance = true;
Log::info("GLDriver", "ARB Base Instance Present"); Log::info("GLDriver", "ARB Base Instance Present");
} }
if (hasGLExtension("GL_ARB_draw_indirect")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_DRAW_INDIRECT) &&
hasGLExtension("GL_ARB_draw_indirect")) {
hasDrawIndirect = true; hasDrawIndirect = true;
Log::info("GLDriver", "ARB Draw Indirect Present"); Log::info("GLDriver", "ARB Draw Indirect Present");
} }
if (hasGLExtension("GL_ARB_compute_shader")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_COMPUTE_SHADER) &&
hasGLExtension("GL_ARB_compute_shader")) {
hasComputeShaders = true; hasComputeShaders = true;
Log::info("GLDriver", "ARB Compute Shader Present"); Log::info("GLDriver", "ARB Compute Shader Present");
} }
if (hasGLExtension("GL_ARB_texture_storage")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_TEXTURE_STORAGE) &&
hasGLExtension("GL_ARB_texture_storage")) {
hasTextureStorage = true; hasTextureStorage = true;
Log::info("GLDriver", "ARB Texture Storage Present"); Log::info("GLDriver", "ARB Texture Storage Present");
} }
if (hasGLExtension("GL_ARB_texture_view")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_TEXTURE_VIEW) &&
hasGLExtension("GL_ARB_texture_view")) {
hasTextureView = true; hasTextureView = true;
Log::info("GLDriver", "ARB Texture View Present"); Log::info("GLDriver", "ARB Texture View Present");
} }
if (hasGLExtension("GL_ARB_bindless_texture")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_BINDLESS_TEXTURE) &&
hasGLExtension("GL_ARB_bindless_texture")) {
hasBindlessTexture = true; hasBindlessTexture = true;
Log::info("GLDriver", "ARB Bindless Texture Present"); Log::info("GLDriver", "ARB Bindless Texture Present");
} }
if (hasGLExtension("GL_ARB_shader_image_load_store")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_IMAGE_LOAD_STORE) &&
hasGLExtension("GL_ARB_shader_image_load_store")) {
hasImageLoadStore = true; hasImageLoadStore = true;
Log::info("GLDriver", "ARB Image Load Store Present"); Log::info("GLDriver", "ARB Image Load Store Present");
} }
if (hasGLExtension("GL_ARB_shader_atomic_counters")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_SHADER_ATOMIC_COUNTERS) &&
hasGLExtension("GL_ARB_shader_atomic_counters")) {
hasAtomics = true; hasAtomics = true;
Log::info("GLDriver", "ARB Shader Atomic Counters Present"); Log::info("GLDriver", "ARB Shader Atomic Counters Present");
} }
if (hasGLExtension("GL_ARB_shader_storage_buffer_object")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_SHADER_STORAGE_BUFFER_OBJECT) &&
hasGLExtension("GL_ARB_shader_storage_buffer_object")) {
hasSSBO = true; hasSSBO = true;
Log::info("GLDriver", "ARB Shader Storage Buffer Object Present"); Log::info("GLDriver", "ARB Shader Storage Buffer Object Present");
} }
if (hasGLExtension("GL_ARB_multi_draw_indirect")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_MULTI_DRAW_INDIRECT) &&
hasGLExtension("GL_ARB_multi_draw_indirect")) {
hasMultiDrawIndirect = true; hasMultiDrawIndirect = true;
Log::info("GLDriver", "ARB Multi Draw Indirect Present"); Log::info("GLDriver", "ARB Multi Draw Indirect Present");
} }
if (hasGLExtension("GL_EXT_texture_compression_s3tc")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_EXT_TEXTURE_COMPRESSION_S3TC) &&
hasGLExtension("GL_EXT_texture_compression_s3tc")) {
hasTextureCompression = true; hasTextureCompression = true;
Log::info("GLDriver", "EXT Texture Compression S3TC Present"); Log::info("GLDriver", "EXT Texture Compression S3TC Present");
} }
if (hasGLExtension("GL_ARB_uniform_buffer_object")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_UNIFORM_BUFFER_OBJECT) &&
hasGLExtension("GL_ARB_uniform_buffer_object")) {
hasUBO = true; hasUBO = true;
Log::info("GLDriver", "ARB Uniform Buffer Object Present"); Log::info("GLDriver", "ARB Uniform Buffer Object Present");
} }
if (hasGLExtension("GL_ARB_geometry_shader4")) { if (!GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_GEOMETRY_SHADER4) &&
hasGLExtension("GL_ARB_geometry_shader4")) {
hasGS = true; hasGS = true;
Log::info("GLDriver", "ARB Geometry Shader 4 Present"); Log::info("GLDriver", "ARB Geometry Shader 4 Present");
} }
// Specific disablement // Specific disablement
// (should use graphic restriction system)
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL)
{
// Intel doesnt support sRGB compressed textures on some chip/OS
// TODO: Have a more precise list
// Sandy Bridge on Windows
hasTextureCompression = false;
#ifdef WIN32
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
// Works with Haswell and latest drivers
// Status unknown on Ivy Bridge
// Status unknown on older driver for Haswell
if (m_gl_major_version == 3 && m_gl_minor_version == 1)
hasUBO = false;
#endif
}
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL) if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)
{ {
// Fix for Nvidia and instanced RH // Fix for Nvidia and instanced RH
// Compiler crashes with a big loop in RH or GI shaders // Compiler crashes with a big loop in RH or GI shaders
m_need_rh_workaround = true; m_need_rh_workaround = true;
// Atomic counters make the driver crash on windows and linux
hasAtomics = false;
} }
if (strstr((const char *)glGetString(GL_VENDOR), "ATI") != NULL) if (strstr((const char *)glGetString(GL_VENDOR), "ATI") != NULL)
@ -153,15 +146,6 @@ void CentralVideoSettings::init()
// Bindless textures are all treated RGB even sRGB one // Bindless textures are all treated RGB even sRGB one
m_need_srgb_workaround = true; m_need_srgb_workaround = true;
} }
// Mesa
if (strstr((const char *)glGetString(GL_VENDOR), "Intel Open Source Technology Center") != NULL ||
strstr((const char *)glGetString(GL_VENDOR), "Gallium") != NULL)
{
// Needs a patched Mesa (current 10.4) to use array texture fbo
// Technically GS works but array texture fbo interacts with GS.
hasGS = false;
}
} }
#endif #endif
} }

View File

@ -38,9 +38,24 @@ namespace GraphicsRestrictions
/** The list of names used in the XML file for the graphics /** The list of names used in the XML file for the graphics
* restriction types. They must be in the same order as the types. */ * restriction types. They must be in the same order as the types. */
char *m_names_of_restrictions[] = { "BufferStorage",
"GlobalIllumination", char *m_names_of_restrictions[] = {
NULL}; "UniformBufferObject",
"GeometryShader4"
"DrawIndirect",
"TextureView",
"TextureStorage",
"ImageLoadStore",
"BaseInstance",
"ComputeShader",
"ShaderStorageBufferObject",
"MultiDrawIndirect",
"ShaderAtomicCounters",
"BufferStorage",
"BindlessTexture",
"TextureCompressionS3TC",
"AMDVertexShaderLayer"
};
} // namespace Private } // namespace Private
using namespace Private; using namespace Private;

View File

@ -34,8 +34,21 @@ namespace GraphicsRestrictions
* type declaration needs a change in that variable as well. */ * type declaration needs a change in that variable as well. */
enum GraphicsRestrictionsType enum GraphicsRestrictionsType
{ {
GR_UNIFORM_BUFFER_OBJECT,
GR_GEOMETRY_SHADER4,
GR_DRAW_INDIRECT,
GR_TEXTURE_VIEW,
GR_TEXTURE_STORAGE,
GR_IMAGE_LOAD_STORE,
GR_BASE_INSTANCE,
GR_COMPUTE_SHADER,
GR_SHADER_STORAGE_BUFFER_OBJECT,
GR_MULTI_DRAW_INDIRECT,
GR_SHADER_ATOMIC_COUNTERS,
GR_BUFFER_STORAGE, GR_BUFFER_STORAGE,
GR_GLOBAL_ILLUMINATION, GR_BINDLESS_TEXTURE,
GR_EXT_TEXTURE_COMPRESSION_S3TC,
GR_AMD_VERTEX_SHADER_LAYER,
GR_COUNT /** MUST be last entry. */ GR_COUNT /** MUST be last entry. */
} ; } ;