Skip to main content
Participant
March 24, 2023
Question

PF_GetCurrentState always invalidates cache. Is this normal?

  • March 24, 2023
  • 1 reply
  • 216 views

Hello there,

I'm working on an effect plug-in and ran into a weird issue. I am keeping track of the PF_State of a parameter to detect when its state changes. Shouldn't be a problem with PF_GetCurrentState and PF_AreStatesIdentical.

 

It seems to work great, except for one problem; the cache always gets invalidated the moment PF_GetCurrentState is called. Which means everything in the timeline is forced to re-render, rather than just the frames that have changed. Commenting out that exact function call fixes the problem and results in normal caching behaviour, so this doesn't seem to be related to anything else the plugin is doing. Is this normal behaviour for PF_GetCurrentState? Here's how I call the function:

PF_State currentState;
pUtilSuite->PF_GetCurrentState(in_data->effect_ref, 7, NULL, NULL, &currentState);

 My expectation from the docs is, that the returned PF_State is simply some hashed representation of the state. Does this function have some undocumented side-effect of messing with the cache?

This topic has been closed for replies.

1 reply

Participant
March 25, 2023

Not sure how I can edit existing posts, but I've figured it out and want to share that for anyone in the future who runs into this problem.

 

It turns out this cache invalidation only happens if PF_GetCurrentState is called from the render thread. Calling it from the UI thread seems to solve the problem. In other words, command selectors like EVENT and USER_CHANGED_PARAM don't cause cache invalidation, unless any frames have actually changed.