 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 3:10 am Post subject: textures, blitting, array in VRAM, and etc... |
|
|
hello, everyone.
i have some few questions.
1st: i tried to programmed some tests, few models from maya with one texture coded to 5650 or 4444 16 bit - just for test.
now i coded own convertor for textures from 4bit indexed and 16bit palette 5650 up to 32b 8888 format. Tester for 8kb cache (if converted texture will be equal or less than 8kb), swizzler and etc..... (any improvments?)
BUT, in ogl i had a managment of textures, that could bind any texture. I used
glBindTexture(GL_TEXTURE_2D, texture_id);
is this command(s) equal?
sceGuTexMode(GU_PSM_5650,0,0,0); //propably needed?
sceGuTexImage(0,128,128,128,texture_data);
if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest);
is palette of indexed texure possible to load to vram too?
2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
i am using model with indexes:
sceGumDrawArray (GU_TRIANGLES, GU_TEXTURE_8BIT|GU_COLOR_4444|GU_VERTEX_32BITF|GU_TRANSFORM_3D|GU_INDEX_16BIT, 8172, model_i_start, model_start);
this components are for max mem saving:
GU_TEXTURE_8BIT
GU_COLOR_4444
GU_VERTEX_32BITF
GU_INDEX_16BIT
i tried to reduce it more, but it was little bit unnatural. could it be reduced more? why in the hell, there's no GU_VERTEX_16BITF? in a lot of models, it should be enought
PS: sorry for my terrible english ;-) _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
holger
Joined: 18 Aug 2005 Posts: 204
|
Posted: Thu Oct 13, 2005 3:23 am Post subject: |
|
|
| Use pspgl if you want access the GE using OpenGL semantics. Prefer the SVN version if you provide your data in PSP native format, or Jeremy's tree if you want to let the library handle the texture and vertex format conversion. |
|
| Back to top |
|
 |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 3:31 am Post subject: |
|
|
| holger wrote: | | Use pspgl if you want access the GE using OpenGL semantics. Prefer the SVN version if you provide your data in PSP native format, or Jeremy's tree if you want to let the library handle the texture and vertex format conversion. |
dont wanna use pspgl, just tring to find native equivalent.
SVN version or Jeremy's tree? gee, i want to do it by myself :) that's why I am asking :) _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 13, 2005 3:31 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
| outtony wrote: | BUT, in ogl i had a managment of textures, that could bind any texture. I used
glBindTexture(GL_TEXTURE_2D, texture_id); |
Have a look at PSPGL (http://www.goop.org/psp/gl/).
LibGU is lower level than GL, and does no texture management for you.
| Quote: |
sceGuTexMode(GU_PSM_5650,0,0,0); //propably needed?
sceGuTexImage(0,128,128,128,texture_data);
if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest); |
Yep, that's basically right. You need to make sure the texture has been flushed out of the CPU cache if you've modified it.
| Quote: | | is palette of indexed texure possible to load to vram too? |
Yep.
| Quote: | 2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
i am using model with indexes:
sceGumDrawArray (GU_TRIANGLES, GU_TEXTURE_8BIT|GU_COLOR_4444|GU_VERTEX_32BITF|GU_TRANSFORM_3D|GU_INDEX_16BIT, 8172, model_i_start, model_start);
this components are for max mem saving:
GU_TEXTURE_8BIT
GU_COLOR_4444
GU_VERTEX_32BITF
GU_INDEX_16BIT
i tried to reduce it more, but it was little bit unnatural. could it be reduced more? why in the hell, there's no GU_VERTEX_16BITF? in a lot of models, it should be enought |
You can use GU_VERTEX_16BIT, which is integral, so you need to scale everything by 32767. You can use the model matrix to scale your model down to the size you actually want.
Similarly, 8-bit texture coords are integral, so you need to use the texture matrix to scale them to the 0..1 range for texture coords (which I haven't had much success with), or change the texture scaling (using sceGuTexScale).
If you're new to the PSP, then the big gotcha is cache management. PSPGL handles all this for you, but otherwise see http://www.goop.org/psp/cache-howto.html. |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 13, 2005 3:39 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
| outtony wrote: | if i want to put texture to vram (in ogl automatically, if vram was free enought), i have to use
void sceGuCopyImage(int psm, int sx, int sy, int width, int height, int srcw, void* src, int dx, int dy, int destw, void* dest);
and then dest is a pointer to data, so i should call:
sceGuTexMode(GU_PSM_5650,0,0,0);
sceGuTexImage(0,128,128,128,dest); |
Oh, one other thing. After the copy, you'll need:
| Code: | sceGuTexSync(); // make sure the copy finishes before starting to use it
sceGuTexFlush(); // clear the previous texture out of the GE texture cache
|
When you're switching between textures which are already VRAM resident, you just need the sceGuTexFlush. |
|
| Back to top |
|
 |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 4:12 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
i am looking for psp native replacement, or some way to code it
| Quote: | | is palette of indexed texure possible to load to vram too? |
>Yep.
how?
| Quote: | 2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
|
that link is about cache, not about vram _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 13, 2005 4:22 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
| outtony wrote: |
i am looking for psp native replacement, or some way to code it
|
Well, the code for PSPGL is full of useful stuff.
| Quote: | | Quote: | | is palette of indexed texure possible to load to vram too? |
>Yep.
how? |
Copy it there and point to it. VRAM is directly accessable to the CPU; its just memory as far as software is concerned. sceGeEdramGetAddr() returns a pointer to the start.
| Quote: | | Quote: | | 2nd: HOW can I in hell put vertices and other stuff in array to VRAM? |
that link is about cache, not about vram |
Right. VRAM is just memory, so you can copy your vertex data there. But it's cachable, so you need to make sure you've flushed it. |
|
| Back to top |
|
 |
holger
Joined: 18 Aug 2005 Posts: 204
|
Posted: Thu Oct 13, 2005 4:24 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
| outtony wrote: |
i am looking for psp native replacement, or some way to code it
|
pspgl is native... what did you believed the 'psp' stands for? ;)
| outtony wrote: | | Quote: | | is palette of indexed texure possible to load to vram too? |
>Yep.
how?
| Quote: | 2nd: HOW can I in hell put vertices and other stuff in array to VRAM?
|
|
use sceGuCopyImage, you can also copy vertex data using these calls (pass stride and buffer width so that your data is continously transferred). Alternatively you can also access the DMAC directly or use memcpy, if you don't care about CPU load. |
|
| Back to top |
|
 |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 4:28 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
oh, that's truth :) _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 4:31 am Post subject: Re: textures, blitting, array in VRAM, and etc... |
|
|
| holger wrote: |
pspgl is native... what did you believed the 'psp' stands for? ;)
|
yp, and that "native" gl doesnt support a lot of stuff (at the moment)
for ex. sprites primitive or vertex weights... _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
holger
Joined: 18 Aug 2005 Posts: 204
|
Posted: Thu Oct 13, 2005 4:33 am Post subject: |
|
|
| please take a closer look, Jeremy's tree has them incorporated as extensions. More are not too hard to add. |
|
| Back to top |
|
 |
outtony

Joined: 13 Oct 2005 Posts: 26 Location: Slovakia
|
Posted: Thu Oct 13, 2005 4:35 am Post subject: |
|
|
| holger wrote: | | please take a closer look, Jeremy's tree has them incorporated as extensions. More are not too hard to add. |
I can't google any information about it. Could you please tell me, where can I find any informations? thank you ;-) _________________ -----------------------------
Tony
www.n3.sk |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 13, 2005 7:55 am Post subject: |
|
|
| outtony wrote: | | holger wrote: | | please take a closer look, Jeremy's tree has them incorporated as extensions. More are not too hard to add. |
I can't google any information about it. Could you please tell me, where can I find any informations? thank you ;-) |
I don't currently have a vertex weight extension that I like yet, but I did just implement Bezier patch surfaces...
Sprites are on my TODO list, but they're trivial to add (not interesting enough to get around to). |
|
| Back to top |
|
 |
dankydoo
Joined: 29 Mar 2005 Posts: 11
|
Posted: Thu Oct 13, 2005 8:08 am Post subject: |
|
|
Ahh, yes, I was hoping that you would implement Bezier patches soon....are they in your repository yet?
dankydoo |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Thu Oct 13, 2005 8:12 am Post subject: |
|
|
| dankydoo wrote: | | Ahh, yes, I was hoping that you would implement Bezier patches soon....are they in your repository yet? |
Soon, probably within a few hours. I want to clean things up a little bit and publish some demo binaries to show things off. Spot lighting+bezier surfaces looks really cool. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|