sq_cpy and pvr_scene_begin_txr

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
bogglez
Moderator
Moderator
Posts: 578
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

sq_cpy and pvr_scene_begin_txr

Post by bogglez »

Two quick questions:

- Why is the src argument in void * sq_cpy(void *dest, void *src, int n) not const? Can sq_cpy change src?
- Why does void pvr_scene_begin_txr(pvr_ptr_t txr, uint32 *rx, uint32 *ry) take pointers as arguments? Is something written back to them? I assumed by value passing at first.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5658
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: sq_cpy and pvr_scene_begin_txr

Post by BlueCrab »

bogglez wrote:Two quick questions:

- Why is the src argument in void * sq_cpy(void *dest, void *src, int n) not const? Can sq_cpy change src?
No, it can not. It should be const, but it was traditionally not so. I'll probably change that at some point (as well as making n a size_t instead of an int, since it should never be negative), but as I said, that is not how it was originally written for whatever reason.
- Why does void pvr_scene_begin_txr(pvr_ptr_t txr, uint32 *rx, uint32 *ry) take pointers as arguments? Is something written back to them? I assumed by value passing at first.
At the moment, no, nothing is written back to them. They should contain the values of the width and height of the texture passed in (and pretty much currently must be 1024 and at least 512 respectively).
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: sq_cpy and pvr_scene_begin_txr

Post by PH3NOM »

BlueCrab wrote:
bogglez wrote:Two quick questions:

- Why is the src argument in void * sq_cpy(void *dest, void *src, int n) not const? Can sq_cpy change src?
No, it can not. It should be const, but it was traditionally not so. I'll probably change that at some point (as well as making n a size_t instead of an int, since it should never be negative), but as I said, that is not how it was originally written for whatever reason.
As it really should be a cont pointer, I went ahead and made that change in the repo today when adding some kgl stuff.
Git the latest commit to check things out.
Post Reply