Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading from tess.verts #1199

Open
slipher opened this issue Jun 21, 2024 · 2 comments
Open

Reading from tess.verts #1199

slipher opened this issue Jun 21, 2024 · 2 comments

Comments

@slipher
Copy link
Member

slipher commented Jun 21, 2024

Some renderer functions attempt to read back a surface's polygons from tess.verts. There are 3 possibilities, none of them good:

  • The surface uses a static VBO with multidraw. tess.numVerts will be 0: there is nothing for it to read.
  • The surface uses a static VBO with a single data range. tess.numVerts will be nonzero so the function will think there is data there. But really it is random data left over from whichever surfaces used the buffer last.
  • The surface does not use a static VBO; it actually writes data to tess.verts. The function may at least work correctly in this case. But reading data from this GPU-mapped memory may cause poor performance as in Sky performance cost #849.

I haven't attempted to search for all functions like this, but happened to notice the following ones:

  • SurfIsOffscreen PortalOffScreenOrOutOfRange
  • AutospriteDeform
  • Autosprite2Deform

Note that some "autosprite" code is already known to be broken (#730). We might detect more suspicious functions by mapping the buffer as write-only, or setting it to null when a static VBO is active.

@slipher
Copy link
Member Author

slipher commented Jul 6, 2024

Another culprit: R_GetPortalOrientations. That one also has a more serious problem: #1216.

@slipher
Copy link
Member Author

slipher commented Jul 16, 2024

For historical interest, some previous examples were fixed in f870d9f :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant