Skip to content

Commit

Permalink
[rend2] Reduce goreVBO size revisited
Browse files Browse the repository at this point in the history
  • Loading branch information
SomaZ committed Apr 25, 2024
1 parent 7433777 commit 08ad1d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions code/rd-rend2/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1782,7 +1782,7 @@ static void R_InitGoreVao()
{
tr.goreVBO = R_CreateVBO(
nullptr,
sizeof(g2GoreVert_t) * MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES,
sizeof(g2GoreVert_t) * MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES,
VBO_USAGE_DYNAMIC);
tr.goreVBO->offsets[ATTR_INDEX_POSITION] = offsetof(g2GoreVert_t, position);
tr.goreVBO->offsets[ATTR_INDEX_NORMAL] = offsetof(g2GoreVert_t, normal);
Expand All @@ -1807,11 +1807,13 @@ static void R_InitGoreVao()

tr.goreIBO = R_CreateIBO(
nullptr,
sizeof(glIndex_t) * MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
sizeof(glIndex_t) * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
VBO_USAGE_DYNAMIC);

tr.goreIBOCurrentIndex = 0;
tr.goreVBOCurrentIndex = 0;

GL_CheckErrors();
}
#endif

Expand Down
4 changes: 3 additions & 1 deletion codemp/rd-rend2/tr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1757,11 +1757,13 @@ static void R_InitGoreVao()

tr.goreIBO = R_CreateIBO(
nullptr,
sizeof(glIndex_t) * MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
sizeof(glIndex_t) * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES,
VBO_USAGE_DYNAMIC);

tr.goreIBOCurrentIndex = 0;
tr.goreVBOCurrentIndex = 0;

GL_CheckErrors();
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions shared/rd-rend2/tr_vbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ void RB_UpdateGoreVBO(srfG2GoreSurface_t *goreSurface)
goreSurface->firstVert = tr.goreVBOCurrentIndex;
goreSurface->firstIndex = tr.goreIBOCurrentIndex;

if (tr.goreVBOCurrentIndex + goreSurface->numVerts >= (MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES))
if (tr.goreVBOCurrentIndex + goreSurface->numVerts >= (MAX_GORE_RECORDS * MAX_GORE_VERTS * MAX_FRAMES))
tr.goreVBOCurrentIndex = 0;

R_BindVBO(tr.goreVBO);
Expand All @@ -698,7 +698,7 @@ void RB_UpdateGoreVBO(srfG2GoreSurface_t *goreSurface)
);
tr.goreVBOCurrentIndex += goreSurface->numVerts;

if (tr.goreIBOCurrentIndex + goreSurface->numVerts >= (MAX_LODS * MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES))
if (tr.goreIBOCurrentIndex + goreSurface->numIndexes >= (MAX_GORE_RECORDS * MAX_GORE_INDECIES * MAX_FRAMES))
tr.goreIBOCurrentIndex = 0;

R_BindIBO(tr.goreIBO);
Expand Down

0 comments on commit 08ad1d1

Please sign in to comment.