Skip to content

Utilize PF_State-based caching for uploads #5

Description

@Wunkolo

PF_GetCurrentState from PF_ParamUtilSuite3 can be utilized to get a pretty coherent "hash" of an input layer. With this, the uploaded contents of a "texture" derived from a PF_EffectWorld can be identified to have been uploaded already to the GPU and can be re-used.
A PF_State may be added to the current sequence-cache allowing cases such as a still-image input layer to only have to be uploaded to the GPU once and re-used much quicker.

struct SequenceCache
{
// If we are only using a smaller subset of the entire buffer
// Then we should resize the entire buffer to be smaller if it is this
// percentage smaller than the cached size
// If an allocation comes in that is %15 smaller than the cache, then
// the buffer to fit
static constexpr glm::f32 ShrinkThreshold = 0.15f;
// Cache for the staging buffer
std::size_t StagingBufferSize = 0u;
vk::UniqueBuffer StagingBuffer = {};
vk::UniqueDeviceMemory StagingBufferMemory = {};
// We use these structs so that we can easily "==" compare the image in
// the cache with any new requests coming in
vk::ImageCreateInfo InputImageInfoCache = {};
vk::ImageCreateInfo OutputImageInfoCache = {};
vk::UniqueImage InputImage = {};
vk::UniqueDeviceMemory InputImageMemory = {};
vk::UniqueImage OutputImage = {};
vk::UniqueDeviceMemory OutputImageMemory = {};
} Cache;

Additional testing may have to be done depending on the coherency of the PF_State such as changes in extents, quality, bit-depth, etc.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions