vbo: provide 64bits support to print_draw_arrays
authorAndres Gomez <agomez@igalia.com>
Sun, 28 Jan 2018 23:35:17 +0000 (01:35 +0200)
committerAndres Gomez <agomez@igalia.com>
Tue, 6 Feb 2018 13:30:29 +0000 (15:30 +0200)
Cc: Mathias Fröhlich <mathias.froehlich@web.de>
Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
src/mesa/vbo/vbo_exec_array.c

index 74b9a1b0ebd0de709748d20dcd81694fdeb93f87..b30e044a8797677225427ee492b1425a55d7f144 100644 (file)
@@ -284,15 +284,32 @@ print_draw_arrays(struct gl_context *ctx,
                                                  MAP_INTERNAL);
          int offset = (int) (GLintptr)
             _mesa_vertex_attrib_address(array, binding);
+
+        unsigned multiplier;
+        switch (array->Type) {
+        case GL_DOUBLE:
+        case GL_INT64_ARB:
+        case GL_UNSIGNED_INT64_ARB:
+           multiplier = 2;
+           break;
+        default:
+           multiplier = 1;
+        }
+
          float *f = (float *) (p + offset);
          int *k = (int *) f;
         int i = 0;
-        int n = (count - 1) * (binding->Stride / 4) + array->Size;
+        int n = (count - 1) * (binding->Stride / (4 * multiplier))
+          + array->Size;
          if (n > 32)
             n = 32;
          printf("  Data at offset %d:\n", offset);
         do {
-            printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
+           if (multiplier == 2)
+              printf("    double[%d] = 0x%016llx %lf\n", i,
+                     ((unsigned long long *) k)[i], ((double *) f)[i]);
+           else
+              printf("    float[%d] = 0x%08x %f\n", i, k[i], f[i]);
            i++;
         } while (i < n);
          ctx->Driver.UnmapBuffer(ctx, bufObj, MAP_INTERNAL);