Loading textures and Allocating memory

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
Newbie
Insane DCEmu
Insane DCEmu
Posts: 171
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sat Jul 27, 2013 1:16 pm
Has thanked: 0
Been thanked: 0

Loading textures and Allocating memory

Post by Newbie »

I have a doubt on two functions :

Allocation in the PVR :

Code: Select all

  pvr_ptr_t pvr_mem_malloc(size_t size);
Loading a texture in the PVR :

Code: Select all

  void pvr_txr_load(void * src, pvr_ptr_t dst, uint32 count);

The pvr_mem_malloc seems to use in size parameter the size of a texture in bytes.

The pvr_txr_load seems to use in count parameter the size of a texture in Uint16s.

Assuming we have a 8*8 pixel squared texture :

we must use pvr_mem_malloc with size = 8*8*2 bytes and pvr_txr_load with count = 8*8

Is that correct ?

Thanks for help.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5660
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Loading textures and Allocating memory

Post by BlueCrab »

The count of pvr_txr_load() is in bytes. See the documentation here.

pvr_txr_load() pretty much simply calls on sq_cpy(), which also is just a byte copy with the store queues (although, the number of bytes passed into it must be divisible by 32). So, the same applies to pvr_txr_load(), the count must be divisible by 32. If you want to copy a smaller amount than that for some reason (there shouldn't be much reason to, since the smallest texture size supported by the PVR is 8x8 anyway), you can just use a regular memcpy, as the pointer returned from pvr_mem_malloc() is completely valid to access in that manner.
Post Reply