From c4eb19579706c4171540a78c60c85991adbfd8c3 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Mon, 2 Sep 2024 08:25:36 +0200 Subject: [PATCH] make all textures be at least 1x1x1 --- src/Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.cpp | 2 ++ src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.cpp b/src/Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.cpp index 27fd9dbe..eebacd45 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.cpp @@ -22,6 +22,8 @@ LatteTextureMtl::LatteTextureMtl(class MetalRenderer* mtlRenderer, Latte::E_DIM effectiveBaseHeight = overwriteInfo.height; effectiveBaseDepth = overwriteInfo.depth; } + effectiveBaseWidth = std::max(1, effectiveBaseWidth); + effectiveBaseHeight = std::max(1, effectiveBaseHeight); effectiveBaseDepth = std::max(1, effectiveBaseDepth); desc->setWidth(effectiveBaseWidth); diff --git a/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp index 6b667ec0..6ccbdb69 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp @@ -61,14 +61,14 @@ MetalRenderer::MetalRenderer() // Null resources MTL::TextureDescriptor* textureDescriptor = MTL::TextureDescriptor::alloc()->init(); textureDescriptor->setTextureType(MTL::TextureType1D); - textureDescriptor->setWidth(4); + textureDescriptor->setWidth(1); m_nullTexture1D = m_device->newTexture(textureDescriptor); #ifdef CEMU_DEBUG_ASSERT m_nullTexture1D->setLabel(GetLabel("Null texture 1D", m_nullTexture1D)); #endif textureDescriptor->setTextureType(MTL::TextureType2D); - textureDescriptor->setHeight(4); + textureDescriptor->setHeight(1); m_nullTexture2D = m_device->newTexture(textureDescriptor); #ifdef CEMU_DEBUG_ASSERT m_nullTexture2D->setLabel(GetLabel("Null texture 2D", m_nullTexture2D));