-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Trace and replay ANGLE (EGL & GLES) on Windows #764
base: master
Are you sure you want to change the base?
Conversation
Untested but a starting point to trace Angle on Windows. apitrace#522
Roughly matching ANGLE's exports.
Now Surfaces tab will be disabled when it's meant to be.
There's no supported way to stop ANGLE logging to stdout, but we need to dump things via stdout. As it uses stdout directly and we use std::cout, it's possible to change the file descriptor to go nowhere and keep std::cout intact. Swapping out stdout for something else is relatively simple, but doing so while keeping std::cout going to the original location requires duplicating the original file descriptor and replacing the internal buffer. That requires OS-specific calls and vendor-specific STL extensions, so I've only implemented it for Windows so far. Other parts of this branch are already potentially Windows-specific anyway.
The recursion issue looks to be because of this feature of
The application I was originally working with loads ANGLE immediately as it's got the DLLs in its import table, whereas the others I tried load it manually later on. The injector injects the tracing DLL in between those events, so depending on the application, one or the other can be loaded first, and therefore returned by |
That last commit fixes the case where our DLL is loaded before the real one, but not the other failing case where it's loaded instead of the real one. |
@jrfonseca I've got a trace that won't load in the GUI properly (no calls are displayed) and It outputs
|
Zero-length reads return -1, which decreased the size, making it negative.
Hopefully this doesn't break anything else that already worked. It's also got a few other unrelated fixes for things that were causing problems during testing.
Although this doesn't work with the application I'd intended to use it with yet (due to a threading regression in ANGLE tracked as https://bugs.chromium.org/p/angleproject/issues/detail?id=6427), it should work with other applications compatible with vaguely up-to-date ANGLE versions. Hopefully that means it's useful to people and also reviewable. However, I'm seeing a problem with some other applications where the tracing functions are calling themselves instead of the originals which I've not go to the bottom of yet.
It uses the vcpkg port of ANGLE instead of the official Google version as Google offer no binaries and require DepotTools to build it, and then there's no
FindANGLE.cmake
or anything like that, so it would have been a hassle to do it any other way.