Got compute shader below:
#version 430
layout(local_size_x = 1) in;
uniform float _M, _m;
layout(std430, binding = 40) writeonly buffer Buf
{
vec4 _value[5];
};
void main()
{
float ratio = _M / _m;
for (int i = 0; i < 5; ++i)
{
float p = float(i) * .5;
_value[i] = vec4(ratio, p, pow(ratio, p), 0);
}
}
Which run as:
glUniform1f(mm, 1);
glUniform1f(mM, 2);
glDispatchCompute(1, 1, 1);
Value for 2^.5 not correct. If “ratio” variable set in shader as 2., all correct. If power multiplied by .4 or .6 instead of .5, all correct.
I run it on gtx 760, driver 390.77, win7 x64
I run it on different machine with gtx750ti, driver 390.77, win7 x64, same results.
I run it on Intel hd4600, Samsung j7 2017 (with “#version 430” → “#version 310 es”), ATI Rx 460 - all correct.
On gtx750ti, in series of runs I got following values instead of correct one: 0 1 .5011 1 1 1 1 .0078 1 .5011 .6 .0078 1 1 .0078 0 1 1 .0078 1 .0078 0 0 1 1.0078 0 1 1 .0078 0 1 0.0078 1 .0078 0 0 .0078 1 0 1 1 0 .949 1 1 0 1 .0078 1 .1311 1 1 1 1 1 1 1 1 1 1 1 1 .949 0 1 1 1 .0078