[Piglit] [PATCH] attribs: new generic extendable test for immediate-mode style commands
Marek Olšák
maraeo at gmail.com
Tue Nov 13 05:57:29 PST 2012
On Tue, Nov 13, 2012 at 2:02 AM, Eric Anholt <eric at anholt.net> wrote:
> Marek Olšák <maraeo at gmail.com> writes:
>
>> This covers some commands from GL2, GL3 (glVertexAttribI*)
>> and GL_ARB_vertex_type_2_10_10_10_rev.
>>
>> Vertex arrays, immediate mode and display lists are tested.
>>
>> Adding test cases for GL_ARB_vertex_attrib_64bit should be easy.
>
> I haven't actually reviewed all the code. The DEFINE_TEST stuff looks
> pretty messy, but I don't have any concrete suggestions for
> improvements.
>
>> +static GLboolean test(int x, int y, const char *shaderfunc,
>> + unsigned mask, unsigned type, unsigned mode,
>> + void (*attrib)(float x, float y, float z, float w),
>> + const char *info)
>> +{
>> + static const char *templ = {
>> + "%s \n"
>> + "#extension GL_ARB_explicit_attrib_location : require \n"
>> + "layout(location = 1) in %s attr; \n"
>> + "void main() { \n"
>> + " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
>> + " gl_FrontColor = (%s) * vec4(1.0, 1.0, 1.0, 0.5); \n"
>> + "} \n"
>> + };
>
> For others reviewing this code, I was surprised to see this was how
> integer was tested:
>
> DEFINE_TEST(glVertexAttribI4ui,, (1, UI(x), UI(y), UI(z), UI(w)),
> "vec4(attr) * vec4(1.0/4294967295.0)", RGBA, UINT, "")
Yeah, it got a bit messy. I wanted something that would allow me to
define a test for an attrib function on a few lines and I think the
result scales very well. Only the 2_10_10_10 tests got pretty messy,
all the other tests are really simple like this one. The first line
converts floats to uints and the second line contains the GLSL snippet
for converting uints back to floats.
Marek
More information about the Piglit
mailing list