aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu_neon
diff options
context:
space:
mode:
authornotaz2012-10-21 20:06:51 +0300
committernotaz2012-10-23 01:28:24 +0300
commitc111e8f8fb8a0d3bd7b05c743a48d942e107cc79 (patch)
tree019c68a1942177e41180cf7ec0927c06734a7b39 /plugins/gpu_neon
parent59d15d23d97d4347d8046057013f8979db0914f0 (diff)
downloadpcsx_rearmed-c111e8f8fb8a0d3bd7b05c743a48d942e107cc79.tar.gz
pcsx_rearmed-c111e8f8fb8a0d3bd7b05c743a48d942e107cc79.tar.bz2
pcsx_rearmed-c111e8f8fb8a0d3bd7b05c743a48d942e107cc79.zip
psx_gpu: change reciprocal table again
otherwise something overflows somewhere and causes num_block overflow. Also added debug code to cache that issue early.
Diffstat (limited to 'plugins/gpu_neon')
-rw-r--r--plugins/gpu_neon/Makefile2
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu.c20
-rw-r--r--plugins/gpu_neon/psx_gpu/tests/Makefile2
3 files changed, 20 insertions, 4 deletions
diff --git a/plugins/gpu_neon/Makefile b/plugins/gpu_neon/Makefile
index 8a7342b..08bf0ee 100644
--- a/plugins/gpu_neon/Makefile
+++ b/plugins/gpu_neon/Makefile
@@ -1,4 +1,4 @@
-CFLAGS += -ggdb -Wall -O2
+CFLAGS += -ggdb -Wall -O2 -DNDEBUG
include ../../config.mak
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c
index 3de2ece..ce72af5 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu.c
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c
@@ -767,6 +767,21 @@ void compute_all_gradients(psx_gpu_struct *psx_gpu, vertex_struct *a,
printf("mismatch on %s %s: %x vs %x\n", #_a, #_b, _a, _b) \
+#ifndef NDEBUG
+#define setup_spans_debug_check(span_edge_data_element) \
+ if (&span_edge_data_element - psx_gpu->span_edge_data < psx_gpu->num_spans) \
+ { \
+ if(span_edge_data_element.num_blocks > MAX_BLOCKS_PER_ROW) \
+ *(int *)0 = 1; \
+ if(span_edge_data_element.y > 2048) \
+ *(int *)0 = 1; \
+ } \
+
+#else
+#define setup_spans_debug_check(span_edge_data_element) \
+
+#endif
+
#define setup_spans_prologue_alternate_yes() \
vec_2x64s alternate_x; \
vec_2x64s alternate_dx_dy; \
@@ -1070,6 +1085,7 @@ void compute_all_gradients(psx_gpu_struct *psx_gpu, vertex_struct *a,
span_edge_data[i].num_blocks = left_right_x_16.high.e[i]; \
span_edge_data[i].right_mask = span_shift.e[i]; \
span_edge_data[i].y = y_x4.e[i]; \
+ setup_spans_debug_check(span_edge_data[i]); \
} \
\
span_edge_data += 4; \
@@ -4906,10 +4922,10 @@ void initialize_reciprocal_table(void)
{
shift = __builtin_clz(height);
height_normalized = height << shift;
- height_reciprocal = ((1ULL << 52) + (height_normalized - 1)) /
+ height_reciprocal = ((1ULL << 51) + (height_normalized - 1)) /
height_normalized;
- shift = 32 - (52 - shift);
+ shift = 32 - (51 - shift);
reciprocal_table[height] = (height_reciprocal << 10) | shift;
}
diff --git a/plugins/gpu_neon/psx_gpu/tests/Makefile b/plugins/gpu_neon/psx_gpu/tests/Makefile
index 210f44d..58cca29 100644
--- a/plugins/gpu_neon/psx_gpu/tests/Makefile
+++ b/plugins/gpu_neon/psx_gpu/tests/Makefile
@@ -13,7 +13,7 @@ ASFLAGS = $(CFLAGS)
OBJ += psx_gpu_arm_neon.o
endif
ifndef DEBUG
-CFLAGS += -O2 -fno-strict-aliasing
+CFLAGS += -O2 -DNDEBUG -fno-strict-aliasing
endif
OBJ += psx_gpu.o psx_gpu_parse.o psx_gpu_main.o