Skip to content
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

During tracing gl-500-texture-cube-arb.exe, missing cube map #898

Open
jirongjiao opened this issue Sep 26, 2023 · 2 comments
Open

During tracing gl-500-texture-cube-arb.exe, missing cube map #898

jirongjiao opened this issue Sep 26, 2023 · 2 comments
Labels

Comments

@jirongjiao
Copy link

jirongjiao commented Sep 26, 2023

With apitrace-11.1-win64 build, using qapitrace.exe to capture a trace of gl-500-texture-cube-arb.exe sample from https://github.com/g-truc/ogl-samples, the cube map is missing (The right image) compared with when just running gl-500-texture-cube-arb.exe by itself (the left image)

cubeMapTexture MissingCubmapTexture
@jrfonseca
Copy link
Member

jrfonseca commented Oct 9, 2023

I can reproduce this on Linux too.

This has something to do with the memory shadowing apitrace does to track writes to coherent memory
#623 from @werman

Because if I disable the shadowing like this the sample renders fine while tracing (of course this still produces broken traces, so not a fix):

diff --git a/wrappers/gltrace.py b/wrappers/gltrace.py
index a7ff39f3..6e58e81a 100644
--- a/wrappers/gltrace.py
+++ b/wrappers/gltrace.py
@@ -557,7 +557,7 @@ class GlTracer(Tracer):
             print('        _glGetBufferParameteriv%s(target, GL_BUFFER_ACCESS, &access);' % suffix)
             print('        flush = access != GL_READ_ONLY;')
             print('    }')
-            print('    if ((access_flags & GL_MAP_COHERENT_BIT) && (access_flags & GL_MAP_WRITE_BIT)) {')
+            print('    if ((access_flags & 0x40000000) && (access_flags & GL_MAP_WRITE_BIT)) {')
             print('        gltrace::Context *_ctx = gltrace::getContext();')
             print('        GLint buffer = getBufferName(target);')
             print('        auto it = _ctx->sharedRes->bufferToShadowMemory.find(buffer);')
@@ -630,7 +630,7 @@ class GlTracer(Tracer):
         if function.name == 'glUnmapNamedBuffer':
             print('    GLint access_flags = 0;')
             print('    _glGetNamedBufferParameteriv(buffer, GL_BUFFER_ACCESS_FLAGS, &access_flags);')
-            print('    if ((access_flags & GL_MAP_COHERENT_BIT) && (access_flags & GL_MAP_WRITE_BIT)) {')
+            print('    if ((access_flags & 0x40000000) && (access_flags & GL_MAP_WRITE_BIT)) {')
             print('        gltrace::Context *_ctx = gltrace::getContext();')
             print('        auto it = _ctx->sharedRes->bufferToShadowMemory.find(buffer);')
             print('        if (it != _ctx->sharedRes->bufferToShadowMemory.end()) {')
@@ -651,7 +651,7 @@ class GlTracer(Tracer):
         if function.name == 'glUnmapNamedBufferEXT':
             print('    GLint access_flags = 0;')
             print('    _glGetNamedBufferParameterivEXT(buffer, GL_BUFFER_ACCESS_FLAGS, &access_flags);')
-            print('    if ((access_flags & GL_MAP_COHERENT_BIT) && (access_flags & GL_MAP_WRITE_BIT)) {')
+            print('    if ((access_flags & 0x40000000) && (access_flags & GL_MAP_WRITE_BIT)) {')
             print('        gltrace::Context *_ctx = gltrace::getContext();')
             print('        auto it = _ctx->sharedRes->bufferToShadowMemory.find(buffer);')
             print('        if (it != _ctx->sharedRes->bufferToShadowMemory.end()) {')
@@ -712,7 +712,7 @@ class GlTracer(Tracer):
             print(r'        flags &= ~GL_MAP_NOTIFY_EXPLICIT_BIT_VMWX;')
             print(r'    }')
             print(r'')
-            print(r'    if ((flags & GL_MAP_COHERENT_BIT) && (flags & GL_MAP_WRITE_BIT)) {')
+            print(r'    if ((flags & 0x40000000) && (flags & GL_MAP_WRITE_BIT)) {')
             print(r'        gltrace::Context *_ctx = gltrace::getContext();')
             if function.name in ('glBufferStorage', 'glBufferStorageEXT'):
                 print(r'        GLint buffer = getBufferName(target);')
@@ -913,7 +913,7 @@ class GlTracer(Tracer):
         Tracer.doInvokeFunction(self, function)
 
         if function.name in ('glMapBufferRange', 'glMapBufferRangeEXT', 'glMapNamedBufferRange', 'glMapNamedBufferRangeEXT'):
-            print(r'    if ((access & GL_MAP_COHERENT_BIT) && (access & GL_MAP_WRITE_BIT)) {')
+            print(r'    if ((access & 0x40000000) && (access & GL_MAP_WRITE_BIT)) {')
             print(r'        gltrace::Context *_ctx = gltrace::getContext();')
             if function.name in ('glMapBufferRange', 'glMapBufferRangeEXT'):
                 print(r'        GLint buffer = getBufferName(target);')

@jirongjiao
Copy link
Author

Not sure what's special about this sample. shadow memory works fine for persistent maps for other samples/apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants