On Mon, Aug 17, 2015 at 9:32 PM, Trent Gamblin <[email protected]> wrote:

> Currently when batched drawing is enabled, vertices are transformed by the
> current transformation. See ogl_bitmap.c:272.
>
> I'm wondering about this. Can't figure out why this is so by looking at
> the code (I haven't yet looked too deeply...)
>
>
The reason is, if you do something like:

draw bitmap A
rotate 90 degree
draw bitmap B

Then if you do not use batched drawing, A will not be rotated but B will
be. If you use batched drawing, we want the same, but we can't let the
shader apply a single transformation at the end anymore because at the time
we draw everything we don't know what the transformation was when drawing
each bitmap - therefore we have to pre-transform on the CPU.


> The reason I'm asking is I'm trying to optimize for a very slow system
> (Raspberry Pi) and drawing a screenful of tiles results in a large number
> of transformations which is quite slow, at least it's near the very top of
> my gprof data.
>
> Any idea as to how to optimize this would be appreciated.
>
> Thanks.
>


I suppose we could add a better detection for translation-only
transformations (maybe maintain a flag as long as a transformation is just
a translation). Then transform_vertex could check for that flag and in that
case simply add the translation but not do a full matrix multiplication.

Hard to say how much it would help - if all the extra function calls are
the problem and not the matrix multiplications I don't have any idea how to
speed it up.
_______________________________________________
Allegro-developers mailing list
[email protected]
https://mail.gna.org/listinfo/allegro-developers

Reply via email to