diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 0b7a40012f..67f929cdf0 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -155,22 +155,31 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { fbTex = nullptr; } + // For accuracy, try to handle 0 stride - sometimes used. + if (displayStride_ == 0) { + srcheight = 1; + } + Draw::TextureDesc desc{}; desc.type = Draw::TextureType::LINEAR2D; desc.format = Draw::DataFormat::R8G8B8A8_UNORM; desc.depth = 1; desc.mipLevels = 1; bool hasImage = true; - if (!Memory::IsValidAddress(displayFramebuf_)) { + if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) { hasImage = false; u1 = 1.0f; } else if (displayFormat_ == GE_FORMAT_8888) { u8 *data = Memory::GetPointer(displayFramebuf_); - desc.width = displayStride_; + desc.width = displayStride_ == 0 ? srcwidth : displayStride_; desc.height = srcheight; desc.initData.push_back(data); desc.format = Draw::DataFormat::R8G8B8A8_UNORM; - u1 = (float)srcwidth / displayStride_; + if (displayStride_ != 0) { + u1 = (float)srcwidth / displayStride_; + } else { + u1 = 1.0f; + } } else { // TODO: This should probably be converted in a shader instead.. fbTexBuffer.resize(srcwidth * srcheight); diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 929e84581a..5b95a0e402 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -312,8 +312,9 @@ struct DescriptorSetKey { class VKTexture : public Texture { public: VKTexture(VulkanContext *vulkan, VkCommandBuffer cmd, const TextureDesc &desc) - : vulkan_(vulkan), format_(desc.format), mipLevels_(desc.mipLevels) { - Create(cmd, desc); + : vulkan_(vulkan), mipLevels_(desc.mipLevels), format_(desc.format) { + bool result = Create(cmd, desc); + assert(result); } ~VKTexture() { @@ -336,7 +337,7 @@ private: } VulkanContext *vulkan_; - VulkanTexture *vkTex_; + VulkanTexture *vkTex_ = nullptr; int mipLevels_;