Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement glBlend #16

Closed
PabloPL opened this issue Jan 2, 2018 · 5 comments
Closed

Implement glBlend #16

PabloPL opened this issue Jan 2, 2018 · 5 comments

Comments

@PabloPL
Copy link
Contributor

PabloPL commented Jan 2, 2018

Findings about blending:

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

  • only glEnable(GL_BLEND) is called
  • no glEnable(GL_BLEND) is called (so blending is disabled)

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:

  • when only glEnable(GL_BLEND) is called, it's calculating the same value as binary driver
  • when blending is disabled, it's setting all func/factor as 0 (so is calculating different value as binary driver)

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
Copy link
Contributor Author

PabloPL commented Jan 3, 2018

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 #17

@PabloPL
Copy link
Contributor Author

PabloPL commented Jan 3, 2018

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
Copy link
Owner

yuq commented Jan 4, 2018

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
Copy link
Contributor Author

PabloPL commented Jan 5, 2018

Confirmed - color mask value is also stored in alpha_blend field.
Created separated PR for this #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
Copy link
Owner

yuq commented Jan 6, 2018

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

@PabloPL PabloPL closed this as completed Jan 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants