mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-28 17:52:47 +01:00
implement more pixel formats
This commit is contained in:
parent
a11d1aa38a
commit
c8825d52bc
3 changed files with 45 additions and 30 deletions
|
@ -24,18 +24,18 @@ struct PixelFormatInfo {
|
||||||
// directly
|
// directly
|
||||||
// TODO: set the sizes of other formats as well
|
// TODO: set the sizes of other formats as well
|
||||||
constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT_TABLE = {{
|
constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT_TABLE = {{
|
||||||
{MTL::PixelFormatInvalid, 0}, // A8B8G8R8_UNORM
|
{MTL::PixelFormatRGBA8Unorm, 4}, // A8B8G8R8_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A8B8G8R8_SNORM
|
{MTL::PixelFormatRGBA8Snorm, 4}, // A8B8G8R8_SNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A8B8G8R8_SINT
|
{MTL::PixelFormatRGBA8Sint, 4}, // A8B8G8R8_SINT TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A8B8G8R8_UINT
|
{MTL::PixelFormatRGBA8Uint, 4}, // A8B8G8R8_UINT TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // R5G6B5_UNORM
|
{MTL::PixelFormatB5G6R5Unorm, 2}, // R5G6B5_UNORM TODO
|
||||||
{MTL::PixelFormatB5G6R5Unorm, 2}, // B5G6R5_UNORM
|
{MTL::PixelFormatB5G6R5Unorm, 2}, // B5G6R5_UNORM
|
||||||
{MTL::PixelFormatInvalid, 0}, // A1R5G5B5_UNORM
|
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1R5G5B5_UNORM TODO
|
||||||
{MTL::PixelFormatRGBA8Unorm, 4}, // A2B10G10R10_UNORM (hack)
|
{MTL::PixelFormatRGBA8Unorm, 4}, // A2B10G10R10_UNORM (hack)
|
||||||
{MTL::PixelFormatInvalid, 0}, // A2B10G10R10_UINT
|
{MTL::PixelFormatRGB10A2Uint, 4}, // A2B10G10R10_UINT TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A2R10G10B10_UNORM
|
{MTL::PixelFormatRGB10A2Unorm, 4}, // A2R10G10B10_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A1B5G5R5_UNORM
|
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1B5G5R5_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A5B5G5R1_UNORM
|
{MTL::PixelFormatInvalid, 0}, // A5B5G5R1_UNORM TODO
|
||||||
{MTL::PixelFormatR8Unorm, 1}, // R8_UNORM
|
{MTL::PixelFormatR8Unorm, 1}, // R8_UNORM
|
||||||
{MTL::PixelFormatR8Snorm, 1}, // R8_SNORM
|
{MTL::PixelFormatR8Snorm, 1}, // R8_SNORM
|
||||||
{MTL::PixelFormatR8Sint, 1}, // R8_SINT
|
{MTL::PixelFormatR8Sint, 1}, // R8_SINT
|
||||||
|
@ -45,18 +45,18 @@ constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT
|
||||||
{MTL::PixelFormatRGBA16Snorm, 8}, // R16G16B16A16_SNORM
|
{MTL::PixelFormatRGBA16Snorm, 8}, // R16G16B16A16_SNORM
|
||||||
{MTL::PixelFormatRGBA16Sint, 8}, // R16G16B16A16_SINT
|
{MTL::PixelFormatRGBA16Sint, 8}, // R16G16B16A16_SINT
|
||||||
{MTL::PixelFormatRGBA16Uint, 8}, // R16G16B16A16_UINT
|
{MTL::PixelFormatRGBA16Uint, 8}, // R16G16B16A16_UINT
|
||||||
{MTL::PixelFormatInvalid, 0}, // B10G11R11_FLOAT
|
{MTL::PixelFormatRG11B10Float, 4}, // B10G11R11_FLOAT TODO
|
||||||
{MTL::PixelFormatRGBA32Uint, 16}, // R32G32B32A32_UINT
|
{MTL::PixelFormatRGBA32Uint, 16}, // R32G32B32A32_UINT
|
||||||
{MTL::PixelFormatBC1_RGBA, 8, {4, 4}, false}, // BC1_RGBA_UNORM
|
{MTL::PixelFormatBC1_RGBA, 8, {4, 4}, false}, // BC1_RGBA_UNORM
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC2_UNORM
|
{MTL::PixelFormatInvalid, 0}, // BC2_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC3_UNORM
|
{MTL::PixelFormatInvalid, 0}, // BC3_UNORM TODO
|
||||||
{MTL::PixelFormatBC4_RUnorm, 8, {4, 4}, false}, // BC4_UNORM
|
{MTL::PixelFormatBC4_RUnorm, 8, {4, 4}, false}, // BC4_UNORM
|
||||||
{MTL::PixelFormatBC4_RSnorm, 0, {0, 0}, false}, // BC4_SNORM TODO
|
{MTL::PixelFormatBC4_RSnorm, 0, {0, 0}, false}, // BC4_SNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC5_UNORM
|
{MTL::PixelFormatInvalid, 0}, // BC5_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC5_SNORM
|
{MTL::PixelFormatInvalid, 0}, // BC5_SNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC7_UNORM
|
{MTL::PixelFormatInvalid, 0}, // BC7_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC6H_UFLOAT
|
{MTL::PixelFormatInvalid, 0}, // BC6H_UFLOAT TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC6H_SFLOAT
|
{MTL::PixelFormatInvalid, 0}, // BC6H_SFLOAT TODO
|
||||||
{MTL::PixelFormatASTC_4x4_LDR, 0, {0, 0}, false}, // ASTC_2D_4X4_UNORM TODO
|
{MTL::PixelFormatASTC_4x4_LDR, 0, {0, 0}, false}, // ASTC_2D_4X4_UNORM TODO
|
||||||
{MTL::PixelFormatBGRA8Unorm, 4}, // B8G8R8A8_UNORM
|
{MTL::PixelFormatBGRA8Unorm, 4}, // B8G8R8A8_UNORM
|
||||||
{MTL::PixelFormatRGBA32Float, 16}, // R32G32B32A32_FLOAT
|
{MTL::PixelFormatRGBA32Float, 16}, // R32G32B32A32_FLOAT
|
||||||
|
@ -74,14 +74,14 @@ constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT
|
||||||
{MTL::PixelFormatRG16Uint, 4}, // R16G16_UINT
|
{MTL::PixelFormatRG16Uint, 4}, // R16G16_UINT
|
||||||
{MTL::PixelFormatRG16Sint, 4}, // R16G16_SINT
|
{MTL::PixelFormatRG16Sint, 4}, // R16G16_SINT
|
||||||
{MTL::PixelFormatRG16Snorm, 4}, // R16G16_SNORM
|
{MTL::PixelFormatRG16Snorm, 4}, // R16G16_SNORM
|
||||||
{MTL::PixelFormatInvalid, 0}, // R32G32B32_FLOAT
|
{MTL::PixelFormatRGBA32Float, 16}, // R32G32B32_FLOAT TODO
|
||||||
{MTL::PixelFormatRGBA8Unorm, 4}, // A8B8G8R8_SRGB
|
{MTL::PixelFormatRGBA8Unorm, 4}, // A8B8G8R8_SRGB
|
||||||
{MTL::PixelFormatRG8Unorm, 2}, // R8G8_UNORM
|
{MTL::PixelFormatRG8Unorm, 2}, // R8G8_UNORM
|
||||||
{MTL::PixelFormatRG8Snorm, 2}, // R8G8_SNORM
|
{MTL::PixelFormatRG8Snorm, 2}, // R8G8_SNORM
|
||||||
{MTL::PixelFormatRG8Sint, 2}, // R8G8_SINT
|
{MTL::PixelFormatRG8Sint, 2}, // R8G8_SINT
|
||||||
{MTL::PixelFormatRG8Uint, 2}, // R8G8_UINT
|
{MTL::PixelFormatRG8Uint, 2}, // R8G8_UINT
|
||||||
{MTL::PixelFormatRG32Uint, 8}, // R32G32_UINT
|
{MTL::PixelFormatRG32Uint, 8}, // R32G32_UINT
|
||||||
{MTL::PixelFormatInvalid, 0}, // R16G16B16X16_FLOAT
|
{MTL::PixelFormatRGBA16Float, 8}, // R16G16B16X16_FLOAT TODO
|
||||||
{MTL::PixelFormatR32Uint, 4}, // R32_UINT
|
{MTL::PixelFormatR32Uint, 4}, // R32_UINT
|
||||||
{MTL::PixelFormatR32Sint, 4}, // R32_SINT
|
{MTL::PixelFormatR32Sint, 4}, // R32_SINT
|
||||||
{MTL::PixelFormatASTC_8x8_LDR, 16, {8, 8}, false}, // ASTC_2D_8X8_UNORM
|
{MTL::PixelFormatASTC_8x8_LDR, 16, {8, 8}, false}, // ASTC_2D_8X8_UNORM
|
||||||
|
@ -89,11 +89,11 @@ constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT
|
||||||
{MTL::PixelFormatASTC_5x4_LDR, 0, {0, 0}, false}, // ASTC_2D_5X4_UNORM TODO
|
{MTL::PixelFormatASTC_5x4_LDR, 0, {0, 0}, false}, // ASTC_2D_5X4_UNORM TODO
|
||||||
{MTL::PixelFormatBGRA8Unorm_sRGB, 0}, // B8G8R8A8_SRGB
|
{MTL::PixelFormatBGRA8Unorm_sRGB, 0}, // B8G8R8A8_SRGB
|
||||||
{MTL::PixelFormatBC1_RGBA_sRGB, 0, {0, 0}, false}, // BC1_RGBA_SRGB TODO
|
{MTL::PixelFormatBC1_RGBA_sRGB, 0, {0, 0}, false}, // BC1_RGBA_SRGB TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC2_SRGB
|
{MTL::PixelFormatInvalid, 0}, // BC2_SRGB TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC3_SRGB
|
{MTL::PixelFormatInvalid, 0}, // BC3_SRGB TODO
|
||||||
{MTL::PixelFormatBC7_RGBAUnorm_sRGB, 0, {0, 0}, false}, // BC7_SRGB TODO
|
{MTL::PixelFormatBC7_RGBAUnorm_sRGB, 0, {0, 0}, false}, // BC7_SRGB TODO
|
||||||
{MTL::PixelFormatABGR4Unorm, 0}, // A4B4G4R4_UNORM
|
{MTL::PixelFormatABGR4Unorm, 0}, // A4B4G4R4_UNORM
|
||||||
{MTL::PixelFormatInvalid, 0}, // G4R4_UNORM
|
{MTL::PixelFormatRG8Unorm, 2}, // G4R4_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_4x4_sRGB, 16, {4, 4}, false}, // ASTC_2D_4X4_SRGB
|
{MTL::PixelFormatASTC_4x4_sRGB, 16, {4, 4}, false}, // ASTC_2D_4X4_SRGB
|
||||||
{MTL::PixelFormatASTC_8x8_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X8_SRGB TODO
|
{MTL::PixelFormatASTC_8x8_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X8_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_8x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X5_SRGB TODO
|
{MTL::PixelFormatASTC_8x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X5_SRGB TODO
|
||||||
|
@ -118,13 +118,13 @@ constexpr std::array<PixelFormatInfo, VideoCore::Surface::MaxPixelFormat> FORMAT
|
||||||
{MTL::PixelFormatASTC_8x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X6_SRGB TODO
|
{MTL::PixelFormatASTC_8x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_8X6_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_6x5_LDR, 0, {0, 0}, false}, // ASTC_2D_6X5_UNORM TODO
|
{MTL::PixelFormatASTC_6x5_LDR, 0, {0, 0}, false}, // ASTC_2D_6X5_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_6x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_6X5_SRGB TODO
|
{MTL::PixelFormatASTC_6x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_6X5_SRGB TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // E5B9G9R9_FLOAT
|
{MTL::PixelFormatInvalid, 0}, // E5B9G9R9_FLOAT TODO
|
||||||
{MTL::PixelFormatDepth32Float, 0}, // D32_FLOAT
|
{MTL::PixelFormatDepth32Float, 0}, // D32_FLOAT
|
||||||
{MTL::PixelFormatDepth16Unorm, 0}, // D16_UNORM
|
{MTL::PixelFormatDepth16Unorm, 0}, // D16_UNORM
|
||||||
{MTL::PixelFormatInvalid, 0}, // X8_D24_UNORM
|
{MTL::PixelFormatInvalid, 0}, // X8_D24_UNORM TODO
|
||||||
{MTL::PixelFormatStencil8, 0}, // S8_UINT
|
{MTL::PixelFormatStencil8, 0}, // S8_UINT
|
||||||
{MTL::PixelFormatDepth24Unorm_Stencil8, 0}, // D24_UNORM_S8_UINT
|
{MTL::PixelFormatDepth24Unorm_Stencil8, 0}, // D24_UNORM_S8_UINT
|
||||||
{MTL::PixelFormatInvalid, 0}, // S8_UINT_D24_UNORM
|
{MTL::PixelFormatInvalid, 0}, // S8_UINT_D24_UNORM TODO
|
||||||
{MTL::PixelFormatDepth32Float_Stencil8, 0}, // D32_FLOAT_S8_UINT
|
{MTL::PixelFormatDepth32Float_Stencil8, 0}, // D32_FLOAT_S8_UINT
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,22 @@ bool RasterizerMetal::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Surfa
|
||||||
|
|
||||||
void RasterizerMetal::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
void RasterizerMetal::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
|
||||||
std::span<const u8> memory) {
|
std::span<const u8> memory) {
|
||||||
LOG_DEBUG(Render_Metal, "called");
|
auto cpu_addr = gpu_memory->GpuToCpuAddress(address);
|
||||||
|
if (!cpu_addr) [[unlikely]] {
|
||||||
|
gpu_memory->WriteBlock(address, memory.data(), copy_size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpu_memory->WriteBlockUnsafe(address, memory.data(), copy_size);
|
||||||
|
{
|
||||||
|
if (!buffer_cache.InlineMemory(*cpu_addr, copy_size, memory)) {
|
||||||
|
buffer_cache.WriteMemory(*cpu_addr, copy_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
texture_cache.WriteMemory(*cpu_addr, copy_size);
|
||||||
|
|
||||||
|
pipeline_cache.InvalidateRegion(*cpu_addr, copy_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerMetal::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
void RasterizerMetal::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||||
|
|
|
@ -105,17 +105,17 @@ void Image::UploadMemory(const StagingBufferRef& map,
|
||||||
|
|
||||||
void Image::DownloadMemory(MTL::Buffer* buffer, size_t offset,
|
void Image::DownloadMemory(MTL::Buffer* buffer, size_t offset,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies) {
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
;
|
LOG_DEBUG(Render_Metal, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::DownloadMemory(std::span<MTL::Buffer*> buffers, std::span<size_t> offsets,
|
void Image::DownloadMemory(std::span<MTL::Buffer*> buffers, std::span<size_t> offsets,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies) {
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
;
|
LOG_DEBUG(Render_Metal, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::DownloadMemory(const StagingBufferRef& map,
|
void Image::DownloadMemory(const StagingBufferRef& map,
|
||||||
std::span<const VideoCommon::BufferImageCopy> copies) {
|
std::span<const VideoCommon::BufferImageCopy> copies) {
|
||||||
;
|
LOG_DEBUG(Render_Metal, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
|
ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewInfo& info,
|
||||||
|
|
Loading…
Reference in a new issue