View Full Version : Precision loss with dvec3

08-13-2015, 04:50 AM
I've been having problems with dvec3 in my compute shader. I'm recieving a position from my ssbo, alongside other data.

#version 430

struct aVec4 {
double x, y, z, w;

struct Vertex {
aVec4 position;
aVec4 velocity;
double depth;

struct Triangle {
Vertex v[3];
aVec4 normal;

layout( std430, binding = 0 ) buffer abc { Triangle triangle[]; };

Then I use the position in a dvec3 to perform vector operations. The problem is that somewhere along the way i loose the double precision. If a look at the position at the beginning I get the correct value which makes me think that it is handled correctly, but after some calculations (that doesn't affect the position variable) the precision is lost. I had the same problem for constants previously but that was solved with the LF suffix.