Markus Wick <[email protected]> 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 change. -- [email protected]
pgp7WesCuSR95.pgp
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
