From 1871a5357eb19eee44c3c0745a14d5496678fd00 Mon Sep 17 00:00:00 2001 From: Eugene Golushkov Date: Wed, 1 Jun 2022 20:45:15 +0200 Subject: [PATCH] [Vk] Don't crash if VulkanRenderSystem::validateSampleDescription is called before first window creation --- RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp b/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp index 4407497ca98..a1237104986 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp @@ -3244,10 +3244,10 @@ namespace Ogre SampleDescription VulkanRenderSystem::validateSampleDescription( const SampleDescription &sampleDesc, PixelFormatGpu format ) { - SampleDescription retVal( - (uint8)getMaxUsableSampleCount( mDevice->mDeviceProperties, sampleDesc.getMaxSamples() ), - sampleDesc.getMsaaPattern() ); - return retVal; + uint8 samples = sampleDesc.getMaxSamples(); + if( mDevice ) + samples = (uint8)getMaxUsableSampleCount( mDevice->mDeviceProperties, samples ); + return SampleDescription( samples, sampleDesc.getMsaaPattern() ); } //------------------------------------------------------------------------- bool VulkanRenderSystem::isSameLayout( ResourceLayout::Layout a, ResourceLayout::Layout b,