yuq / mesa-lima

Deprecated, new place: https://gitlab.freedesktop.org/lima
https://github.com/yuq/mesa-lima/wiki
165 stars 18 forks source link

Implement glBlend #16

Closed PabloPL closed 6 years ago

PabloPL commented 6 years ago

Findings about blending:

It looks like binary driver is generating the same alpha_blend value (in render_state) when:

Generated value (0xfc3b1ad2) is calculated from

blend_enable = 1
rgb_func = 0 // GL_FUNC_ADD
rgb_src_factor = 1 // GL_ONE
rgb_dst_factor = 17 // GL_ZERO
alpha_func = 0 // GL_FUNC_ADD
alpha_src_factor = 1 // GL_ONE
alpha_dst_factor = 17 // GL_ZERO

Mesa is behaving little different:

do we need to check if blend enabled to setup these fields?

Test showed that blend_color is independ from blend_enable, so we can allways set blend_color_bg/blend_color_ra.

PabloPL commented 6 years ago

This functionality looks working from begining (when those two functions were added), it was missing only special handling for blending disabled case. I've checked look of few images generated by mesa and compared them with result of the same code on intel gpu.

I've also compared values generated by lima_blend_func and lima_blend_factor with value generated by binary shader and they look exactly the same.

@yuq Did You found any cases where it wasn't working (and that's why it was disabled) ? Otherwise, PR for this task is in https://github.com/yuq/mesa-lima/pull/17

PabloPL commented 6 years ago

TODO: Looking at lima-ng sources alpha_blend could containt (at first byte) color mask. Need to check it (and fix either now or in next patch).

yuq commented 6 years ago

Yes, it doesn't work properly when blend disabled and there's something need to be investigated (comment in the code), so I disable it.

PabloPL commented 6 years ago

Confirmed - color mask value is also stored in alpha_blend field. Created separated PR for this https://github.com/yuq/mesa-lima/pull/18.

Is there anything else done with this issue or we can close it (i wasn't able to find any information about independ blend support on mali4xx :/).

yuq commented 6 years ago

I think no more for blend now. We can handle only zbuf case after we have depth & stencil support. Thanks for your work.