Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jaden
SRB2
Commits
ee578b68
Commit
ee578b68
authored
4 years ago
by
Hannu Hanhi
Browse files
Options
Downloads
Patches
Plain Diff
Remove bad pointer arithmetic in polygon comparators, that was causing glitches
parent
99c773f3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hardware/hw_batching.c
+16
-5
16 additions, 5 deletions
src/hardware/hw_batching.c
with
16 additions
and
5 deletions
src/hardware/hw_batching.c
+
16
−
5
View file @
ee578b68
...
@@ -137,6 +137,8 @@ static int comparePolygons(const void *p1, const void *p2)
...
@@ -137,6 +137,8 @@ static int comparePolygons(const void *p1, const void *p2)
PolygonArrayEntry
*
poly2
=
&
polygonArray
[
index2
];
PolygonArrayEntry
*
poly2
=
&
polygonArray
[
index2
];
int
diff
;
int
diff
;
INT64
diff64
;
INT64
diff64
;
UINT32
downloaded1
=
0
;
UINT32
downloaded2
=
0
;
int
shader1
=
poly1
->
shader
;
int
shader1
=
poly1
->
shader
;
int
shader2
=
poly2
->
shader
;
int
shader2
=
poly2
->
shader
;
...
@@ -152,7 +154,11 @@ static int comparePolygons(const void *p1, const void *p2)
...
@@ -152,7 +154,11 @@ static int comparePolygons(const void *p1, const void *p2)
if
(
shader1
==
-
1
&&
shader2
==
-
1
)
if
(
shader1
==
-
1
&&
shader2
==
-
1
)
return
index1
-
index2
;
return
index1
-
index2
;
diff64
=
poly1
->
texture
-
poly2
->
texture
;
if
(
poly1
->
texture
)
downloaded1
=
poly1
->
texture
->
downloaded
;
// there should be a opengl texture name here, usable for comparisons
if
(
poly2
->
texture
)
downloaded2
=
poly2
->
texture
->
downloaded
;
diff64
=
downloaded1
-
downloaded2
;
if
(
diff64
!=
0
)
return
diff64
;
if
(
diff64
!=
0
)
return
diff64
;
diff
=
poly1
->
polyFlags
-
poly2
->
polyFlags
;
diff
=
poly1
->
polyFlags
-
poly2
->
polyFlags
;
...
@@ -184,16 +190,21 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
...
@@ -184,16 +190,21 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
GLMipmap_t
*
texture1
=
poly1
->
texture
;
GLMipmap_t
*
texture1
=
poly1
->
texture
;
GLMipmap_t
*
texture2
=
poly2
->
texture
;
GLMipmap_t
*
texture2
=
poly2
->
texture
;
UINT32
downloaded1
=
0
;
UINT32
downloaded2
=
0
;
if
(
poly1
->
polyFlags
&
PF_NoTexture
||
poly1
->
horizonSpecial
)
if
(
poly1
->
polyFlags
&
PF_NoTexture
||
poly1
->
horizonSpecial
)
texture1
=
NULL
;
texture1
=
NULL
;
if
(
poly2
->
polyFlags
&
PF_NoTexture
||
poly2
->
horizonSpecial
)
if
(
poly2
->
polyFlags
&
PF_NoTexture
||
poly2
->
horizonSpecial
)
texture2
=
NULL
;
texture2
=
NULL
;
diff64
=
texture1
-
texture2
;
if
(
texture1
)
if
(
diff64
!=
0
)
return
diff64
;
downloaded1
=
texture1
->
downloaded
;
// there should be a opengl texture name here, usable for comparisons
if
(
texture2
)
downloaded2
=
texture2
->
downloaded
;
// skywalls and horizon lines must retain their order for horizon lines to work
// skywalls and horizon lines must retain their order for horizon lines to work
if
(
texture1
==
NULL
&&
texture2
==
NULL
)
if
(
!
texture1
&&
!
texture2
)
return
index1
-
index2
;
return
index1
-
index2
;
diff64
=
downloaded1
-
downloaded2
;
if
(
diff64
!=
0
)
return
diff64
;
diff
=
poly1
->
polyFlags
-
poly2
->
polyFlags
;
diff
=
poly1
->
polyFlags
-
poly2
->
polyFlags
;
if
(
diff
!=
0
)
return
diff
;
if
(
diff
!=
0
)
return
diff
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment