Comments (11)
from tracy.
from tracy.
You can set an appropriate dpiScale
in profiler/src/main.cpp
. Ideally this should be retrieved from the system.
from tracy.
Shouldn't glfwGetMonitorContentScale
help here cross platform? According to the docs it should:
Will give it a try and let you know.
from tracy.
Something like this - unfortunately I can't test this as I currently only have glfw 3.2 - I first to build a newer version.
diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp
index 2485ead7..73ddedc1 100644
--- a/profiler/src/main.cpp
+++ b/profiler/src/main.cpp
@@ -242,6 +242,14 @@ int main( int argc, char** argv )
gl3wInit();
glfwSetWindowRefreshCallback( window, WindowRefreshCallback );
+#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3)
+ GLFWmonitor* monitor = glfwGetWindowMonitor(window);
+ if (monitor == nullptr) {
+ monitor = glfwGetPrimaryMonitor();
+ }
+ if (monitor != nullptr) {
+ float xscale, yscale;
+ glfwGetMonitorContentScale(monitor, &xscale, &yscale);
+ dpiScale = xscale > yscale ? xscale : yscale;
+ }
+#else
#ifdef _WIN32
typedef UINT(*GDFS)(void);
GDFS getDpiForSystem = nullptr;
@@ -250,6 +258,7 @@ int main( int argc, char** argv )
getDpiForSystem = (GDFS)GetProcAddress(dll, "GetDpiForSystem");
if (getDpiForSystem)
dpiScale = getDpiForSystem() / 96.f;
+#endif
#endif
// Setup ImGui binding
from tracy.
tested the above now - works quite nice now. Not sure which version of glfw you are targeting for. But if 3.3 is the min version - one can also remove the checks and the win32 code.
from tracy.
I suppose I have to add the glfwGetPrimaryMonitor
call, because the window is not yet initialized properly at that point. I think it would be better to move the dpiScale assignment after the window init. Looks like creating the window is not enough here.
from tracy.
glfwGetWindowMonitor
doesn't do what you think it does (see docs). You'd need to enumerate available monitors (glfwGetMonitors
) to detect on which monitor the window will be displayed, taking into account the possibility that monitor configuration might have changed since last run, and the saved window coordinates could have been adjusted by the window manager (or not at all, placing the window out-of-view, who knows).
Then you have trouble with multiple monitors with different DPI settings, but this problem is already present right now (not on Windows, which scale the window-contents bitmap to match the target monitor DPI). Proper fix would be needed to be done on ImGui side, I believe @ocornut has it in the works.
from tracy.
But it should at least do the (almost) same as the win32 specific code, no? I know that it doesn't deal with the edge cases.
At least it fixes the problem for me in a way, that renders the profiler's ui readable.
from tracy.
Or maybe provide a way to override the dpi scale factor with an env var? at least as a workaround...
from tracy.
Implemented as proposed in 5abd4c8.
from tracy.
Related Issues (20)
- Memory corruption in callstack recording HOT 12
- Call stack recording for macOS/iOS
- (Documentation request) Move the build instructions to Markdown HOT 1
- 4101 Compilation Warning in Visual Studio2022
- TRACY_MANUAL_LIFETIME crash with TracyLockable HOT 6
- Mutex instrumentation leaks HOT 4
- Info icons in the top bar are hard to hover due to layout changes during recording HOT 1
- Can you change the data collection side to socket-clinet? HOT 1
- Filter sampling statistics by thread
- Weird interaction between TRACY_MANUAL_LIFETIME and TRACY_DELAYED_INIT HOT 3
- Add ways to filter out all data from call stacks that include a certain method call
- Add ability to search memory allocations for call stack method name
- Add ability to compare memory allocations of two traces
- Add option to show allocation indicator on thread view
- Thread IDs instead of names when profiling context switches on Windows HOT 2
- Tracy reliably segfaults trying to load this trace HOT 4
- Application hangs when connecting to profiler, only when GPU events have been submitted HOT 9
- guidance for integrating tracy on a non gaming application
- Ability to save profiler config/options?
- Unexpected behavior with administrator permissions and ON_DEMAND enabled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tracy.