On Thu Jan 5 18:57:18 2023 +0000, Giovanni Mascellani wrote:
I don't think that checking for variable identity is the right thing to do, it feels more a workaround for the symptom. The underlying issue seems to me that object variables actually come in two types: the real uniform object, that is split in a dedicated pass, and all the other object variables that behave rather as pointers to the real objects. The HLSL language is rather terrible when it conflates these two concepts, which is the reason why we need the splitting pass. Here we just have to acknowledge the same distinction: it makes sense to propagate a load from an object variable when that variable is a real object, i.e., a uniform variable. In other words, I'd rather fix this bug using:
if (!load->src.var->is_uniform) { TRACE("Ignoring load from non-uniform object variable %s\n", load->src.var->name); return false; }
in `copy_propagation_transform_object_load()`, instead of checking for variable identity.
After giving it some thought, I think this is an elegant solution!