Hi Jack,
this was - as it turns out - a design simplification from way back.
I solved it by adding a new accumulator, let's call it Y, which stores
the first blending stage; This doesn't involve extra copying, but does
require another 16-bit-per-colour line buffer. This might result in the
compiler not picking up certain optimizations, though.
Will flow into code base when I have some time.
greets
Niels
MrPeach wrote:
Bryce,
I recalled your question and as I happened to be digging through
generic.c this week (implementing my own accelerator code) I thought
I'd give you a reply.
Looking at the code in generic.c, I see the following:
if (source_needs_destination &&
state->dst_blend != DSBF_ONE) {
*funcs++ = Xacc_is_Bacc;
*funcs++ = Xacc_blend[state->src_blend - 1];
*funcs++ = Xacc_is_Aacc;
*funcs++ = Xacc_blend[state->dst_blend - 1];
}
It applies the source blend first, then the results of that are used
in the second blend.
I don't know if this is the "correct" behavior, but it doesn't seem to
me that it is.
However, the only way to make it behave "correctly" would be to make a
copy of the first used accumulator array and use that in the second
operation, which would be costly.
Jack Follansbee
Broadcom Corporation
On Mon, 5 Jan 2009 12:31:22 -0800, "Poole, Bryce"
<bryce.po...@intel.com> wrote:
All,
I have been doing some validation of the hardware driver that we have developed
based on OpenGL ES and came up with some peculiar results when comparing it to
software blending. When blitting ARGB surfaces, the software blending seems to
be different for several of the src/dest blend function combinations when
compared to OpenGL. Is there anyone here that worked on the software blender?
I am trying to confirm that the results I see are expected.
In an attempt to establish the expected behavior, I hand blended the colors to
verify the results and concluded that the hand calculated/blended colors most
closely matched the OpenGL blender. Not all combinations of blending functions
produced different results. These are some of the combinations that didn't
produce the expected results:
Src: DstAlpha Dst: SrcColor
Src: DstAlpha Dst: 1-SrcColor
Src: DstAlpha Dst: SrcAlpha
Src: DstAlpha Dst: 1-SrcAlpha
Src: 1-DstAlpha Dst: SrcColor
Src: 1-DstAlpha Dst: 1-SrcColor
Src: 1-DstAlpha Dst: SrcAlpha
Src: 1-DstAlpha Dst: 1-SrcAlpha
Src: DstColor Dst: SrcColor
Src: DstColor Dst: 1-SrcColor
Src: DstColor Dst: SrcAlpha
Src: DstColor Dst: 1-SrcAlpha
Src: 1- DstColor Dst: SrcColor
Src: 1- DstColor Dst: 1-SrcColor
Src: 1- DstColor Dst: SrcAlpha
Src: 1- DstColor Dst: 1-SrcAlpha
Src: SrcAlphaSat Dst:SrcColor
Src: SrcAlphaSat Dst:1-SrcColor
This doesn't include all possible combinations, only those valid in OpenGL ES.
For an example, the following demonstrates the results that I see.
The Blend equation is Color(final) = Color(src)*BlendFunction(src) +
Color(dst)*BlendFunction(dst).
BlendFunction(src) = DstAlpha
BlendFunction(dst) = SrcColor
R(final) = R(src)*A(dst)/255 + R(dst)*R(src)/255
G(final) = G(src)*A(dst)/255 + G(dst)*G(src)/255
B(final) = B(src)*A(dst)/255 + B(dst)*B(src)/255
A(final) = A(src)*A(dst)/255 + A(dst)*A(src)/255
Src Color: 0x6e728cff
ARGB=110 114 140 255
Dst Color: 0x7c8cdb72
ARGB=124 140 219 114
R(final) = 114*124/255 + 140*114/255 = 55 + 63 = 118
G(final) = 140*124/255 + 219*140/255 = 68 + 120 = 188
B(final) = 255*124/255 + 114*255/255 = 124 + 114 = 238
A(final) = 110*124/255 + 124*110/255 = 53 + 53 = 106
To compare (ARGB):
079 085 127 179 Software
107 118 188 234 Hardware
106 118 188 238 Hand Calculation
As can be seen in the calculations above, the software blender produces
substantially different values compared to the expected result. The hardware
and hand calculations are close.
Can anyone help me to understand what is going on? This is for DirectFB 1.0.1.
If someone wants to run this on DirectFB 1.4, that would be appreciated.
Bryce Poole
Intel Corporation
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
--
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev