On 03/16/2017 10:12 PM, Matteo Bruni wrote:
2017-03-16 17:15 GMT+01:00 Paul Gofman gofmanp@gmail.com:
I am sorry, I still don't understand how it is a separate bugfix. I don't see the absence of it as a bug in previous code, reset of constants is not required as they are updated anyway.
I guess you can argue that, sure. It's mostly that set_shader_constants_device() calls regstore_reset_table() and, for symmetry if not in practice, it seems better to clear here too. Not a big deal either way you choose.
Actually regstore_reset_table() call along with ultimate TRUE for update_all parameter in set_constants() call here is redundant. I added it just to make things a bit more robuts and more robust checking of unitialized input in preshader in case of some bugs in their update logic, which got more complicated with selective constants update. It should actually work (without updating constants from unchanged parameters) if change set_constants(rs, &pres->inputs, TRUE); to set_constants(rs, &pres->inputs, update_all); and remove regstore_reset_table(). Maybe I should do it like this?
Right, that's a good idea I think. If that breaks the tests it means there is some bug somewhere in the update logic. Do you need to remove regstore_reset_table() though?
No, it does not break the tests I have now. It may become more tricky in shared parameters update logic, but I don't have enough tests for that part yet so probably some possible problems there should be addressed later. But removing regstore_reset_table() is necessary in this case, because otherwise if some preshader uses both updated and non-updated parameter, the input for non-updated parameter will be zeroed after previous (full) update and not initialized by update logic (in the current version of the patch all preshaders input are initialized due to 'TRUE' ultimately passed as update_all to constant set function, so it can bear table reset).