-
Notifications
You must be signed in to change notification settings - Fork 60
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
Runtime VBO layout: make half float usage optional #1344
Conversation
4aa6c4e
to
c599d68
Compare
OK I've finished reading everything. I'll do some tests on r300 hardware to see the performances when I disable the extension. |
c599d68
to
4b8566e
Compare
For some unknown reasons I don't reproduce the 55fps I had on default Vega scene on one of the slowest r300 ever some months ago, I only get 37 fps today. But the good news is that I also get 37 fps with my own branch #1179, so that's not your branch's fault. Either we merged something bad in between, either I got a regression in the system (I updated from Ubuntu 23.10 to Ubuntu 24.04 since the last time and then I got updated systems libs including Mesa). I confirm this unlocks the fps on the hardware and does the job, as with half float vertexes I get 5 fps on the same vega scene. I can't test right now on Intel GMA3 as I'm not next to it and probably not before some months, but I assume it's fine as well. So, LGTM. |
In fact the 75fps was caped by the monitor refresh rate. For some reasons with that driver the vsync is always forced, I had to write some Xorg config to unlock it. I get 90fps: I even get 31fps with a 720p resolution: This is the lowest-end range of hardware among the slowest family of ATI cards that are supported, and it's possible to play at 90fps. For the curious people the Xorg trick to unlock the framerate is this file
|
So now we're just waiting on #1341. |
Some duplicated version of map geometry which was used by static light code.
Generate the layout for interleaved vertex attribute data at runtime. The motivation for this is to support OpenGL implementations that don't provide half float support (#1179). The vertex "struct" may contain a 16-bit or 32-bit float, depending on the graphics card. Now, instead of defining a struct for the data to be uploaded into a VBO, one must separately specify inputs for each attribute. The input is defined by a type, base address, stride, etc.; very similarly to the arguments of glVertexAttribPointer itself. The new version of R_CreateStaticVBO takes these inputs and writes them to an interleaved format, performing any neede type conversions along the way. In this commit just skeletal models (IQM and MD5) are migrated to the new method.
MD3 introduces an additional wrinkles: it has per-frame-per-vertex data in addition to the usual per-vertex data. The VBO really contains two separate arrays of different structs (both before and after this commit).
shaderVertex_t is the type used for vertex data which is generated and uploaded to the GPU on every frame. The motivation behind getting rid of the half floats is to run on graphics backends that don't support half float vertex data. I assume there is not much benefit to using half floats here: normally you would use them to save memory in data which is stored long-term. But with shaderVertex_t we're only uploading a few thousand verts each frame and then throwing them away. Though systems that aren't able to run all skeletal models on the GPU could be an exception as they have to additionally upload a lot of model verts each frame. GL_ARB_half_float_vertex is now an optional extension.
4b8566e
to
1559054
Compare
Choose vertex attribute layouts at runtime. For attributes designated as wanting half float, use half float if GL_ARB_half_float_vertex is available or full-sized float otherwise, #1179 explains the situation in detail.
TODO: grab the commit adding a workaround for the cards that support the half float vertex extension, but with poor quality of implementation.
The first 4 commits are from #1341.