[Piglit] [PATCH] arb_uniform_buffer_object: Exercise coherent fragment shader UBO.
Jose Fonseca
jfonseca at vmware.com
Wed Feb 18 06:45:56 PST 2015
On 18/02/15 14:43, Roland Scheidegger wrote:
> Am 05.02.2015 um 15:37 schrieb Jose Fonseca:
>> At least for software renderers (like llvmpipe and softpipe), the vertex
>> and fragment shader stage are very different.
>>
>> Achieve this by moving the color uniform to the fragment shader stage.
>> ---
>> tests/spec/arb_uniform_buffer_object/bufferstorage.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/spec/arb_uniform_buffer_object/bufferstorage.c b/tests/spec/arb_uniform_buffer_object/bufferstorage.c
>> index 334fd4e..52e20e0 100644
>> --- a/tests/spec/arb_uniform_buffer_object/bufferstorage.c
>> +++ b/tests/spec/arb_uniform_buffer_object/bufferstorage.c
>> @@ -43,7 +43,6 @@ static const char vert_shader_text[] =
>> "\n"
>> "layout(std140) uniform;\n"
>> "uniform ub_pos_size { vec2 pos; float size; };\n"
>> - "uniform ub_color { vec4 color; float color_scale; };\n"
>> "uniform ub_rot {float rotation; };\n"
>> "\n"
>> "void main()\n"
>> @@ -54,15 +53,17 @@ static const char vert_shader_text[] =
>> " m[1][0] = -m[0][1]; \n"
>> " gl_Position.xy = m * gl_Vertex.xy * vec2(size) + pos;\n"
>> " gl_Position.zw = vec2(0, 1);\n"
>> - " gl_FrontColor = color * color_scale;\n"
>> "}\n";
>>
>> static const char frag_shader_text[] =
>> "#extension GL_ARB_uniform_buffer_object : require\n"
>> "\n"
>> + "layout(std140) uniform;\n"
>> + "uniform ub_color { vec4 color; float color_scale; };\n"
>> + "\n"
>> "void main()\n"
>> "{\n"
>> - " gl_FragColor = gl_Color;\n"
>> + " gl_FragColor = color * color_scale;\n"
>> "}\n";
>>
>> #define NUM_SQUARES 4
>>
>
> This looks good to me, the test comment says though it's the same as
> rendering.c except for the persistent mapped ubos which is no longer
> quite true.
>
> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Thanks for the review. I'll update that comment to says it's "based" as
opposed to the "same" then. Another option would be to modify rendering
in a similar fashion.
Jose
More information about the Piglit
mailing list