Fix compile warning and crash in SSAO test.
emptyTexture was not initialized, so when destroying it the destroy Vulkan functions were called with bogus pointers.
This commit is contained in:
parent
0d732cc4a4
commit
5042f46388
2 changed files with 11 additions and 8 deletions
|
|
@ -52,12 +52,15 @@ void vkglTF::Texture::updateDescriptor()
|
|||
}
|
||||
|
||||
void vkglTF::Texture::destroy()
|
||||
{
|
||||
if (device)
|
||||
{
|
||||
vkDestroyImageView(device->logicalDevice, view, nullptr);
|
||||
vkDestroyImage(device->logicalDevice, image, nullptr);
|
||||
vkFreeMemory(device->logicalDevice, deviceMemory, nullptr);
|
||||
vkDestroySampler(device->logicalDevice, sampler, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void vkglTF::Texture::fromglTfImage(tinygltf::Image &gltfimage, std::string path, vks::VulkanDevice *device, VkQueue copyQueue)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace vkglTF
|
|||
glTF texture loading class
|
||||
*/
|
||||
struct Texture {
|
||||
vks::VulkanDevice* device;
|
||||
vks::VulkanDevice* device = nullptr;
|
||||
VkImage image;
|
||||
VkImageLayout imageLayout;
|
||||
VkDeviceMemory deviceMemory;
|
||||
|
|
@ -72,7 +72,7 @@ namespace vkglTF
|
|||
glTF material class
|
||||
*/
|
||||
struct Material {
|
||||
vks::VulkanDevice* device;
|
||||
vks::VulkanDevice* device = nullptr;
|
||||
enum AlphaMode { ALPHAMODE_OPAQUE, ALPHAMODE_MASK, ALPHAMODE_BLEND };
|
||||
AlphaMode alphaMode = ALPHAMODE_OPAQUE;
|
||||
float alphaCutoff = 1.0f;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue