Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize PF_State-based caching for uploads #5

Open
Wunkolo opened this issue Mar 13, 2023 · 0 comments · May be fixed by #6
Open

Utilize PF_State-based caching for uploads #5

Wunkolo opened this issue Mar 13, 2023 · 0 comments · May be fixed by #6
Assignees
Labels
enhancement New feature or request

Comments

@Wunkolo
Copy link
Owner

Wunkolo commented Mar 13, 2023

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.

@Wunkolo Wunkolo added the enhancement New feature or request label Mar 13, 2023
@Wunkolo Wunkolo self-assigned this Mar 13, 2023
@Wunkolo Wunkolo linked a pull request Mar 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant