+ uint32 gRSPnumLights, float gRSPfFogMin,
+ uint32 primitiveColor, uint32 primitiveColor_);
+
+// debug
+//#define DO_CMP
+#ifdef DO_CMP
+// note: don't forget -fno-associative-math
+static XVECTOR4 n_transformed[2], n_projected[2];
+static uint32 n_color[2];
+static VECTOR2 n_vtxcoords[2];
+static float n_fogcoord[2];
+static uint32 n_clipflag2[2];
+
+static int do_cmp_f(void *a, void *b, int c)
+{
+ int *ia = (int *)a, *ib = (int *)b;
+ for (int i = 0; i < c; i++) {
+ int di = abs(ia[i] - ib[i]);
+ if (di > 7) {
+ printf("di: %d\n", di);
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static int do_cmp_c(uint32 a, uint32 b)
+{
+ if (abs(((a >> 0) & 0xff) - ((b >> 0) & 0xff)) > 1)
+ return 1;
+ if (abs(((a >> 8) & 0xff) - ((b >> 8) & 0xff)) > 1)
+ return 1;
+ if (abs(((a >> 16) & 0xff) - ((b >> 16) & 0xff)) > 1)
+ return 1;
+ if (abs(((a >> 24) & 0xff) - ((b >> 24) & 0xff)) > 1)
+ return 1;
+
+ return 0;
+}
+
+static void do_cmp(int i, int s, int neon_state)
+{
+ static int ccnt;
+ int bad = 0;
+
+ // if (memcmp(&n_transformed, &g_vtxTransformed[i], sizeof(XVECTOR4)))
+ if (do_cmp_f(&n_transformed[s], &g_vtxTransformed[i], 4)) {
+ printf("transformed:\n%13.8e %13.8e %13.8e %13.8e\n"
+ "%13.8e %13.8e %13.8e %13.8e\n",
+ n_transformed[s].x, n_transformed[s].y,
+ n_transformed[s].z, n_transformed[s].w,
+ g_vtxTransformed[i].x, g_vtxTransformed[i].y,
+ g_vtxTransformed[i].z, g_vtxTransformed[i].w);
+ bad = 1;
+ }
+ if (do_cmp_f(&n_projected[s], &g_vecProjected[i], 4)) {
+ printf("projected:\n%13.8e %13.8e %13.8e %13.8e |%08x\n"
+ "%13.8e %13.8e %13.8e %13.8e |%08x\n",
+ n_projected[s].x, n_projected[s].y,
+ n_projected[s].z, n_projected[s].w,
+ *(uint32 *)&n_projected[s].w,
+ g_vecProjected[i].x, g_vecProjected[i].y,
+ g_vecProjected[i].z, g_vecProjected[i].w,
+ *(uint32 *)&g_vecProjected[i].w);
+ bad = 1;
+ }
+ if (n_vtxcoords[s].x != g_fVtxTxtCoords[i].x
+ || n_vtxcoords[s].y != g_fVtxTxtCoords[i].y)
+ {
+ printf("vtxcoords:\n%13.8e %13.8e\n%13.8e %13.8e\n",
+ n_vtxcoords[s].x, n_vtxcoords[s].y,
+ g_fVtxTxtCoords[i].x, g_fVtxTxtCoords[i].y);
+ bad = 1;
+ }
+ if (n_clipflag2[s] != g_clipFlag2[i]) {
+ printf("clipflag2: %08x %08x\n", n_clipflag2[s], g_clipFlag2[i]);
+ bad = 1;
+ }
+ if (do_cmp_c(n_color[s], g_dwVtxDifColor[i])) {
+ printf("n_color: %08x %08x\n", n_color[s], g_dwVtxDifColor[i]);
+ bad = 1;
+ }
+ if (!(neon_state & PV_NEON_ENABLE_SHADE))
+ printf("!ENABLE_SHADE!\n");
+ if (bad) {
+ printf("%d s=%d, state %02x\n", ccnt, s, neon_state);
+ printf(".w %08x %08x\n",
+ *(uint32 *)&n_projected[s].w, *(uint32 *)&g_vecProjected[i].w);
+ exit(ccnt);
+ }
+ ccnt++;
+}
+#endif