Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
assert(component < component_count);
state = var_def->values[component].state;
trace = &var_def->traces[component];
switch (state){case VALUE_STATE_STATICALLY_WRITTEN:return &var_def->values[component];case VALUE_STATE_DYNAMICALLY_WRITTEN:return NULL;case VALUE_STATE_NOT_WRITTEN:break;}
r = trace->record_count - 1;while (r >= 0 && time <= trace->records[r].timestamp)--r;
This feels to me like a very unidiomatic way to do a list search, and it has the for-if (anti)pattern which I dislike. I'd rather use a for loop and add a helper function.