KOS Vram Usage

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
PH3NOM
DC Developer
DC Developer
Posts: 576
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

KOS Vram Usage

Post by PH3NOM »

Whats up guys?

As my game has been increasing in size and complexity, I have been finding more ways to squeeze out performance of the system.

Recently, I realized that I had gotten to the point where I was sending more vertices than my pvr vertex buffer could support, and needed to increase the Vertex Buffer Size on PVR initialization.

Problem is, once I did that, I ran out of texture memory, and was afraid I would have to decrease textures quality to get everything to fit.

But first, I started digging around in KOS to look at how the Vertex Buffers were allocated, and I noticed a few questionable comments:
on pvr_buffers.c:
Line 234:

Code: Select all

        outaddr += buf->opb_size;   /* Do we _really_ need this twice? */
So I simple commented that line out

and Line 245:

Code: Select all

        /* XXX What the heck is this 0x50580 magic value?? All I
           remember about it is that removing it makes it fail. */
        buf->opb_size = 0x50580 + polybuf;
I made some testing an arrived at

Code: Select all

        buf->opb_size = 0x14160 + polybuf;
On a default pvr_init_defaults, the original code gives us 4,626,688 bytes of Texture Memory Available.
With my new changes to pvr_buffers.c, pvr_init_defaults gives us 5,855,232 bytes of Texture Memory Available.

With this change, I was able to increase my Vertex Buffer size, without having to sacrifice Texture Quality.

Just posting this so see if I am missing something here, I have ran many tests on real hardware, and I can see no adverse effects, only more VRAM available.
These users thanked the author PH3NOM for the post:
BB Hood
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: KOS Vram Usage

Post by bogglez »

I noticed the same but I was unable to find out why it was put there by reading documents so I didn't spread this information yet. That said I also haven't found any issues yet.
It seems like there is some kind of triple buffering going on but not enabled? There is also quite a lot of dead dma code, so I think it might be safe to remove.
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
Post Reply