Fixed bug where replacing an animator's rig causes the GPU to be lost
This commit is contained in:
parent
3f1a25c95b
commit
eab2f2d54a
|
@ -428,11 +428,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update GPU Buffers
|
// Update GPU Buffers
|
||||||
const uint32_t BONE_MTX_DATA_BYTES = static_cast<uint32_t>(boneMatrixData.size() * sizeof(SHMatrix));
|
rebuildBoneMatrixDescSetBuffer(frameIndex);
|
||||||
if (boneMatrixBuffer[frameIndex])
|
|
||||||
{
|
|
||||||
boneMatrixBuffer[frameIndex]->WriteToMemory(boneMatrixData.data(), BONE_MTX_DATA_BYTES, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHBatch::Build(Handle<SHVkLogicalDevice> _device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex)
|
void SHBatch::Build(Handle<SHVkLogicalDevice> _device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex)
|
||||||
|
@ -734,7 +730,7 @@ namespace SHADE
|
||||||
// Using Declarations and constants
|
// Using Declarations and constants
|
||||||
using BuffUsage = vk::BufferUsageFlagBits;
|
using BuffUsage = vk::BufferUsageFlagBits;
|
||||||
using PreDefDescLayoutType = SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes;
|
using PreDefDescLayoutType = SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes;
|
||||||
static constexpr uint32_t MATERIAL_DESC_SET_INDEX = 0;
|
|
||||||
|
|
||||||
/* Create Descriptor Sets if Needed */
|
/* Create Descriptor Sets if Needed */
|
||||||
PreDefDescLayoutType layoutTypes = {};
|
PreDefDescLayoutType layoutTypes = {};
|
||||||
|
@ -801,6 +797,13 @@ namespace SHADE
|
||||||
/* Animation Bone Data */
|
/* Animation Bone Data */
|
||||||
if (MUST_BUILD_BONE_DESC)
|
if (MUST_BUILD_BONE_DESC)
|
||||||
{
|
{
|
||||||
|
rebuildBoneMatrixDescSetBuffer(frameIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHBatch::rebuildBoneMatrixDescSetBuffer(uint32_t frameIndex)
|
||||||
|
{
|
||||||
|
using BuffUsage = vk::BufferUsageFlagBits;
|
||||||
// Update GPU Buffers
|
// Update GPU Buffers
|
||||||
const uint32_t BONE_MTX_DATA_BYTES = static_cast<uint32_t>(boneMatrixData.size() * sizeof(SHMatrix));
|
const uint32_t BONE_MTX_DATA_BYTES = static_cast<uint32_t>(boneMatrixData.size() * sizeof(SHMatrix));
|
||||||
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
SHVkUtil::EnsureBufferAndCopyHostVisibleData
|
||||||
|
@ -828,7 +831,6 @@ namespace SHADE
|
||||||
SHGraphicsConstants::DescriptorSetBindings::PER_INST_BONE_DATA
|
SHGraphicsConstants::DescriptorSetBindings::PER_INST_BONE_DATA
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool SHBatch::checkIfIsAnimatedPipeline(Handle<SHVkPipeline> pipeline)
|
bool SHBatch::checkIfIsAnimatedPipeline(Handle<SHVkPipeline> pipeline)
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,6 +107,11 @@ namespace SHADE
|
||||||
using TripleBuffer = std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
using TripleBuffer = std::array<Handle<SHVkBuffer>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
||||||
using TripleDescSet = std::array<Handle<SHVkDescriptorSetGroup>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
using TripleDescSet = std::array<Handle<SHVkDescriptorSetGroup>, SHGraphicsConstants::NUM_FRAME_BUFFERS>;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Constants */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
static constexpr uint32_t MATERIAL_DESC_SET_INDEX = 0;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -146,6 +151,8 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------*/
|
||||||
void setAllDirtyFlags();
|
void setAllDirtyFlags();
|
||||||
void rebuildDescriptorSetBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
void rebuildDescriptorSetBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||||
|
void rebuildBoneMatrixDescSetBuffer(uint32_t frameIndex);
|
||||||
static bool checkIfIsAnimatedPipeline(Handle<SHVkPipeline> pipeline);
|
static bool checkIfIsAnimatedPipeline(Handle<SHVkPipeline> pipeline);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue