This means that it's hard to use pre-multiplied alpha source fragments (since GU_SRC_ALPHA will re-multiply it with alpha again, giving alpha^2). Also, it make simple additive blending hard (simply summing the fragments rather than alpha blending them).
The only workaround I can see is to use GU_FIX and set the fixed color to 0xffffff, but there doesn't seem to be a way to set a fixed alpha channel.
Am I missing something here?
BTW, there seems to be a mistake in pspgu.h. GU_DST_COLOR is defined as 0, but that GU_SRC_COLOR. The DST factors are different from SRC factors; I suspect they should be something like:
Code: Select all
/* Blending Factor */
#define GU_SRC_COLOR (0)
#define GU_ONE_MINUS_SRC_COLOR (1)
#define GU_SRC_ALPHA (2)
#define GU_ONE_MINUS_SRC_ALPHA (3)
#define GU_DST_COLOR (4)
#define GU_ONE_MINUS_DST_COLOR (5)
#define GU_DST_ALPHA (6)
#define GU_ONE_MINUS_DST_ALPHA (7)
/* 8? */
/* 9? */
#define GU_FIX (10)
Hm, and I wonder if the source and destination factors have the same encoding? OpenGL specifies things this way, but there's no reason the hardware has to do it (especially since it doesn't seem to fully implement all possible OpenGL blending modes anyway).
It looks like the stencil buffer is stored in the framebuffer alpha channel, which suggests that you either get destination alpha blending or a stencil buffer. (Other hardware typically handles this tradeoff by using some of the depth buffer as a stencil buffer, so you get 24 bits of depth and 8 of stencil; I guess the PSP has a fixed 16 bit depth, and you really can't make do with anything smaller, so no sharing with stencil).
I guess some experiments are in order.