clutmode, clutload & sync

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
yoyofr
Posts: 23
Joined: Sat Jun 25, 2005 7:08 pm
Location: paris
Contact:

clutmode, clutload & sync

Post by yoyofr »

I'm having some color palette update issues....

I'm working in 5551 color mode, with 8bits texture, using replace mode & alpha.
I'm rendering sprites & have to switch the palette multiple times. Moreover some entries in my palette are transparent (|=0x8000).
Sometimes it seems the alpha isn't used in the rendering, so I guess it's a problem of palette updates.

Here's how it works basically :

1st rendering of n sprites :
copy master palette in a my working palette (using non cacheable addresses with |=0x40000000)
patch some entries with a OR 0x8000 (this entries will be transparent)
call sceGuClutLoad to load my patched palette
do the actual rendering
2nd rendering of m sprites :
same as before, but patching other entries
3rd,....

I've usually less than 10 steps in gu list.
Most of the time it works well, but sometimes I see the sprites pixels
which should be transparent.
Moreover it happens on static data! I mean I render the same screen
with the same list & sometimes it looks like the palette isn't loaded correctly.

Any idea of a potential sync issue when loading multiple palettes in the same rendering pass (in the same gu list) ?
ector
Posts: 195
Joined: Thu May 12, 2005 10:22 pm

Post by ector »

is the pointer you use to patch the entries noncachable?
yoyofr
Posts: 23
Joined: Sat Jun 25, 2005 7:08 pm
Location: paris
Contact:

Post by yoyofr »

(using non cacheable addresses with |=0x40000000)
yes, it is.....

I guess it could help to know if psp support multiple palette (it seems to be the case) and how much...
Nobody's ever heard of a multiple clut mode ?

from my point of view, after looking again & again at the rendering, using
vsync on/off, speed limiter, 222Mhz-333Mhz, it looks like after n rendering
the clut isn't properly loaded.
I mean for testing, the data I'm drawing are always the same, the palette
too. I'm using non cacheable addresses (tried without |=0x40000000 and calling sceKernelDcacheWritebackAll(); instead) and most of the time
everything is ok, but some frames are drawn with opaque pixels.
I'm not changing the alpha_test or other stuff.
The setup remains the same, the pixels/textures data too, vertices too,...
The only thing is I'm calling multiple times sceguclutload...
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

try inserting sceGuTexSync() or sceGuTexFlush() after setting the texture and see if it helps.
GE Dominator
yoyofr
Posts: 23
Joined: Sat Jun 25, 2005 7:08 pm
Location: paris
Contact:

Post by yoyofr »

thx for the help, but I fixed the bug in the meantime.
the issue was in the way I proceeded :
1/ load new palette (fast)
2/ init my vertices (slow) & update texture
3/ load texture & render
and then 1/ 2/ 3/ again

I changed it to
1/ init vertices & update texture
2/ load texture
3/ load new paletet & render

with this it seems to be ok!
Post Reply