mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-16 00:20:04 +00:00
renderer_opengl: Detect Nvidia Nsight as a debugging tool
Use getenv to detect Nsight.
This commit is contained in:
parent
b16c8e0e8d
commit
311d2fc768
@ -157,7 +157,6 @@ Device::Device() : base_bindings{BuildBaseBindings()} {
|
|||||||
has_precise_bug = TestPreciseBug();
|
has_precise_bug = TestPreciseBug();
|
||||||
has_broken_compute = is_intel_proprietary;
|
has_broken_compute = is_intel_proprietary;
|
||||||
has_fast_buffer_sub_data = is_nvidia;
|
has_fast_buffer_sub_data = is_nvidia;
|
||||||
has_debug_tool = HasExtension(extensions, "GL_EXT_debug_tool");
|
|
||||||
|
|
||||||
LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi);
|
LOG_INFO(Render_OpenGL, "Renderer_VariableAOFFI: {}", has_variable_aoffi);
|
||||||
LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug);
|
LOG_INFO(Render_OpenGL, "Renderer_ComponentIndexingBug: {}", has_component_indexing_bug);
|
||||||
|
@ -84,10 +84,6 @@ public:
|
|||||||
return has_fast_buffer_sub_data;
|
return has_fast_buffer_sub_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasDebugTool() const {
|
|
||||||
return has_debug_tool;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool TestVariableAoffi();
|
static bool TestVariableAoffi();
|
||||||
static bool TestPreciseBug();
|
static bool TestPreciseBug();
|
||||||
@ -106,7 +102,6 @@ private:
|
|||||||
bool has_precise_bug{};
|
bool has_precise_bug{};
|
||||||
bool has_broken_compute{};
|
bool has_broken_compute{};
|
||||||
bool has_fast_buffer_sub_data{};
|
bool has_fast_buffer_sub_data{};
|
||||||
bool has_debug_tool{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace OpenGL
|
} // namespace OpenGL
|
||||||
|
@ -5,8 +5,11 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
@ -25,6 +28,24 @@
|
|||||||
|
|
||||||
namespace OpenGL {
|
namespace OpenGL {
|
||||||
|
|
||||||
|
/// Returns true if any debug tool is attached
|
||||||
|
bool HasDebugTool() {
|
||||||
|
const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED");
|
||||||
|
if (nsight) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLint num_extensions;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
|
||||||
|
for (GLuint index = 0; index < static_cast<GLuint>(num_extensions); ++index) {
|
||||||
|
const auto name = reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, index));
|
||||||
|
if (!std::strcmp(name, "GL_EXT_debug_tool")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If the size of this is too small, it ends up creating a soft cap on FPS as the renderer will have
|
// If the size of this is too small, it ends up creating a soft cap on FPS as the renderer will have
|
||||||
// to wait on available presentation frames.
|
// to wait on available presentation frames.
|
||||||
constexpr std::size_t SWAP_CHAIN_SIZE = 3;
|
constexpr std::size_t SWAP_CHAIN_SIZE = 3;
|
||||||
@ -56,7 +77,7 @@ public:
|
|||||||
std::deque<Frame*> present_queue;
|
std::deque<Frame*> present_queue;
|
||||||
Frame* previous_frame{};
|
Frame* previous_frame{};
|
||||||
|
|
||||||
FrameMailbox() : has_debug_tool{Device().HasDebugTool()} {
|
FrameMailbox() : has_debug_tool{HasDebugTool()} {
|
||||||
for (auto& frame : swap_chain) {
|
for (auto& frame : swap_chain) {
|
||||||
free_queue.push(&frame);
|
free_queue.push(&frame);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user