Cxbx-reloaded: Reimplement drawing indexed quads

Created on 14 Oct 2019  路  4Comments  路  Source: Cxbx-Reloaded/Cxbx-Reloaded

Currently, drawing indexed quads is implemented by doing a draw call for each quad (drawing two triangles instead). This was done to avoid a conversion of the index buffer, but has as downside being very slow.

Therefore, re-implement this draw type, by converting the index buffer, so that quads are approximated by triangles.

This requires an index buffer cache, otherwise the above mentioned slowdown would still be present, but then caused by repeated conversions of index buffers.

HLE graphics high-priority performance

Most helpful comment

For some games, this change will be enough to increase them from snail-speed (1-8fps) to fully playable: so it is quite important.

All 4 comments

Note, that approximating quads with triangles produces slightly distorted rendering - see here for one such case (and the solution) : https://www.reddit.com/r/emulation/comments/78azl5/quadrangles/
(http://reedbeta.com/blog/quadrilateral-interpolation-part-2/ )

For some games, this change will be enough to increase them from snail-speed (1-8fps) to fully playable: so it is quite important.

All related code can be found by searching for X_D3DPT_QUADLIST in draw-functions. This results in four functions;
The ones in D3DDevice_DrawVertices and CxbxDrawPrimitiveUP are already optimized (they draw quadlists using a single 'quad-to-triangle mapping' index buffer).
The ones that need to be refactored are : D3DDevice_DrawIndexedVerticesUP and CxbxDrawIndexed.

Fixed by PR #1757

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PatrickvL picture PatrickvL  路  31Comments

blueshogun96 picture blueshogun96  路  36Comments

RadWolfie picture RadWolfie  路  19Comments

PatrickvL picture PatrickvL  路  19Comments

jarupxx picture jarupxx  路  20Comments