https://bugs.winehq.org/show_bug.cgi?id=39057
swswine@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #52722|0 |1 is obsolete| | Attachment #52747|0 |1 is obsolete| |
--- Comment #33 from swswine@gmail.com --- Created attachment 52816 --> https://bugs.winehq.org/attachment.cgi?id=52816 Patch to implement indexed vertex blending (updated), wine 1.8-rc1
I updated the patch. The changes are:
1. Reporting capabilities MaxVertexBlendMatrices is always 4. MaxVertexBlendMatrixIndex is 255 if ARB_UNIFORM_BUFFER is supported, 0 otherwise.
2. Actual IVB support If ARB_UNIFORM_BUFFER is supported (opengl 3.1+), UBOs are used to store matrices for IVB. UBO is declared in shader and created only if IVB is requested by application. If ARB_UNIFORM_BUFFER is not supported, it still tries to support IVB if actually requested by application. In this case (and only in this) it works the same way as my initial patch by transferring matrices through plain uniforms. It does not affect vertex blending without indexes (only 4 matrices is declared if IVB is not requested by SetRenderState(... D3DRS_INDEXEDVERTEXBLENDENABLE). The existing functionality should not be affected so far.
3. Finer uniforms update granularity Patch adds mask to context which gets bits indicating which world matrices were updated. Besides, the "update version" number is stored for these updates. When processing uniforms updates for shader the mask is checked: only changed matrices are updated. This also relates to vertex blending without indexes.
UBO is updated only if the update version in context was not processed yet (this eliminates redundant updates of UBO when processing uniform updates for multiple shaders). Maybe it would be more straightforward to link UBO update to some other place rather than glsl shader backend, but till now I did not find a better place with relevant update infrastructure.
While this reduces some of redundant updates, there is still quite a lot of them as shader gets view*model matrices. So when view matrix is updated all the matrices have to be updated also. This cannot be reduced any further if not to move raw model matrices into the shader instead of view*model. But I think it is not a good idea for general case as there will be extra mat4*vec4 multiplication in shader for every vertex in IVB.
If IVB is not requested by application then no UBO or extra matrices are defined or transferred.
4. Conformance test for IVB was added. It tests IVB support in 3 modes (software, hardware and mixed vertex processing). If MaxVertexBlendMatrixIndex < 7 or MaxVertexBlendMatrices < 4 then the test for the mode is skipped.