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
fc1e8fb5
Unverified
Commit
fc1e8fb5
authored
1 year ago
by
Hanicef
Browse files
Options
Downloads
Patches
Plain Diff
Avoid batching skybox and horizon lines
parent
64c4579b
Branches
Branches containing commit
Tags
v3.6.16
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hardware/hw_batching.c
+19
-33
19 additions, 33 deletions
src/hardware/hw_batching.c
src/hardware/hw_batching.h
+0
-2
0 additions, 2 deletions
src/hardware/hw_batching.h
with
19 additions
and
35 deletions
src/hardware/hw_batching.c
+
19
−
33
View file @
fc1e8fb5
...
@@ -78,7 +78,9 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
...
@@ -78,7 +78,9 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
// render the polygon immediately.
// render the polygon immediately.
void
HWR_ProcessPolygon
(
FSurfaceInfo
*
pSurf
,
FOutVector
*
pOutVerts
,
FUINT
iNumPts
,
FBITFIELD
PolyFlags
,
int
shader
,
boolean
horizonSpecial
)
void
HWR_ProcessPolygon
(
FSurfaceInfo
*
pSurf
,
FOutVector
*
pOutVerts
,
FUINT
iNumPts
,
FBITFIELD
PolyFlags
,
int
shader
,
boolean
horizonSpecial
)
{
{
if
(
currently_batching
)
// draw skybox and horizon lines immediately so they don't bloat the polygon buffer.
// this is important for performance since horizon lines are order-sensitive and can't easily be batched.
if
(
currently_batching
&&
!
(
PolyFlags
&
PF_NoTexture
)
&&
!
horizonSpecial
)
{
{
if
(
!
pSurf
)
if
(
!
pSurf
)
I_Error
(
"Got a null FSurfaceInfo in batching"
);
// nulls should not come in the stuff that batching currently applies to
I_Error
(
"Got a null FSurfaceInfo in batching"
);
// nulls should not come in the stuff that batching currently applies to
...
@@ -115,36 +117,25 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
...
@@ -115,36 +117,25 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
polygonArray
[
polygonArraySize
].
polyFlags
=
PolyFlags
;
polygonArray
[
polygonArraySize
].
polyFlags
=
PolyFlags
;
polygonArray
[
polygonArraySize
].
texture
=
current_texture
;
polygonArray
[
polygonArraySize
].
texture
=
current_texture
;
polygonArray
[
polygonArraySize
].
shader
=
shader
;
polygonArray
[
polygonArraySize
].
shader
=
shader
;
polygonArray
[
polygonArraySize
].
horizonSpecial
=
horizonSpecial
;
// default to polygonArraySize so we don't lose order on horizon lines
// (yes, it's supposed to be negative, since we're sorting in that direction)
polygonArray
[
polygonArraySize
].
hash
=
-
polygonArraySize
;
polygonArraySize
++
;
polygonArraySize
++
;
if
(
!
(
PolyFlags
&
PF_NoTexture
)
&&
!
horizonSpecial
)
// use FNV-1a to hash polygons for later sorting.
{
INT32
hash
=
0x811c9dc5
;
// use FNV-1a to hash polygons for later sorting.
INT32
hash
=
0x811c9dc5
;
#define DIGEST(h, x) h ^= (x); h *= 0x01000193
#define DIGEST(h, x) h ^= (x); h *= 0x01000193
if
(
current_texture
)
DIGEST
(
hash
,
current_texture
->
downloaded
);
{
DIGEST
(
hash
,
PolyFlags
);
DIGEST
(
hash
,
current_texture
->
downloaded
);
DIGEST
(
hash
,
pSurf
->
PolyColor
.
rgba
);
}
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
DIGEST
(
hash
,
PolyFlags
);
{
DIGEST
(
hash
,
pSurf
->
PolyColor
.
rgba
);
DIGEST
(
hash
,
shader
);
if
(
cv_glshaders
.
value
&&
gl_shadersavailable
)
DIGEST
(
hash
,
pSurf
->
TintColor
.
rgba
);
{
DIGEST
(
hash
,
pSurf
->
FadeColor
.
rgba
);
DIGEST
(
hash
,
shader
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
light_level
);
DIGEST
(
hash
,
pSurf
->
TintColor
.
rgba
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_start
);
DIGEST
(
hash
,
pSurf
->
FadeColor
.
rgba
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_end
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
light_level
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_start
);
DIGEST
(
hash
,
pSurf
->
LightInfo
.
fade_end
);
}
#undef DIGEST
// remove the sign bit to ensure that skybox and horizon line comes first.
polygonArray
[
polygonArraySize
-
1
].
hash
=
(
hash
&
INT32_MAX
);
}
}
#undef DIGEST
polygonArray
[
polygonArraySize
-
1
].
hash
=
hash
;
memcpy
(
&
unsortedVertexArray
[
unsortedVertexArraySize
],
pOutVerts
,
iNumPts
*
sizeof
(
FOutVector
));
memcpy
(
&
unsortedVertexArray
[
unsortedVertexArraySize
],
pOutVerts
,
iNumPts
*
sizeof
(
FOutVector
));
unsortedVertexArraySize
+=
iNumPts
;
unsortedVertexArraySize
+=
iNumPts
;
...
@@ -239,10 +230,7 @@ void HWR_RenderBatches(void)
...
@@ -239,10 +230,7 @@ void HWR_RenderBatches(void)
HWD
.
pfnSetShader
(
currentShader
);
HWD
.
pfnSetShader
(
currentShader
);
}
}
if
(
currentPolyFlags
&
PF_NoTexture
)
HWD
.
pfnSetTexture
(
currentTexture
);
currentTexture
=
NULL
;
else
HWD
.
pfnSetTexture
(
currentTexture
);
while
(
1
)
// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
while
(
1
)
// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
{
{
...
@@ -314,8 +302,6 @@ void HWR_RenderBatches(void)
...
@@ -314,8 +302,6 @@ void HWR_RenderBatches(void)
nextTexture
=
polygonArray
[
nextIndex
].
texture
;
nextTexture
=
polygonArray
[
nextIndex
].
texture
;
nextPolyFlags
=
polygonArray
[
nextIndex
].
polyFlags
;
nextPolyFlags
=
polygonArray
[
nextIndex
].
polyFlags
;
nextSurfaceInfo
=
polygonArray
[
nextIndex
].
surf
;
nextSurfaceInfo
=
polygonArray
[
nextIndex
].
surf
;
if
(
nextPolyFlags
&
PF_NoTexture
)
nextTexture
=
0
;
if
(
currentShader
!=
nextShader
&&
cv_glshaders
.
value
&&
gl_shadersavailable
)
if
(
currentShader
!=
nextShader
&&
cv_glshaders
.
value
&&
gl_shadersavailable
)
{
{
changeState
=
true
;
changeState
=
true
;
...
...
This diff is collapsed.
Click to expand it.
src/hardware/hw_batching.h
+
0
−
2
View file @
fc1e8fb5
...
@@ -24,8 +24,6 @@ typedef struct
...
@@ -24,8 +24,6 @@ typedef struct
FBITFIELD
polyFlags
;
FBITFIELD
polyFlags
;
GLMipmap_t
*
texture
;
GLMipmap_t
*
texture
;
int
shader
;
int
shader
;
// this tells batching that the plane belongs to a horizon line and must be drawn in correct order with the skywalls
boolean
horizonSpecial
;
INT32
hash
;
INT32
hash
;
}
PolygonArrayEntry
;
}
PolygonArrayEntry
;
...
...
This diff is collapsed.
Click to expand it.
Hanicef
@Hanicef
mentioned in commit
ef4f2e71
·
1 year ago
mentioned in commit
ef4f2e71
mentioned in commit ef4f2e71ad6e4fbd6163d9f4172d460bba973fbb
Toggle commit list
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