Merge pull request #8654 from unknownbrackets/vulkan-leaks

Plug some Vulkan leaks
This commit is contained in:
Henrik Rydgård 2016-03-21 08:27:08 +01:00
commit 3dcdd4b533
4 changed files with 20 additions and 2 deletions

View File

@ -1240,12 +1240,14 @@ void VulkanContext::DestroyFramebuffers() {
}
void VulkanContext::DestroySurfaceRenderPass() {
vkDestroyRenderPass(device_, surface_render_pass_, NULL);
vkDestroyRenderPass(device_, surface_render_pass_, NULL);
surface_render_pass_ = NULL;
}
void VulkanContext::DestroyDevice() {
vkDestroyDevice(device_, NULL);
// If there happen to be any pending deletes, now is a good time.
Delete().PerformDeletes(device_);
vkDestroyDevice(device_, NULL);
device_ = NULL;
}

View File

@ -83,6 +83,13 @@ SoftGPU::~SoftGPU() {
vformat = nullptr;
fbTex->Release();
fbTex = nullptr;
vdata->Release();
vdata = nullptr;
idata->Release();
idata = nullptr;
depth->Release();
depth = nullptr;
}
void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {

View File

@ -192,6 +192,11 @@ Thin3DContext::~Thin3DContext() {
ssPresets_[i]->Release();
}
}
for (int i = 0; i < SAMPS_MAX_PRESET; i++) {
if (sampsPresets_[i]) {
sampsPresets_[i]->Release();
}
}
}
static T3DImageFormat ZimToT3DFormat(int zim) {

View File

@ -194,10 +194,12 @@ public:
bool Compile(VulkanContext *vulkan, const char *source);
const std::string &GetSource() const { return source_; }
~Thin3DVKShader() {
vkDestroyShaderModule(device_, module_, nullptr);
}
VkShaderModule Get() const { return module_; }
private:
VkDevice device_;
VkShaderModule module_;
VkShaderStageFlagBits stage_;
bool ok_;
@ -205,6 +207,8 @@ private:
};
bool Thin3DVKShader::Compile(VulkanContext *vulkan, const char *source) {
// We'll need this to free it later.
device_ = vulkan->GetDevice();
this->source_ = source;
std::vector<uint32_t> spirv;
if (!GLSLtoSPV(stage_, source, spirv)) {