Re: [AD] Primitives (DirectX) legacy check broken

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


That seems reasonable. I have two comments. First, you could get away with just one legacy_buffer for both cases, if you store the size of the buffer in bytes instead of number of vertices... i.e:

size_t needed_size = num_needed_vertices * sizeof(ALLEGRO_VERTEX);
if(legacy_buffer == 0) {
   legacy_buffer = al_malloc(needed_size);
   legacy_buffer_size = needed_size;
} else if (needed_size > legacy_buffer_size) {
   size_t new_size = needed_size * 1.5;
   legacy_buffer = al_realloc(legacy_buffer, new_size);
   legacy_buffer_size = new_size;
}

Just seems a little cleaner this way.

Also, when there's no loop and no indices, then you could just do an early return with the passed 'vtx' buffer, since there's no vertex conversion going on.

-SL


On 07/27/2014 11:45 AM, Trent Gamblin wrote:
Attached a patch that does that and whatever other little things needed.
If you have time, check it out.

Trent

----- Original Message ----- From: "SiegeLordEx" <slabode@xxxxxxxxxx>
To: <alleg-developers@xxxxxxxxxx>
Sent: Sunday, July 27, 2014 8:43 AM
Subject: Re: [AD] Primitives (DirectX) legacy check broken


Alternatively, one could do what is done by the core: change the legacy
vertex format if a programmable pipeline is used. This should be a lot
simpler than changing the shader, I suppose.

-SL


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds








Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/