mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 06:05:45 +00:00
add vrapi_submitframe hook back and disable vr markers if it's used
This commit is contained in:
committed by
Baldur Karlsson
parent
6768cd96ee
commit
dc920abf39
@@ -513,6 +513,8 @@ WrappedOpenGL::WrappedOpenGL(const GLHookSet &funcs, GLPlatform &platform)
|
||||
|
||||
m_AppControlledCapture = false;
|
||||
|
||||
m_UseVRMarkers = true;
|
||||
|
||||
m_RealDebugFunc = NULL;
|
||||
m_RealDebugFuncParam = NULL;
|
||||
m_SuppressDebugMessages = false;
|
||||
|
||||
@@ -117,6 +117,8 @@ private:
|
||||
|
||||
bool m_MarkedActive = false;
|
||||
|
||||
bool m_UseVRMarkers;
|
||||
|
||||
GLReplay m_Replay;
|
||||
RDCDriver m_DriverType;
|
||||
|
||||
@@ -616,6 +618,7 @@ public:
|
||||
void CreateVRAPITextureSwapChain(GLuint tex, GLenum textureType, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint levels);
|
||||
void HandleVRFrameMarkers(const GLchar *buf, GLsizei length);
|
||||
void DisableVRFrameMarkers();
|
||||
|
||||
void FirstFrame(void *ctx, void *wndHandle);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "official/VrApi_Types.h"
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------------
|
||||
typedef void (*PFN_vrapi_SubmitFrame)(ovrMobile *, const ovrFrameParms *);
|
||||
typedef int (*PFN_vrapi_GetTextureSwapChainLength)(ovrTextureSwapChain *);
|
||||
typedef unsigned int (*PFN_vrapi_GetTextureSwapChainHandle)(ovrTextureSwapChain *, int);
|
||||
typedef int (*PFN_vrapi_GetSystemPropertyInt)(const ovrJava *, const ovrSystemProperty);
|
||||
@@ -47,7 +48,8 @@ class VRAPIHook : LibraryHook
|
||||
{
|
||||
public:
|
||||
VRAPIHook()
|
||||
: vrapi_GetTextureSwapChainLength_real(NULL),
|
||||
: vrapi_SubmitFrame_real(NULL),
|
||||
vrapi_GetTextureSwapChainLength_real(NULL),
|
||||
vrapi_GetTextureSwapChainHandle_real(NULL),
|
||||
vrapi_GetSystemPropertyInt_real(NULL),
|
||||
m_PopulatedHooks(false),
|
||||
@@ -55,7 +57,7 @@ public:
|
||||
{
|
||||
LibraryHooks::GetInstance().RegisterHook("libvrapi.so", this);
|
||||
|
||||
m_EnabledHooks = false;
|
||||
m_EnabledHooks = true;
|
||||
}
|
||||
~VRAPIHook() {}
|
||||
static void libHooked(void *realLib);
|
||||
@@ -73,6 +75,7 @@ public:
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
PFN_vrapi_CreateTextureSwapChain2 vrapi_CreateTextureSwapChain2_real;
|
||||
PFN_vrapi_CreateTextureSwapChain vrapi_CreateTextureSwapChain_real;
|
||||
PFN_vrapi_SubmitFrame vrapi_SubmitFrame_real;
|
||||
|
||||
PFN_vrapi_GetTextureSwapChainLength vrapi_GetTextureSwapChainLength_real;
|
||||
PFN_vrapi_GetTextureSwapChainHandle vrapi_GetTextureSwapChainHandle_real;
|
||||
@@ -90,6 +93,9 @@ public:
|
||||
if(vrapi_CreateTextureSwapChain_real == NULL)
|
||||
vrapi_CreateTextureSwapChain_real = (PFN_vrapi_CreateTextureSwapChain)PosixGetFunction(
|
||||
libvrapi_symHandle, "vrapi_CreateTextureSwapChain");
|
||||
if(vrapi_SubmitFrame_real == NULL)
|
||||
vrapi_SubmitFrame_real =
|
||||
(PFN_vrapi_SubmitFrame)PosixGetFunction(libvrapi_symHandle, "vrapi_SubmitFrame");
|
||||
|
||||
if(vrapi_GetTextureSwapChainLength_real == NULL)
|
||||
vrapi_GetTextureSwapChainLength_real = (PFN_vrapi_GetTextureSwapChainLength)PosixGetFunction(
|
||||
@@ -101,7 +107,7 @@ public:
|
||||
vrapi_GetSystemPropertyInt_real = (PFN_vrapi_GetSystemPropertyInt)PosixGetFunction(
|
||||
libvrapi_symHandle, "vrapi_GetSystemPropertyInt");
|
||||
|
||||
return vrapi_CreateTextureSwapChain2_real != NULL;
|
||||
return vrapi_SubmitFrame_real != NULL;
|
||||
}
|
||||
|
||||
} vrapi_hooks;
|
||||
@@ -226,6 +232,23 @@ __attribute__((visibility("default"))) ovrTextureSwapChain *vrapi_CreateTextureS
|
||||
return texture_swapchain;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void vrapi_SubmitFrame(ovrMobile *ovr,
|
||||
const ovrFrameParms *parms)
|
||||
{
|
||||
if(vrapi_hooks.vrapi_SubmitFrame_real == NULL || vrapi_hooks.vrapi_GetSystemPropertyInt_real == NULL)
|
||||
{
|
||||
vrapi_hooks.SetupHooks();
|
||||
}
|
||||
|
||||
if(m_GLDriver)
|
||||
{
|
||||
SCOPED_LOCK(glLock);
|
||||
m_GLDriver->DisableVRFrameMarkers();
|
||||
m_GLDriver->SwapBuffers(ovr);
|
||||
}
|
||||
|
||||
vrapi_hooks.vrapi_SubmitFrame_real(ovr, parms);
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
void VRAPIHook::libHooked(void *realLib)
|
||||
@@ -243,6 +266,7 @@ bool VRAPIHook::CreateHooks(const char *libName)
|
||||
{
|
||||
PosixHookFunction("vrapi_CreateTextureSwapChain2", (void *)&vrapi_CreateTextureSwapChain2);
|
||||
PosixHookFunction("vrapi_CreateTextureSwapChain", (void *)&vrapi_CreateTextureSwapChain);
|
||||
PosixHookFunction("vrapi_SubmitFrame", (void *)&vrapi_SubmitFrame);
|
||||
|
||||
PosixHookLibrary(libName, &libHooked);
|
||||
return true;
|
||||
|
||||
@@ -191,9 +191,14 @@ bool WrappedOpenGL::Serialise_glDebugMessageInsert(SerialiserType &ser, GLenum s
|
||||
return true;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::DisableVRFrameMarkers()
|
||||
{
|
||||
m_UseVRMarkers = false;
|
||||
}
|
||||
|
||||
void WrappedOpenGL::HandleVRFrameMarkers(const GLchar *buf, GLsizei length)
|
||||
{
|
||||
if(strstr(buf, "vr-marker,frame_end,type,application") != NULL)
|
||||
if(m_UseVRMarkers && strstr(buf, "vr-marker,frame_end,type,application") != NULL)
|
||||
{
|
||||
void *ctx = NULL, *wnd = NULL;
|
||||
RenderDoc::Inst().GetActiveWindow(ctx, wnd);
|
||||
|
||||
Reference in New Issue
Block a user