Vulkan: Prep pipeline and shader cache for restore.

This commit is contained in:
Unknown W. Brackets 2016-10-09 11:17:03 -07:00
parent cac3e6582d
commit a4268fe0b8
4 changed files with 20 additions and 0 deletions

View File

@ -27,6 +27,16 @@ void PipelineManagerVulkan::Clear() {
pipelines_.clear();
}
void PipelineManagerVulkan::DeviceLost() {
Clear();
vulkan_->Delete().QueueDeletePipelineCache(pipelineCache_);
}
void PipelineManagerVulkan::DeviceRestore(VulkanContext *vulkan) {
vulkan_ = vulkan;
pipelineCache_ = vulkan->CreatePipelineCache();
}
struct DeclTypeInfo {
VkFormat type;
const char *name;

View File

@ -87,6 +87,9 @@ public:
void Clear();
void DeviceLost();
void DeviceRestore(VulkanContext *vulkan);
std::string DebugGetObjectString(std::string id, DebugShaderType type, DebugShaderStringType stringType);
std::vector<std::string> DebugGetObjectIDs(DebugShaderType type);

View File

@ -437,6 +437,11 @@ void ShaderManagerVulkan::BoneUpdateUniforms(int dirtyUniforms) {
}
}
void ShaderManagerVulkan::DeviceRestore(VulkanContext *vulkan) {
vulkan_ = vulkan;
uboAlignment_ = vulkan_->GetPhysicalDeviceProperties().limits.minUniformBufferOffsetAlignment;
}
void ShaderManagerVulkan::Clear() {
for (auto iter = fsCache_.begin(); iter != fsCache_.end(); ++iter) {
delete iter->second;

View File

@ -229,6 +229,8 @@ public:
ShaderManagerVulkan(VulkanContext *vulkan);
~ShaderManagerVulkan();
void DeviceRestore(VulkanContext *vulkan);
void GetShaders(int prim, u32 vertType, VulkanVertexShader **vshader, VulkanFragmentShader **fshader, bool useHWTransform);
void ClearShaders();
void DirtyShader();