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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
e8706fa9
Commit
e8706fa9
authored
1 year ago
by
Hanicef
Browse files
Options
Downloads
Patches
Plain Diff
Check hash instead of each field when batching
parent
ef4f2e71
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!2355
fix newer versions of mixerx
,
!2253
Optimize polygon sorting on batch renderer
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/hardware/hw_batching.c
+62
-60
62 additions, 60 deletions
src/hardware/hw_batching.c
with
62 additions
and
60 deletions
src/hardware/hw_batching.c
+
62
−
60
View file @
e8706fa9
...
@@ -310,46 +310,45 @@ void HWR_RenderBatches(void)
...
@@ -310,46 +310,45 @@ void HWR_RenderBatches(void)
{
{
// check if a state change is required, set the change bools and next vars
// check if a state change is required, set the change bools and next vars
int
nextIndex
=
polygonIndexArray
[
polygonReadPos
];
int
nextIndex
=
polygonIndexArray
[
polygonReadPos
];
nextShader
=
polygonArray
[
nextIndex
].
shader
;
if
(
polygonArray
[
index
].
hash
!=
polygonArray
[
nextIndex
].
hash
)
nextTexture
=
polygonArray
[
nextIndex
].
texture
;
nextPolyFlags
=
polygonArray
[
nextIndex
].
polyFlags
;
nextSurfaceInfo
=
polygonArray
[
nextIndex
].
surf
;
if
(
nextPolyFlags
&
PF_NoTexture
)
nextTexture
=
0
;
if
(
currentShader
!=
nextShader
&&
cv_glshaders
.
value
&&
gl_shadersavailable
)
{
{
changeState
=
true
;
changeState
=
true
;
changeShader
=
true
;
nextShader
=
polygonArray
[
nextIndex
].
shader
;
}
nextTexture
=
polygonArray
[
nextIndex
].
texture
;
if
(
currentTexture
!=
nextTexture
)
nextPolyFlags
=
polygonArray
[
nextIndex
].
polyFlags
;
{
nextSurfaceInfo
=
polygonArray
[
nextIndex
].
surf
;
changeState
=
true
;
if
(
nextPolyFlags
&
PF_NoTexture
)
changeTexture
=
true
;
nextTexture
=
0
;
}
if
(
currentShader
!=
nextShader
&&
cv_glshaders
.
value
&&
gl_shadersavailable
)
if
(
currentPolyFlags
!=
nextPolyFlags
)
{
changeState
=
true
;
changePolyFlags
=
true
;
}
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
{
if
(
currentSurfaceInfo
.
PolyColor
.
rgba
!=
nextSurfaceInfo
.
PolyColor
.
rgba
||
currentSurfaceInfo
.
TintColor
.
rgba
!=
nextSurfaceInfo
.
TintColor
.
rgba
||
currentSurfaceInfo
.
FadeColor
.
rgba
!=
nextSurfaceInfo
.
FadeColor
.
rgba
||
currentSurfaceInfo
.
LightInfo
.
light_level
!=
nextSurfaceInfo
.
LightInfo
.
light_level
||
currentSurfaceInfo
.
LightInfo
.
fade_start
!=
nextSurfaceInfo
.
LightInfo
.
fade_start
||
currentSurfaceInfo
.
LightInfo
.
fade_end
!=
nextSurfaceInfo
.
LightInfo
.
fade_end
)
{
{
changeState
=
true
;
changeShader
=
true
;
changeSurfaceInfo
=
true
;
}
}
}
if
(
currentTexture
!=
nextTexture
)
else
{
{
changeTexture
=
true
;
if
(
currentSurfaceInfo
.
PolyColor
.
rgba
!=
nextSurfaceInfo
.
PolyColor
.
rgba
)
}
if
(
currentPolyFlags
!=
nextPolyFlags
)
{
changePolyFlags
=
true
;
}
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
{
{
changeState
=
true
;
if
(
currentSurfaceInfo
.
PolyColor
.
rgba
!=
nextSurfaceInfo
.
PolyColor
.
rgba
||
changeSurfaceInfo
=
true
;
currentSurfaceInfo
.
TintColor
.
rgba
!=
nextSurfaceInfo
.
TintColor
.
rgba
||
currentSurfaceInfo
.
FadeColor
.
rgba
!=
nextSurfaceInfo
.
FadeColor
.
rgba
||
currentSurfaceInfo
.
LightInfo
.
light_level
!=
nextSurfaceInfo
.
LightInfo
.
light_level
||
currentSurfaceInfo
.
LightInfo
.
fade_start
!=
nextSurfaceInfo
.
LightInfo
.
fade_start
||
currentSurfaceInfo
.
LightInfo
.
fade_end
!=
nextSurfaceInfo
.
LightInfo
.
fade_end
)
{
changeSurfaceInfo
=
true
;
}
}
else
{
if
(
currentSurfaceInfo
.
PolyColor
.
rgba
!=
nextSurfaceInfo
.
PolyColor
.
rgba
)
{
changeSurfaceInfo
=
true
;
}
}
}
}
}
}
}
...
@@ -371,36 +370,39 @@ void HWR_RenderBatches(void)
...
@@ -371,36 +370,39 @@ void HWR_RenderBatches(void)
if
(
stopFlag
)
break
;
if
(
stopFlag
)
break
;
// change state according to change bools and next vars, update current vars and reset bools
// change state according to change bools and next vars, update current vars and reset bools
if
(
changeS
hader
)
if
(
changeS
tate
)
{
{
HWD
.
pfnSetShader
(
nextShader
);
if
(
changeShader
)
currentShader
=
nextShader
;
{
changeShader
=
false
;
HWD
.
pfnSetShader
(
nextShader
);
currentShader
=
nextShader
;
changeShader
=
false
;
ps_hw_numshaders
.
value
.
i
++
;
ps_hw_numshaders
.
value
.
i
++
;
}
}
if
(
changeTexture
)
if
(
changeTexture
)
{
{
// texture should be already ready for use from calls to SetTexture during batch collection
// texture should be already ready for use from calls to SetTexture during batch collection
HWD
.
pfnSetTexture
(
nextTexture
);
HWD
.
pfnSetTexture
(
nextTexture
);
currentTexture
=
nextTexture
;
currentTexture
=
nextTexture
;
changeTexture
=
false
;
changeTexture
=
false
;
ps_hw_numtextures
.
value
.
i
++
;
ps_hw_numtextures
.
value
.
i
++
;
}
}
if
(
changePolyFlags
)
if
(
changePolyFlags
)
{
{
currentPolyFlags
=
nextPolyFlags
;
currentPolyFlags
=
nextPolyFlags
;
changePolyFlags
=
false
;
changePolyFlags
=
false
;
ps_hw_numpolyflags
.
value
.
i
++
;
ps_hw_numpolyflags
.
value
.
i
++
;
}
}
if
(
changeSurfaceInfo
)
if
(
changeSurfaceInfo
)
{
{
currentSurfaceInfo
=
nextSurfaceInfo
;
currentSurfaceInfo
=
nextSurfaceInfo
;
changeSurfaceInfo
=
false
;
changeSurfaceInfo
=
false
;
ps_hw_numcolors
.
value
.
i
++
;
ps_hw_numcolors
.
value
.
i
++
;
}
}
}
// and that should be it?
// and that should be it?
}
}
...
...
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