From d884eeda99d73fd8634543da0a3d47253e7f7bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 30 Nov 2017 15:28:15 +0100 Subject: [PATCH] DX9: Revert a bad optimization, hopefully fixing #10205. Vulkan: Add a missing check. --- GPU/Directx9/ShaderManagerDX9.cpp | 10 +++++++--- GPU/Vulkan/DepalettizeShaderVulkan.cpp | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 78988911cc..9588053b55 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -147,9 +147,13 @@ void ShaderManagerDX9::PSSetColorUniform3(int creg, u32 color) { } void ShaderManagerDX9::PSSetColorUniform3Alpha255(int creg, u32 color, u8 alpha) { - float f[4]; - Uint8x3ToFloat4_AlphaUint8(f, color, alpha); - device_->SetPixelShaderConstantF(creg, f, 1); + const float col[4] = { + (float)((color & 0xFF)), + (float)((color & 0xFF00) >> 8), + (float)((color & 0xFF0000) >> 16), + (float)alpha, + }; + device_->SetPixelShaderConstantF(creg, col, 1); } void ShaderManagerDX9::PSSetFloat(int creg, float value) { diff --git a/GPU/Vulkan/DepalettizeShaderVulkan.cpp b/GPU/Vulkan/DepalettizeShaderVulkan.cpp index a080b27416..b7dec11221 100644 --- a/GPU/Vulkan/DepalettizeShaderVulkan.cpp +++ b/GPU/Vulkan/DepalettizeShaderVulkan.cpp @@ -69,7 +69,8 @@ DepalShaderCacheVulkan::~DepalShaderCacheVulkan() { void DepalShaderCacheVulkan::DeviceLost() { Clear(); - vulkan_->Delete().QueueDeleteShaderModule(vshader_); + if (vshader_) + vulkan_->Delete().QueueDeleteShaderModule(vshader_); draw_ = nullptr; vulkan_ = nullptr; }