yuq / mesa-lima

Deprecated, new place: https://gitlab.freedesktop.org/lima
https://github.com/yuq/mesa-lima/wiki
165 stars 18 forks source link

lima/gpir: support ge, floor, sign #42

Closed enunes closed 6 years ago

enunes commented 6 years ago

For the first patch, there is some discussion at: https://lists.freedesktop.org/archives/mesa-dev/2018-April/192317.html We may have to consider changing the handling of ints/floats as suggested there but as of now it already has one reviewed-by and no doubt it's a bug in the optimization path we're currently hitting.

I tested ge, floor, sign with gbm-surface and the following vertex shaders that insert the according nir op:

ge:

attribute vec3 positionIn;
void main()
{
    vec3 myvar = positionIn;
    if (positionIn.x >= positionIn.y)
        myvar.y = 0.8;
    gl_Position = vec4(myvar, 1);
}

floor:

attribute vec3 positionIn;
void main()
{
    vec3 myvar = positionIn;
    myvar.x += 0.1;
    myvar.y += 0.1;
    myvar.z += 0.1;
    gl_Position = vec4(floor(myvar.x), floor(myvar.y), floor(myvar.z), 1);
}

sign:

attribute vec3 positionIn;
void main()
{
    vec3 myvar = positionIn;
    myvar.x += 0.1;
    myvar.y += 0.1;
    gl_Position = vec4(sign(myvar.x), sign(myvar.y), myvar.z, 1);
}