3 ms·
GPUs don't have dedicated matrix hardware anymore, making it questionable whether you really need to convert your GA structures to matrices first. [1] finds th
by earenndil 7y ago
GPUs don't have dedicated matrix hardware anymore, making it questionable whether you really need to convert your GA structures to matrices first. [1] finds that quaternions are faster than matrices on modern hardware; I find that questionable, but it at least shows that they are comparable.
1: https://tech.metail.com/performance-quaternions-gpu/ https://tech.metail.com/performance-quaternions-gpu/
- dahart 7y agoThe APIs (D3D, etc.) do use matrices, and that's all that matters from the point of view of an engine developer. Composing quats together is certainly faster than composing matrices, but quats are limited (no translation / skew / perspectivce / etc.), so there is no direct apples-to-apples comparison between quats and mats.
- earenndil 7y agoThey let you upload matrix data to the gpu, but all functions like glUniformMatrix4fv() really do is upload a 16-vector into gpu memory (and optionally reshuffle its layout). The shading languages also have matrix primitives, that's just sugar.
- Const-me 7y ago> The APIs (D3D, etc.) do use matrices D3D API exposes a way to pass constant buffers to shaders. You can pass whatever you want there, even integers. There're couple limitations, size must be multiple of 16 bytes, and can't exceed 64kb, but I don't remember anything specific to matrices. Now, the only place I can remember which specifically targets matrices - mul intrinsic in HLSL. But that thing is just a syntactic sugar, usually compiling into dp4 dxbc instructions.