Skip to content

GL_ARB_gpu_shader_fp64, GL_ARB_gpu_shader_fp64: Test in/out variables

Danylo Piliaiev requested to merge GL/piglit:tests/generated/64bit-in-out into master

The types from these two extensions lacked tests for in/out variables.

Mesa doesn't handle them well at the moment which I'm trying to address in mesa!2332 (closed)

Example of generated test:
[require]
GLSL >= 1.50
GL_ARB_gpu_shader_int64

[vertex shader]
#extension GL_ARB_gpu_shader_int64: require
#extension GL_ARB_shader_bit_encoding: enable
#extension GL_ARB_gpu_shader5: enable

precision highp float;

struct S1 {
    float[3]        f1;
    i64vec3         iv1;
};

flat out S1         s1_1;

in vec4 piglit_vertex;

#if defined(GL_ARB_shader_bit_encoding) || defined(GL_ARB_gpu_shader5) || __VERSION__ >= 430
float float_get(float f, uint bits) { return uintBitsToFloat(bits); }
#else
float float_get(float f, uint bits) { return f; }
#endif

void main()
{
    s1_1.f1[0] = float_get(21749.8434577, 0x46a9ebb0u);
    s1_1.f1[1] = float_get(21749.8439612, 0x46a9ebb0u);
    s1_1.f1[2] = float_get(21749.8444648, 0x46a9ebb0u);
    s1_1.iv1.x = 1432970152;
    s1_1.iv1.y = 1636374283;
    s1_1.iv1.z = 1839778414;

    gl_Position = piglit_vertex;
}

[fragment shader]
#extension GL_ARB_gpu_shader_int64: require
#extension GL_ARB_shader_bit_encoding: enable
#extension GL_ARB_gpu_shader5: enable

precision highp float;

struct S1 {
    float[3]        f1;
    i64vec3         iv1;
};

flat in S1          s1_1;

out vec4 piglit_fragcolor;

#if defined(GL_ARB_shader_bit_encoding) || defined(GL_ARB_gpu_shader5) || __VERSION__ >= 430
bool float_match(float u, float f, uint bits) { return floatBitsToUint(u) == bits; }
#else
bool float_match(float u, float f, uint bits) { return u == f; }
#endif

void main()
{
    bool pass = true;

    if (!float_match(s1_1.f1[0], 21749.8434577, 0x46a9ebb0u))
        pass = false;
    if (!float_match(s1_1.f1[1], 21749.8439612, 0x46a9ebb0u))
        pass = false;
    if (!float_match(s1_1.f1[2], 21749.8444648, 0x46a9ebb0u))
        pass = false;
    if (s1_1.iv1.x != 1432970152)
        pass = false;
    if (s1_1.iv1.y != 1636374283)
        pass = false;
    if (s1_1.iv1.z != 1839778414)
        pass = false;

    piglit_fragcolor = pass ? vec4(0, 1, 0, 1) : vec4(1, 0, 0, 1);
}

[test]
link success

draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0

CC: @tarceri

Merge request reports

Loading