win32: Fix a couple of crashes.

This commit is contained in:
BearOso 2023-02-06 11:47:56 -06:00
parent c3366477a7
commit 93a242312f
1 changed files with 10 additions and 9 deletions

View File

@ -22,18 +22,20 @@ bool CVulkan::Initialize(HWND hWnd)
swapchain = context->swapchain.get(); swapchain = context->swapchain.get();
device = context->device; device = context->device;
if (GUI.shaderEnabled && GUI.OGLshaderFileName) if (GUI.shaderEnabled && GUI.OGLshaderFileName && GUI.OGLshaderFileName[0])
{ {
shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get()); shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get());
std::string shaderstring = _tToChar(GUI.OGLshaderFileName); std::string shaderstring = _tToChar(GUI.OGLshaderFileName);
if (!shaderchain->load_shader_preset(shaderstring)) if (!shaderchain->load_shader_preset(shaderstring))
{ {
return false; shaderchain.reset();
} }
else
{
current_shadername = shaderstring; current_shadername = shaderstring;
return true; return true;
} }
}
create_pipeline(); create_pipeline();
@ -81,10 +83,9 @@ bool CVulkan::Initialize(HWND hWnd)
void CVulkan::DeInitialize() void CVulkan::DeInitialize()
{ {
if (!context)
return;
current_shadername = ""; current_shadername = "";
if (context)
context->wait_idle(); context->wait_idle();
shaderchain.reset(); shaderchain.reset();
textures.clear(); textures.clear();