OpenGL profiling?
Closed this issue · 7 comments
Is OpenGL profiling deprecated? I cannot find a demo that does this.
Tried to build microprofile with -DMICROPROFILE_GPU_TIMERS=1 -DMICROPROFILE_GPU_TIMERS_GL=1
on OS X. After adding the missing gl headers to microprofile.cpp
the build fails with a linker error that no _MicroProfileGpuFlip
and _MicroProfileGpuShutdown
are found.
Any help would be appreciated.
These implementations made it work for me. Not sure if more would be needed, but it seems sufficient (on Windows in my case).
uint32_t MicroProfileGpuFlip(void* pContext)
{
uint32_t nFrameTimeStamp = MicroProfileGpuInsertTimeStamp(pContext);
return nFrameTimeStamp;
}
void MicroProfileGpuShutdown()
{
glDeleteQueries(MICROPROFILE_GL_MAX_QUERIES, &S.pGPU->GLTimers[0]);
MP_FREE(S.pGPU);
S.pGPU = 0;
}
You'll also need to add this at the start of MicroProfileGpuInitGL() :
S.pGPU = MP_ALLOC_OBJECT(MicroProfileGpuTimerState);
I know you're on OSX, but for anyone on Windows reading this, there's another change I needed to make. Since MicroProfile allocated S.pGPU with _aligned_malloc on Windows, you also need to replace the simple call to free() in the MICROPROFILE_FREE macro by a wrapper, say MicroProfileFreeAligned, which would look like this:
void MicroProfileFreeAligned(void* p)
{
_aligned_free(p);
}
(and the POSIX implementation would simply call free())
With these changes (and a few warning fixes), I'm now using the latest MicroProfile on my project compiled with VC++ 2017 RTM on Windows 10.
I'll see if I can prepare a PR with these changes sometime soon.
Hi.
Some osx versions ago, apple decided to ditch support for the timestamp functionality, which is needed by the microprofiler.
I never got around to making a demo for windows, and thus testing it.
Well there's a PR all ready to merge above :-)
I was just trying to merge the pull request as suggested by some other user, but now it disappeared.
I have no clue where its gone.
I will look into this.
found the user. his profile seems to be gone. https://github.com/Skylark13
I will reimplement it
with the commit mentioned above, and the one from 1 minute ago, there is now an opengl sample program.
It still wont work on OSX unfortunately, and there is no way of fixing it.
In my case, it was to use with OpenGL on Windows, so that's fine. And I just checked, apart from the demo, your commit is equivalent to my PR. Thanks!