mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 04:50:35 +00:00
Emulate EXT_dsa functions in-place and catch promoted-to-DSA functions
* Originally when I added the EXT_dsa emuluation, I targeted it specifically to only those functions that I call outside of the replay loop, for internal analysis purposes. For that reason the emulation was only applied to a separate hookset, and only during replay (not during capture). * However this doesn't account for some of the streamlined serialisation of functions like glBufferStorage, glBufferData, etc. To simplify code paths, I 'promote' all variants of these types of functions to the EXT_dsa variant (except ARB_dsa for texture functions which is actually different by not requiring the texture target parameter). * Note: most of these functions were emulated already (except three - glNamedBufferStorageEXT, glTextureBufferEXT and glTextureBufferRangeEXT) but on replay we didn't use the internal hookset, just the normal one, which was not emulated. * Rather than try to decide when these should use the internal hookset and when the regular one, or switch them all over to the internal hookset, instead re-evaluate the reason for a separate hookset in the first place: Emulating functions separately means the original func pointers are returned during capture time, for unsupported extensions. * However mesa has proven that unsupported extensions don't have to return NULL, as it's undefined what they return - they should not be called if the extension isn't available. So in actual fact there's little harm to be done by emulating in-place and returning some different pointers to the application. In the worst case, they get a bit of EXT_dsa emulation themselves.
This commit is contained in:
@@ -407,7 +407,7 @@ bool ValidateFunctionPointers(const GLHookSet &real);
|
||||
namespace glEmulate
|
||||
{
|
||||
void EmulateUnsupportedFunctions(GLHookSet *hooks);
|
||||
void EmulateRequiredExtensions(const GLHookSet *real, GLHookSet *hooks);
|
||||
void EmulateRequiredExtensions(GLHookSet *hooks);
|
||||
};
|
||||
|
||||
#include "core/core.h"
|
||||
|
||||
@@ -1531,13 +1531,6 @@ void WrappedOpenGL::ActivateContext(GLWindowingData winData)
|
||||
glBindBuffer(eGL_ARRAY_BUFFER, prevArrayBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
m_Internal = m_Real;
|
||||
|
||||
glEmulate::EmulateRequiredExtensions(&m_Real, &m_Internal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,12 +112,6 @@ private:
|
||||
const GLHookSet &m_Real;
|
||||
GLPlatform &m_Platform;
|
||||
|
||||
// Used to clarify when we're making an internal call that isn't just part of
|
||||
// forwarding the capture, and allows us to emulate extensions like EXT_direct_state_access
|
||||
// without interfering with the real functions for GL.
|
||||
// Only populated during capture, on replay we force-patch the real hookset
|
||||
GLHookSet m_Internal;
|
||||
|
||||
friend class GLReplay;
|
||||
friend class GLResourceManager;
|
||||
|
||||
@@ -536,7 +530,6 @@ public:
|
||||
|
||||
void SetFetchCounters(bool in) { m_FetchCounters = in; };
|
||||
const GLHookSet &GetHookset() { return m_Real; }
|
||||
const GLHookSet &GetInternalHookset() { return m_Internal; }
|
||||
void SetDebugMsgContext(const char *context) { m_DebugMsgContext = context; }
|
||||
void AddDebugMessage(DebugMessage msg)
|
||||
{
|
||||
|
||||
@@ -716,8 +716,7 @@ bool SharedPopulateHooks(void *(*lookupFunc)(const char *))
|
||||
// see gl_emulated.cpp
|
||||
glEmulate::EmulateUnsupportedFunctions(&GL);
|
||||
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
glEmulate::EmulateRequiredExtensions(&GL, &GL);
|
||||
glEmulate::EmulateRequiredExtensions(&GL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1070,8 +1070,7 @@ private:
|
||||
// see gl_emulated.cpp
|
||||
glEmulate::EmulateUnsupportedFunctions(&GL);
|
||||
|
||||
if(RenderDoc::Inst().IsReplayApp())
|
||||
glEmulate::EmulateRequiredExtensions(&GL, &GL);
|
||||
glEmulate::EmulateRequiredExtensions(&GL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ void Serialiser::Serialise(const char *name, TextureStateInitialData &el)
|
||||
|
||||
void GLResourceManager::MarkVAOReferenced(GLResource res, FrameRefType ref, bool allowFake0)
|
||||
{
|
||||
const GLHookSet &gl = m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
if(res.name || allowFake0)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ void GLResourceManager::MarkFBOReferenced(GLResource res, FrameRefType ref)
|
||||
|
||||
MarkResourceFrameReferenced(res, ref == eFrameRef_Unknown ? eFrameRef_Unknown : eFrameRef_Read);
|
||||
|
||||
const GLHookSet &gl = m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
GLint numCols = 8;
|
||||
gl.glGetIntegerv(eGL_MAX_COLOR_ATTACHMENTS, &numCols);
|
||||
@@ -282,7 +282,7 @@ bool GLResourceManager::Need_InitialStateChunk(GLResource res)
|
||||
|
||||
bool GLResourceManager::Prepare_InitialState(GLResource res, byte *blob)
|
||||
{
|
||||
const GLHookSet &gl = m_State < WRITING ? m_GL->GetHookset() : m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
if(res.Namespace == eResFramebuffer)
|
||||
{
|
||||
@@ -435,7 +435,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
|
||||
ResourceId Id = GetID(res);
|
||||
|
||||
const GLHookSet &gl = m_State < WRITING ? m_GL->GetHookset() : m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
if(res.Namespace == eResBuffer)
|
||||
{
|
||||
@@ -565,7 +565,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
void GLResourceManager::PrepareTextureInitialContents(ResourceId liveid, ResourceId origid,
|
||||
GLResource res)
|
||||
{
|
||||
const GLHookSet &gl = m_State < WRITING ? m_GL->GetHookset() : m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
WrappedOpenGL::TextureData &details = m_GL->m_Textures[liveid];
|
||||
|
||||
@@ -959,7 +959,7 @@ bool GLResourceManager::Serialise_InitialState(ResourceId resid, GLResource res)
|
||||
res = GLResource(MakeNullResource);
|
||||
}
|
||||
|
||||
const GLHookSet &gl = m_State < WRITING ? m_GL->GetHookset() : m_GL->GetInternalHookset();
|
||||
const GLHookSet &gl = m_GL->GetHookset();
|
||||
|
||||
if(res.Namespace == eResBuffer)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user