What I want to do is copy glyph sprites from a glyph texture (currently in system ram) to a glyph cache buffer in vram, where I build up a string, which I afterwards can draw on screen with only one texture and one sprite primitive.
That's no problem so far, but my glyph texture is a 4bit paletted texture and that's where the problem starts:
My first stupid attempt of using sceGuCopyImage(GU_PSM_T4,...) would create a wide-spread pixel mess in my glyph cache only, so I knew there was some problem with the strides or something simlar. Finally I found out in the gu documentation in SDK, that sceGuCopyImage seems to only be able to handle 16 and 32bit image transfers and that is a real pain now.
I then transformed my strides and source and dest positions so that it would correctly copy the bits like this:
Code: Select all
sceGuCopyImage(GU_PSM_4444,sx/4,sy,sw,sh,256/4,g_font_tex[g_cur_font],dx/4,dy,512/4,(void*)(g_glyph_cache));
I cannot jump to the correct dest address by adding the dx offset myself, as this would generate a non-16-byte aligned pointer and crash the program.
Well I could create my glyph cache in system ram also and use CPU memcopys for the transfer and only upload the final cache image, but that's a quite dirty workaround.
My next idea now would be to render the glyphs by doing a render to texture for each, but is it even possible to render to a GU_PSM_T4 texture or would I then need to use at least a 16bit texture?
Or better: Is there any way to bypass the >=16bit limitation of sceGuCopyImage and allow it to handle 4 and 8bit copys?
Thanks for any help!
PS: Someone should update the comments in the pspgu.h for sceGuCopyImage that it only works correctly with 16 and 32bit PSM's.