[PATCH 02/13] glamor: Add glamor_program based copy acceleration

Keith Packard keithp at keithp.com
Mon Jun 2 11:15:21 PDT 2014

Markus Wick <markus at selfnet.de> writes:

> Am 2014-05-06 00:02, schrieb Keith Packard:
>> +static const glamor_facet glamor_facet_copyplane = {
>> +    "copy_plane",
>> +    .version = 130,
>> +    .vs_vars = "attribute vec2 primitive;\n",
>> +    .vs_exec = (GLAMOR_POS(gl_Position, (primitive.xy))
>> +                "       fill_pos = (fill_offset + primitive.xy) /
>> fill_size;\n"),
>> +    .fs_exec = ("       uvec4 bits = uvec4(texture2D(sampler,
>> fill_pos) * bitmul + vec4(0.5,0.5,0.5,0.5));\n"
> I think
> uvec4(round(texture2D(sampler, fill_pos) * bitmul))
> is easier to read than to add 0.5. Honestly GLSL lacks rounding + 
> convertion functions :/

I've analysed the compiler output for both modes and they generate code
which should have identical performance on my machine. And, then I
measured the performance and it was, in fact, the same. So, we'll use
the round() version because it is clearer, and because some compiler may
actually be able to generate better code when the intent isn't obscured.

At the same time, I went and changed the type of the 'bitmul' uniform
From uvec4 to vec4. This eliminates a type conversion from int to float
when doing this multiply. Unsurprisingly, I was unable to detect any
performance difference, but it still seems like a good idea.

I haven't removed your Reviewed-by: line on the patch; let me know if
you have any concerns. I've updated my 'glamor-server' branch with this

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140602/311efae1/attachment.sig>

More information about the xorg-devel mailing list