]> git.cworth.org Git - apitrace/blobdiff - cli/cli_trace.cpp
gltrace: Prevent crash in _glGetDebugMessageLog_length (issue #140).
[apitrace] / cli / cli_trace.cpp
index 1d19ed5c5ba11e9662d3253192d2ca5e26869122..52843c70703564af811410553a3cfc95dd278fb5 100644 (file)
@@ -116,9 +116,7 @@ traceProgram(trace::API api,
     case trace::API_D3D9:
         wrapperFilename = "d3d9.dll";
         break;
-    case trace::API_D3D10:
-    case trace::API_D3D10_1:
-    case trace::API_D3D11:
+    case trace::API_DXGI:
         wrapperFilename = "dxgitrace.dll";
         useInject = true;
         break;
@@ -128,13 +126,14 @@ traceProgram(trace::API api,
         return 1;
     }
 
-    os::String wrapperPath = findWrapper(wrapperFilename);
+    os::String wrapperPath = findWrapper(wrapperFilename, verbose);
     if (!wrapperPath.length()) {
-        std::cerr << "error: failed to find " << wrapperFilename << "\n";
+        std::cerr << "error: failed to find " << wrapperFilename << " wrapper\n";
         goto exit;
     }
 
 #if defined(_WIN32)
+    useInject = true;
     if (useInject) {
         args.push_back("inject");
         args.push_back(wrapperPath);
@@ -170,7 +169,6 @@ traceProgram(trace::API api,
     for (char * const * arg = argv; *arg; ++arg) {
         args.push_back(*arg);
     }
-    args.push_back(NULL);
 
     if (verbose) {
         const char *sep = "";
@@ -181,6 +179,8 @@ traceProgram(trace::API api,
         std::cerr << "\n";
     }
 
+    args.push_back(NULL);
+
     status = os::execute((char * const *)&args[0]);
 
 exit:
@@ -221,7 +221,7 @@ usage(void)
         "    -v, --verbose       verbose output\n"
         "    -a, --api=API       specify API to trace ("
 #ifdef _WIN32
-                                                      "gl, d3d7, d3d8, d3d9, or d3d10"
+                                                      "gl, d3d7, d3d8, d3d9, or dxgi (for d3d10 and higher) "
 #else
                                                       "gl or egl"
 #endif
@@ -270,12 +270,12 @@ command(int argc, char *argv[])
                 api = trace::API_D3D8;
             } else if (strcmp(optarg, "d3d9") == 0) {
                 api = trace::API_D3D9;
-            } else if (strcmp(optarg, "d3d10") == 0) {
-                api = trace::API_D3D10;
-            } else if (strcmp(optarg, "d3d10_1") == 0) {
-                api = trace::API_D3D10_1;
-            } else if (strcmp(optarg, "d3d11") == 0) {
-                api = trace::API_D3D11;
+            } else if (strcmp(optarg, "dxgi") == 0 ||
+                       strcmp(optarg, "d3d10") == 0 ||
+                       strcmp(optarg, "d3d10_1") == 0 ||
+                       strcmp(optarg, "d3d11") == 0 ||
+                       strcmp(optarg, "d3d11_1") == 0) {
+                api = trace::API_DXGI;
             } else {
                 std::cerr << "error: unknown API `" << optarg << "`\n";
                 usage();