SFML community forums

Help => Graphics => Topic started by: tomvidm on July 17, 2018, 01:59:02 pm

Title: A question about Transforms sent in a states structuer
Post by: tomvidm on July 17, 2018, 01:59:02 pm
As I understand, when calling draw with a transform in the RenderStates structure, the transform is applied on the GPU. Is this true?

I want to benchmark the point where large number of draw calls breaks even with a large number of transforms applied on individual vertices of a VertexBuffer with a single draw call. Knowing where the transform is performed will help me understand what is going on.
Title: Re: A question about Transforms sent in a states structuer
Post by: Laurent on July 17, 2018, 02:53:40 pm
Yes, transforms are usually always applied on the GPU. The only case where they are applied on the CPU is a questionable optimization hidden in SFML (https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderTarget.cpp#L265-L277).

Quote
I want to benchmark the point where large number of draw calls breaks even with a large number of transforms applied on individual vertices of a VertexBuffer with a single draw call.
What does "break" mean, and how do you know it has anything to do with transforms?
Title: Re: A question about Transforms sent in a states structuer
Post by: tomvidm on July 17, 2018, 03:36:28 pm
Thanks for the answer.

I explained myself poorly. Considering that the draw call itself is a relatively slow operation for sprites, I want to implement sprites using the VertexBuffer class, to measure the difference between:
N draw call for individual sprites with transforms being left as work for the GPU
At most 4*N transforms on the CPU and one draw call

I am disregarding culling of any kind here. I just want to make a comparison between the two cases
Title: Re: A question about Transforms sent in a states structuer
Post by: Laurent on July 17, 2018, 03:39:32 pm
Quote
N draw call for individual sprites with transforms being left as work for the GPU
These transforms will probably happen on the CPU because of the optimization I mentioned above.
Title: Re: A question about Transforms sent in a states structuer
Post by: tomvidm on July 17, 2018, 03:47:40 pm
Thank you for pointing the way and clearing up a misconception I had.