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

How to fetch the number of vertices for each primitive? #77

Open
LinkKung opened this issue May 24, 2023 · 0 comments
Open

How to fetch the number of vertices for each primitive? #77

LinkKung opened this issue May 24, 2023 · 0 comments

Comments

@LinkKung
Copy link

I am using Transform Feedback to write the data of GPU operations to the buffer and obtain the number of generated entities through glGetQueryObjectuiv. However, unlike the example you provided in the following website, the number of vertices generated each time in the geometric shader is different. For example, I will add some if filtering conditions in the code, which results in a maximum of 3 vertices, but only 2 directly emitted vertices. So when I want to copy data from memory, how to fetch the number of vertices of each primitive to determine the size of the buffer is a very troublesome problem.
Therefore, I try not to filter vertices in the conditions, but instead return the default vertex. At the same time, I add a flag (Valid) for each vertex to determine whether the vertexe is valid or not. This method ensures that the maximum number of returned vertices is 3, so it can accurately calculate the buffer data size. However, this can lead to excessive data space for fetching copied data, and increasing the time consumed when re-filtering on the CPU.
So, I would like to inquire if there is a simpler way to fetch the number of vertices for each primitive, so that I can create a space of appropriate size to copy the data from the buffer. Thank you very much!

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

No branches or pull requests

1 participant