[Bf-blender-cvs] [e2d35533431] soc-2019-npr: LANPR: Fix GPU overflow prevention.

YimingWu noreply at git.blender.org
Thu Jul 4 08:56:37 CEST 2019


Commit: e2d3553343116f7bc35c32e6bd229d55d0e772c3
Author: YimingWu
Date:   Thu Jul 4 14:56:11 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBe2d3553343116f7bc35c32e6bd229d55d0e772c3

LANPR: Fix GPU overflow prevention.

===================================================================

M	source/blender/draw/engines/lanpr/lanpr_dpix.c

===================================================================

diff --git a/source/blender/draw/engines/lanpr/lanpr_dpix.c b/source/blender/draw/engines/lanpr/lanpr_dpix.c
index 4e209868f6e..b707990546b 100644
--- a/source/blender/draw/engines/lanpr/lanpr_dpix.c
+++ b/source/blender/draw/engines/lanpr/lanpr_dpix.c
@@ -174,7 +174,7 @@ int lanpr_feed_atlas_data_obj(void *vedata,
   int cache_total = lanpr_share.texture_size * lanpr_share.texture_size;
 
   /* Don't overflow the cache. */
-  if ((edge_count + begin_index + cache_total) < (cache_total - 1)) {
+  if ((edge_count + begin_index) > (cache_total - 1)) {
     return begin_index;
   }
 
@@ -290,7 +290,7 @@ int lanpr_feed_atlas_data_intersection_cache(void *vedata,
   int cache_total = lanpr_share.texture_size * lanpr_share.texture_size;
 
   /* Don't overflow the cache. */
-  if ((rb->intersection_count + begin_index + cache_total) < (cache_total - 1)) {
+  if ((rb->intersection_count + begin_index) > (cache_total - 1)) {
     return 0;
   }
 
@@ -355,7 +355,7 @@ int lanpr_feed_atlas_trigger_preview_obj(void *vedata, Object *ob, int begin_ind
   int cache_total = lanpr_share.texture_size * lanpr_share.texture_size;
 
   /* Don't overflow the cache. */
-  if ((edge_count + begin_index + cache_total) < (cache_total - 1)) {
+  if ((edge_count + begin_index) > (cache_total - 1)) {
     return begin_index;
   }
 
@@ -427,7 +427,7 @@ void lanpr_create_atlas_intersection_preview(void *vedata, int begin_index)
   int cache_total = lanpr_share.texture_size * lanpr_share.texture_size;
 
   /* Don't overflow the cache. */
-  if ((rb->intersection_count + begin_index + cache_total) < (cache_total - 1)) {
+  if ((rb->intersection_count + begin_index) > (cache_total - 1)) {
     return 0;
   }



More information about the Bf-blender-cvs mailing list