3 ms·
Mmmh there is rather an easy way to get that bug due to float precision is when the vertice positions are the result of some maths. Then two vertices which shou
by quadcore 4y ago
Mmmh there is rather an easy way to get that bug due to float precision is when the vertice positions are the result of some maths. Then two vertices which should be mathematically at the same position will end up not being exactly at the same position in practice due to float precision. Only ways to have two vertices at the exact same position is either hardcoding it, assigning the position of one to the other or using index buffers.
An easy thing to miss.
- cobertos 4y agoThat wouldn't be a problem in this case though? The vertices of 2 fullscreen triangles can be passed to the GPU using hardcoded values without any precision error (integers below a certain value can be represented precisely using floats).
- josefx 4y agoThat wouldn't be a problem as long as the vertex positions go through exactly the same transformations, as that ends with them accumulating the same rounding errors. Assuming that nobody was messing with floating point rounding behavior at runtime or flat out decided to enable fast-math and live with the resulting mess.
- amelius 4y agoIt doesn't make sense to use floating point for coordinates because it makes points near the origin have more precision than other points.
- londons_explore 4y agoNearly everything done with floating point would be better done another way... But the reality is that floating point numbers 'just work' for a huge number of things, and the space and compute inefficiency is small enough to not worry about.
- amelius 4y agoYeah, but we're talking about GPUs here, which are still evolving.