Using frame buffer as a texture

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
MaikeruDev
Posts: 13
Joined: Mon Jul 16, 2007 3:09 am
Location: Poland
Contact:

Using frame buffer as a texture

Post by MaikeruDev »

I want use frame buffer as a texture for sprite (lower left corner of screen), but I noticed funny GS behavior:

Image

Screenshot is made in 3rd loop.

It also happens when I'm doing:
- local to local transmision of actual frame buffer in other place of GS memory
- local to host and after host to local in other place of GS mem.

I've tested 2nd method because I want to develop few 2D effects that modifies frame buffer (eg. blur, water effect, fire :) )

How to achieve exactly one copy of frame buffer and use it on the same frame?

EDIT:
Hmm... I forgot say what i'm really drawing on the one loop, so here it is:
- Full screen white sprite as background
- 2 triangles
- Sprite with copied actual frame buffer
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

I don't really see a problem, it looks fine to me - what should I be looking for?
MaikeruDev
Posts: 13
Joined: Mon Jul 16, 2007 3:09 am
Location: Poland
Contact:

Post by MaikeruDev »

It should look like this:
Image
User avatar
jbit
Site Admin
Posts: 293
Joined: Sat May 28, 2005 3:11 am
Location: København, Danmark
Contact:

Post by jbit »

Well it looks like you're writing into the place you're reading from..... In which case this is the correct output....
The black box in the bottom left I guess is because of cache issues (it looks to be able a page big ;)
MaikeruDev
Posts: 13
Joined: Mon Jul 16, 2007 3:09 am
Location: Poland
Contact:

Post by MaikeruDev »

Probarly You have right. It looks like I was reading from previous cached frame buffer - not actual. This black box is frame buffer of ps2link. In first iteration theres only two triangles with big black box.

Thanks
MaikeruDev
Posts: 13
Joined: Mon Jul 16, 2007 3:09 am
Location: Poland
Contact:

Post by MaikeruDev »

After few days of testing other stuff, I found what was wrong. I just used previous buffer instead of actual, so it wasn't caching or something like that - it was my mistake :).

I wrote something like motion-blur, here is a screenshot:
Image

What my code do in one frame:
- draws white background
- draws one big triangle
- downloads actual frame buffer
- modifies buffer in RAM
- upload buffer from RAM to GS mem in place of actual frame buffer
- draws another triangle (a small one with alpha)
- download actual frame buffer
- save bitmap
Post Reply