mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-15 19:28:29 +12:00
fix: sampling & capture boundaries
This commit is contained in:
parent
af3ce80b7c
commit
4976ff3084
8 changed files with 233 additions and 121 deletions
|
@ -1,29 +1,34 @@
|
|||
#include "Cafe/HW/Latte/Renderer/Metal/LatteTextureViewMtl.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Metal/LatteTextureMtl.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalRenderer.h"
|
||||
#include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h"
|
||||
|
||||
LatteTextureViewMtl::LatteTextureViewMtl(MetalRenderer* mtlRenderer, LatteTextureMtl* texture, Latte::E_DIM dim, Latte::E_GX2SURFFMT format, sint32 firstMip, sint32 mipCount, sint32 firstSlice, sint32 sliceCount)
|
||||
: LatteTextureView(texture, firstMip, mipCount, firstSlice, sliceCount, dim, format), m_mtlr(mtlRenderer), m_format(format)
|
||||
{
|
||||
// TODO: don't hardcode the format
|
||||
MTL::PixelFormat pixelFormat = MTL::PixelFormatRGBA8Unorm;
|
||||
MTL::TextureType textureType;
|
||||
switch (dim)
|
||||
{
|
||||
case Latte::E_DIM::DIM_1D:
|
||||
textureType = MTL::TextureType1D;
|
||||
break;
|
||||
case Latte::E_DIM::DIM_2D:
|
||||
case Latte::E_DIM::DIM_2D_MSAA:
|
||||
textureType = MTL::TextureType2D;
|
||||
break;
|
||||
case Latte::E_DIM::DIM_2D_ARRAY:
|
||||
textureType = MTL::TextureType2DArray;
|
||||
break;
|
||||
case Latte::E_DIM::DIM_3D:
|
||||
textureType = MTL::TextureType3D;
|
||||
break;
|
||||
case Latte::E_DIM::DIM_CUBEMAP:
|
||||
textureType = MTL::TextureTypeCube; // TODO: check this
|
||||
break;
|
||||
default:
|
||||
cemu_assert_unimplemented();
|
||||
textureType = MTL::TextureType2D;
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 baseLevel = firstMip;
|
||||
|
@ -47,7 +52,8 @@ LatteTextureViewMtl::LatteTextureViewMtl(MetalRenderer* mtlRenderer, LatteTextur
|
|||
|
||||
// TODO: swizzle
|
||||
|
||||
m_texture = texture->GetTexture()->newTextureView(pixelFormat, textureType, NS::Range::Make(baseLevel, levelCount), NS::Range::Make(baseLayer, layerCount));
|
||||
auto formatInfo = GetMtlPixelFormatInfo(format);
|
||||
m_texture = texture->GetTexture()->newTextureView(formatInfo.pixelFormat, textureType, NS::Range::Make(baseLevel, levelCount), NS::Range::Make(baseLayer, layerCount));
|
||||
}
|
||||
|
||||
LatteTextureViewMtl::~LatteTextureViewMtl()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue