X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fglretrace_cgl.cpp;h=73bb250c4a4b58bf5b19d63337fa6bcadff58739;hb=bd9811ff579a0482bfd7d40b1149bcef40ad3d71;hp=d66fbb5bf8d69767eab5278e8dd5bb9a02f40618;hpb=5ed4ca62e0b1236ff45e608d6b531a2181c6afbb;p=apitrace diff --git a/retrace/glretrace_cgl.cpp b/retrace/glretrace_cgl.cpp index d66fbb5..73bb250 100644 --- a/retrace/glretrace_cgl.cpp +++ b/retrace/glretrace_cgl.cpp @@ -127,7 +127,7 @@ getContext(unsigned long long ctx) { static void retrace_CGLChoosePixelFormat(trace::Call &call) { int profile = kCGLOGLPVersion_Legacy; - const trace::Array * attribs = dynamic_cast(&call.arg(0)); + const trace::Array * attribs = call.arg(0).toArray(); if (attribs) { size_t i = 0; while (i < attribs->values.size()) { @@ -201,7 +201,7 @@ static void retrace_CGLCreateContext(trace::Call &call) { unsigned long long share = call.arg(1).toUIntPtr(); Context *sharedContext = getContext(share); - const trace::Array *ctx_ptr = dynamic_cast(&call.arg(2)); + const trace::Array *ctx_ptr = call.arg(2).toArray(); unsigned long long ctx = ctx_ptr->values[0]->toUIntPtr(); Context *context = glretrace::createContext(sharedContext); @@ -239,13 +239,18 @@ static void retrace_CGLFlushDrawable(trace::Call &call) { Context *context = getContext(ctx); if (context) { - if (retrace::doubleBuffer) { - context->drawable->swapBuffers(); + if (context->drawable) { + if (retrace::doubleBuffer) { + context->drawable->swapBuffers(); + } else { + glFlush(); + } + frame_complete(call); } else { - glFlush(); + if (retrace::debug) { + retrace::warning(call) << "context has no drawable\n"; + } } - - frame_complete(call); } } @@ -290,7 +295,7 @@ static void retrace_CGLTexImageIOSurface2D(trace::Call &call) { GLvoid * pixels = NULL; - if (glretrace::currentContext != context) { + if (glretrace::getCurrentContext() != context) { if (retrace::debug) { retrace::warning(call) << "current context mismatch\n"; } @@ -306,17 +311,23 @@ static void retrace_CGLTexImageIOSurface2D(trace::Call &call) { const retrace::Entry glretrace::cgl_callbacks[] = { {"CGLChoosePixelFormat", &retrace_CGLChoosePixelFormat}, - {"CGLDestroyPixelFormat", &retrace::ignore}, {"CGLCreateContext", &retrace_CGLCreateContext}, {"CGLDestroyContext", &retrace_CGLDestroyContext}, - {"CGLSetCurrentContext", &retrace_CGLSetCurrentContext}, - {"CGLGetCurrentContext", &retrace::ignore}, - {"CGLEnable", &retrace::ignore}, + {"CGLDestroyPixelFormat", &retrace::ignore}, {"CGLDisable", &retrace::ignore}, - {"CGLSetParameter", &retrace::ignore}, - {"CGLGetParameter", &retrace::ignore}, + {"CGLEnable", &retrace::ignore}, + {"CGLErrorString", &retrace::ignore}, {"CGLFlushDrawable", &retrace_CGLFlushDrawable}, + {"CGLGetCurrentContext", &retrace::ignore}, + {"CGLGetOption", &retrace::ignore}, + {"CGLGetParameter", &retrace::ignore}, + {"CGLGetVersion", &retrace::ignore}, + {"CGLGetVirtualScreen", &retrace::ignore}, + {"CGLIsEnabled", &retrace::ignore}, + {"CGLSetCurrentContext", &retrace_CGLSetCurrentContext}, + {"CGLSetParameter", &retrace::ignore}, {"CGLTexImageIOSurface2D", &retrace_CGLTexImageIOSurface2D}, + {"CGLUpdateContext", &retrace::ignore}, {NULL, NULL}, };