aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpu_neon/psx_gpu
diff options
context:
space:
mode:
authorExophase2011-12-23 02:45:21 +0200
committernotaz2011-12-23 02:45:34 +0200
commite86b6fecb5f0db18b29900a1af82d455c38fcb1e (patch)
tree6ece9a61e7ff9bfd89ac658fe98a96cc7774ccb6 /plugins/gpu_neon/psx_gpu
parent6ea0f7bfb085890dda8f1d29077995d7c0dc1ce4 (diff)
downloadpcsx_rearmed-e86b6fecb5f0db18b29900a1af82d455c38fcb1e.tar.gz
pcsx_rearmed-e86b6fecb5f0db18b29900a1af82d455c38fcb1e.tar.bz2
pcsx_rearmed-e86b6fecb5f0db18b29900a1af82d455c38fcb1e.zip
psx_gpu: fix divide by 0
Diffstat (limited to 'plugins/gpu_neon/psx_gpu')
-rw-r--r--plugins/gpu_neon/psx_gpu/psx_gpu.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c
index 0f73f41..84848f8 100644
--- a/plugins/gpu_neon/psx_gpu/psx_gpu.c
+++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c
@@ -3886,9 +3886,18 @@ void render_sprite(psx_gpu_struct *psx_gpu, s32 x, s32 y, u32 u, u32 v,
#define set_line_gradients(minor) \
{ \
s32 gradient_divisor = delta_##minor; \
- gradient_r = int_to_fixed(vertex_b->r - vertex_a->r) / gradient_divisor; \
- gradient_g = int_to_fixed(vertex_b->g - vertex_a->g) / gradient_divisor; \
- gradient_b = int_to_fixed(vertex_b->b - vertex_a->b) / gradient_divisor; \
+ if(gradient_divisor != 0) \
+ { \
+ gradient_r = int_to_fixed(vertex_b->r - vertex_a->r) / gradient_divisor; \
+ gradient_g = int_to_fixed(vertex_b->g - vertex_a->g) / gradient_divisor; \
+ gradient_b = int_to_fixed(vertex_b->b - vertex_a->b) / gradient_divisor; \
+ } \
+ else \
+ { \
+ gradient_r = 0; \
+ gradient_g = 0; \
+ gradient_b = 0; \
+ } \
current_r = fixed_center(vertex_a->r); \
current_g = fixed_center(vertex_a->g); \
current_b = fixed_center(vertex_a->b); \