Skip to content

Commit f0b999f

Browse files
committed
glinject: Move zink check to gl_capture
Also add NULL check. Closes #260
1 parent 3eb5d01 commit f0b999f

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/glinject.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,6 @@ static bool gl_init_funcs(bool glx)
228228
GETGLPROCADDR(TexStorageMem2DEXT);
229229
GETGLPROCADDR(IsMemoryObjectEXT);
230230

231-
// Always use Vulkan capture with zink
232-
const char *renderer = (const char *)gl_f.GetString(GL_RENDERER);
233-
if (strncmp(renderer, "zink", 4) == 0) {
234-
hlog("GL capture disabled with zink");
235-
return true;
236-
}
237-
238231
data.valid = true;
239232

240233
return true;
@@ -838,7 +831,7 @@ static bool gl_shtex_init()
838831
if (data.glx) {
839832
// GLX on NVIDIA is all kinds of broken...
840833
const char *vendor = (const char*)gl_f.GetString(GL_VENDOR);
841-
if (strcmp(vendor, "NVIDIA Corporation") == 0) {
834+
if (vendor && strcmp(vendor, "NVIDIA Corporation") == 0) {
842835
return false;
843836
}
844837
}
@@ -983,8 +976,25 @@ static bool gl_init(void *display, void *surface)
983976
return true;
984977
}
985978

979+
static bool gl_capture_disabled()
980+
{
981+
// Always use Vulkan capture with zink
982+
const char *renderer = (const char *)gl_f.GetString(GL_RENDERER);
983+
if (renderer && strncmp(renderer, "zink", 4) == 0) {
984+
hlog("GL capture disabled with zink");
985+
return true;
986+
}
987+
988+
return false;
989+
}
990+
986991
static void gl_capture(void *display, void *surface)
987992
{
993+
if (gl_capture_disabled()) {
994+
data.valid = false;
995+
return;
996+
}
997+
988998
capture_update_socket();
989999

9901000
if (capture_should_stop()) {

0 commit comments

Comments
 (0)