Hello,
In order to emulate the behavior of an old console, I need to emulate a mask/modulo operation after the blending. In short Cd = (Cd + Cs * As) % 256. So far my solution does the addition in a float texture and finally does a post-processing to apply the modulo. Unfortunately, if I don’t call glFinish, I won’t have the correct data in the 2nd pass. I kind of expect the driver to do the synchronization. I try to replace the glFinish with a gl_MemoryBarrier(GL_ALL_BARRIER_BITS) without any success. glFinish isn’t a nice solution because it has a bad impact on the performance. Test were done on Nvidia Linux driver 352.21, I don’t know the behavior of others drivers. So is the glFinish mandatory? or did I miss somethings?
The command in short (full detail in the attached screenshot)
1/ Create a float texture
2/ Copy RGBA8 texture into the float texture
3/ Bind the float texture as target of the FB
4/ Do the normal rendering in the float texture
5/ Call glFinish <= Otherwise my float target is corrupted (or maybe unfinished)!
6/ Bind the RGBA8 texture as target of the FB
7/ Bind the float texture as input
8/ Do the %256 postprocessing draw.
[ATTACH=CONFIG]1186[/ATTACH]
Thanks for your attention.