thin3d: Plug leaks in samplers and vk shaders.

This commit is contained in:
Unknown W. Brackets 2016-03-21 00:03:34 -07:00
parent 2d34c0a8bc
commit bdc0dac6c5
2 changed files with 9 additions and 0 deletions

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)) {