From 70c0c0fea12b658fd97dc4fb28acec705b1d53e4 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sat, 3 Jan 2015 13:40:20 -0800 Subject: [PATCH] Adding --vendor_gl_extensions flag to disable NV stuff. --- src/xenia/gpu/gl4/circular_buffer.cc | 5 +++-- src/xenia/gpu/gl4/command_processor.cc | 8 ++++++-- src/xenia/gpu/gl4/gl4_gpu-private.h | 2 ++ src/xenia/gpu/gl4/gl4_gpu.cc | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/xenia/gpu/gl4/circular_buffer.cc b/src/xenia/gpu/gl4/circular_buffer.cc index 537cd5604..e33677406 100644 --- a/src/xenia/gpu/gl4/circular_buffer.cc +++ b/src/xenia/gpu/gl4/circular_buffer.cc @@ -11,6 +11,7 @@ #include #include +#include #include namespace xe { @@ -44,7 +45,7 @@ bool CircularBuffer::Initialize() { return false; } - if (GLEW_NV_shader_buffer_load) { + if (FLAGS_vendor_gl_extensions && GLEW_NV_shader_buffer_load) { // To use this bindlessly we must make it resident. glMakeNamedBufferResidentNV(buffer_, GL_WRITE_ONLY); glGetNamedBufferParameterui64vNV(buffer_, GL_BUFFER_GPU_ADDRESS_NV, @@ -58,7 +59,7 @@ void CircularBuffer::Shutdown() { return; } glUnmapNamedBuffer(buffer_); - if (GLEW_NV_shader_buffer_load) { + if (FLAGS_vendor_gl_extensions && GLEW_NV_shader_buffer_load) { glMakeNamedBufferNonResidentNV(buffer_); } glDeleteBuffers(1, &buffer_); diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index 3b8730dab..61d3f283f 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -181,11 +181,16 @@ bool CommandProcessor::SetupGL() { glGenVertexArrays(1, &vertex_array_); glBindVertexArray(vertex_array_); - if (GLEW_NV_vertex_buffer_unified_memory) { + if (FLAGS_vendor_gl_extensions && GLEW_NV_vertex_buffer_unified_memory) { has_bindless_vbos_ = true; glEnableClientState(GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV); glEnableClientState(GL_ELEMENT_ARRAY_UNIFIED_NV); } + GLint max_vertex_attribs = 0; + glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &max_vertex_attribs); + for (GLint i = 0; i < max_vertex_attribs; ++i) { + glEnableVertexAttribArray(i); + } const std::string geometry_header = "#version 450\n" @@ -2242,7 +2247,6 @@ CommandProcessor::UpdateStatus CommandProcessor::PopulateVertexBuffers( assert_unhandled_case(el.format); break; } - glEnableVertexAttribArray(el_index); if (has_bindless_vbos_) { glVertexAttribFormatNV(el_index, comp_count, comp_type, el.is_normalized, diff --git a/src/xenia/gpu/gl4/gl4_gpu-private.h b/src/xenia/gpu/gl4/gl4_gpu-private.h index 065e0e327..73937bee4 100644 --- a/src/xenia/gpu/gl4/gl4_gpu-private.h +++ b/src/xenia/gpu/gl4/gl4_gpu-private.h @@ -20,6 +20,8 @@ DECLARE_bool(thread_safe_gl); DECLARE_bool(gl_debug_output); DECLARE_bool(gl_debug_output_synchronous); +DECLARE_bool(vendor_gl_extensions); + DECLARE_bool(disable_textures); namespace xe { diff --git a/src/xenia/gpu/gl4/gl4_gpu.cc b/src/xenia/gpu/gl4/gl4_gpu.cc index d9f248d0f..3f9ef960d 100644 --- a/src/xenia/gpu/gl4/gl4_gpu.cc +++ b/src/xenia/gpu/gl4/gl4_gpu.cc @@ -19,6 +19,9 @@ DEFINE_bool(gl_debug_output, false, "Dump ARB_debug_output to stderr."); DEFINE_bool(gl_debug_output_synchronous, true, "ARB_debug_output will synchronize to be thread safe."); +DEFINE_bool(vendor_gl_extensions, true, + "Enable vendor-specific (NV, AMD, etc) GL extensions."); + DEFINE_bool(disable_textures, false, "Disable textures and use colors only."); namespace xe {