Skip to main content
Participant
March 11, 2024
Answered

Flow handler for AEGP_ComputeIfNeededAndCheckout in the compute cache api

My issue is that we need to make sure frame n-1 is finished rendering before we can render frame n because there are cases where frame n will need the data of frame n-1.
Is it true that when rendering at frame n - 1, we will save the opaque_optionsP of frame n-1 and call AEGP_ComputeIfNeededAndCheckout after rendering to cache. Counting frame n will call AEGP_ComputeIfNeededAndCheckout with opaque_optionsP of frame 1 to check if rendering has finished. Am I understanding that right?

Below is my code in PF_Cmd_SMART_RENDER:

A_long* preFrame = nullptr; // This variable will be saved globally
AEFX_SuiteScoper<AEGP_ComputeCacheSuite1> computeCacheSuite1{ in_data, kAEGPComputeCacheSuite, kAEGPComputeCacheSuiteVersion1 };
AEGP_CCCheckoutReceiptP receiptForPreviousFrame = nullptr;
in_dataP = in_data;
if (in_data->current_time > 0)
{
    if (secondpreFrame == nullptr)
    {
        secondpreFrame = preFrame;
    }
    ERR(computeCacheSuite1->AEGP_ComputeIfNeededAndCheckout(computeClassIdP, preFrame, false, &receiptForPreviousFrame));
    if(err == A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING) {
        ERR(computeCacheSuite1->AEGP_ComputeIfNeededAndCheckout(computeClassIdP, preFrame, true, &receiptForPreviousFrame));
        spdlog::info("A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING 1");
    }
    computeCacheSuite1->AEGP_CheckinComputeReceipt(receiptForPreviousFrame);
}
...
  //render frame
...
    AEGP_CCCheckoutReceiptP receiptForCurrentFrame = nullptr;
    ERR(computeCacheSuite1->AEGP_ComputeIfNeededAndCheckout(computeClassIdP, &in_data->current_time, false, &receiptForCurrentFrame));
    if (err != PF_Err_NONE) {
        spdlog::info("save AEGP_ClassUnregister fails");
    }
    if (err == A_Err_NOT_IN_CACHE_OR_COMPUTE_PENDING) {
        ERR(computeCacheSuite1->AEGP_ComputeIfNeededAndCheckout(computeClassIdP, &in_data->current_time, true, &receiptForCurrentFrame));
    }
    computeCacheSuite1->AEGP_CheckinComputeReceipt(receiptForCurrentFrame);
}
preFrame = &in_data->current_time;
    This topic is closed to new replies. Start a new post to keep the conversation going.
    kglad
    kgladCorrect answer
    Community Expert
    March 11, 2024

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



    <"moved from using the community">

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    March 11, 2024

    in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

    p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



    <"moved from using the community">
    Translate