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.
PF_GetCurrentStatefromPF_ParamUtilSuite3can be utilized to get a pretty coherent "hash" of an input layer. With this, the uploaded contents of a "texture" derived from aPF_EffectWorldcan be identified to have been uploaded already to the GPU and can be re-used.A
PF_Statemay 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.Vulkanator/include/Vulkanator.hpp
Lines 91 to 116 in 9e38576
Additional testing may have to be done depending on the coherency of the
PF_Statesuch as changes in extents, quality, bit-depth, etc.