mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 10:52:48 -06:00
fix: clang-format
This commit is contained in:
parent
1efdd483b7
commit
86b1f41de6
7 changed files with 133 additions and 128 deletions
|
@ -24,108 +24,108 @@ 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::PixelFormatRGBA8Unorm, 4}, // A8B8G8R8_UNORM TODO
|
{MTL::PixelFormatRGBA8Unorm, 4}, // A8B8G8R8_UNORM TODO
|
||||||
{MTL::PixelFormatRGBA8Snorm, 4}, // A8B8G8R8_SNORM TODO
|
{MTL::PixelFormatRGBA8Snorm, 4}, // A8B8G8R8_SNORM TODO
|
||||||
{MTL::PixelFormatRGBA8Sint, 4}, // A8B8G8R8_SINT TODO
|
{MTL::PixelFormatRGBA8Sint, 4}, // A8B8G8R8_SINT TODO
|
||||||
{MTL::PixelFormatRGBA8Uint, 4}, // A8B8G8R8_UINT TODO
|
{MTL::PixelFormatRGBA8Uint, 4}, // A8B8G8R8_UINT TODO
|
||||||
{MTL::PixelFormatB5G6R5Unorm, 2}, // R5G6B5_UNORM TODO
|
{MTL::PixelFormatB5G6R5Unorm, 2}, // R5G6B5_UNORM TODO
|
||||||
{MTL::PixelFormatB5G6R5Unorm, 2}, // B5G6R5_UNORM
|
{MTL::PixelFormatB5G6R5Unorm, 2}, // B5G6R5_UNORM
|
||||||
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1R5G5B5_UNORM TODO
|
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1R5G5B5_UNORM TODO
|
||||||
{MTL::PixelFormatRGBA8Unorm, 4}, // A2B10G10R10_UNORM (hack)
|
{MTL::PixelFormatRGBA8Unorm, 4}, // A2B10G10R10_UNORM (hack)
|
||||||
{MTL::PixelFormatRGB10A2Uint, 4}, // A2B10G10R10_UINT TODO
|
{MTL::PixelFormatRGB10A2Uint, 4}, // A2B10G10R10_UINT TODO
|
||||||
{MTL::PixelFormatRGB10A2Unorm, 4}, // A2R10G10B10_UNORM TODO
|
{MTL::PixelFormatRGB10A2Unorm, 4}, // A2R10G10B10_UNORM TODO
|
||||||
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1B5G5R5_UNORM TODO
|
{MTL::PixelFormatA1BGR5Unorm, 2}, // A1B5G5R5_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // A5B5G5R1_UNORM TODO
|
{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
|
||||||
{MTL::PixelFormatR8Uint, 1}, // R8_UINT
|
{MTL::PixelFormatR8Uint, 1}, // R8_UINT
|
||||||
{MTL::PixelFormatRGBA16Float, 8}, // R16G16B16A16_FLOAT
|
{MTL::PixelFormatRGBA16Float, 8}, // R16G16B16A16_FLOAT
|
||||||
{MTL::PixelFormatRGBA16Unorm, 8}, // R16G16B16A16_UNORM
|
{MTL::PixelFormatRGBA16Unorm, 8}, // R16G16B16A16_UNORM
|
||||||
{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::PixelFormatRG11B10Float, 4}, // B10G11R11_FLOAT TODO
|
{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 TODO
|
{MTL::PixelFormatInvalid, 0}, // BC2_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC3_UNORM TODO
|
{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 TODO
|
{MTL::PixelFormatInvalid, 0}, // BC5_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC5_SNORM TODO
|
{MTL::PixelFormatInvalid, 0}, // BC5_SNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC7_UNORM TODO
|
{MTL::PixelFormatInvalid, 0}, // BC7_UNORM TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC6H_UFLOAT TODO
|
{MTL::PixelFormatInvalid, 0}, // BC6H_UFLOAT TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC6H_SFLOAT TODO
|
{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
|
||||||
{MTL::PixelFormatRGBA32Sint, 16}, // R32G32B32A32_SINT
|
{MTL::PixelFormatRGBA32Sint, 16}, // R32G32B32A32_SINT
|
||||||
{MTL::PixelFormatRG32Float, 8}, // R32G32_FLOAT
|
{MTL::PixelFormatRG32Float, 8}, // R32G32_FLOAT
|
||||||
{MTL::PixelFormatRG32Sint, 8}, // R32G32_SINT
|
{MTL::PixelFormatRG32Sint, 8}, // R32G32_SINT
|
||||||
{MTL::PixelFormatR32Float, 4}, // R32_FLOAT
|
{MTL::PixelFormatR32Float, 4}, // R32_FLOAT
|
||||||
{MTL::PixelFormatR16Float, 2}, // R16_FLOAT
|
{MTL::PixelFormatR16Float, 2}, // R16_FLOAT
|
||||||
{MTL::PixelFormatR16Unorm, 2}, // R16_UNORM
|
{MTL::PixelFormatR16Unorm, 2}, // R16_UNORM
|
||||||
{MTL::PixelFormatR16Snorm, 2}, // R16_SNORM
|
{MTL::PixelFormatR16Snorm, 2}, // R16_SNORM
|
||||||
{MTL::PixelFormatR16Uint, 2}, // R16_UINT
|
{MTL::PixelFormatR16Uint, 2}, // R16_UINT
|
||||||
{MTL::PixelFormatR16Sint, 2}, // R16_SINT
|
{MTL::PixelFormatR16Sint, 2}, // R16_SINT
|
||||||
{MTL::PixelFormatRG16Unorm, 4}, // R16G16_UNORM
|
{MTL::PixelFormatRG16Unorm, 4}, // R16G16_UNORM
|
||||||
{MTL::PixelFormatRG16Float, 4}, // R16G16_FLOAT
|
{MTL::PixelFormatRG16Float, 4}, // R16G16_FLOAT
|
||||||
{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::PixelFormatRGBA32Float, 16}, // R32G32B32_FLOAT TODO
|
{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::PixelFormatRGBA16Float, 8}, // R16G16B16X16_FLOAT TODO
|
{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
|
||||||
{MTL::PixelFormatASTC_8x5_LDR, 0, {0, 0}, false}, // ASTC_2D_8X5_UNORM TODO
|
{MTL::PixelFormatASTC_8x5_LDR, 0, {0, 0}, false}, // ASTC_2D_8X5_UNORM TODO
|
||||||
{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 TODO
|
{MTL::PixelFormatInvalid, 0}, // BC2_SRGB TODO
|
||||||
{MTL::PixelFormatInvalid, 0}, // BC3_SRGB TODO
|
{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::PixelFormatRG8Unorm, 2}, // G4R4_UNORM TODO
|
{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
|
||||||
{MTL::PixelFormatASTC_5x4_sRGB, 0, {0, 0}, false}, // ASTC_2D_5X4_SRGB TODO
|
{MTL::PixelFormatASTC_5x4_sRGB, 0, {0, 0}, false}, // ASTC_2D_5X4_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_5x5_LDR, 0, {0, 0}, false}, // ASTC_2D_5X5_UNORM TODO
|
{MTL::PixelFormatASTC_5x5_LDR, 0, {0, 0}, false}, // ASTC_2D_5X5_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_5x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_5X5_SRGB TODO
|
{MTL::PixelFormatASTC_5x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_5X5_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_10x8_LDR, 0, {0, 0}, false}, // ASTC_2D_10X8_UNORM TODO
|
{MTL::PixelFormatASTC_10x8_LDR, 0, {0, 0}, false}, // ASTC_2D_10X8_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_10x8_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X8_SRGB TODO
|
{MTL::PixelFormatASTC_10x8_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X8_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_6x6_LDR, 0, {0, 0}, false}, // ASTC_2D_6X6_UNORM TODO
|
{MTL::PixelFormatASTC_6x6_LDR, 0, {0, 0}, false}, // ASTC_2D_6X6_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_6x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_6X6_SRGB TODO
|
{MTL::PixelFormatASTC_6x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_6X6_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_10x6_LDR, 0, {0, 0}, false}, // ASTC_2D_10X6_UNORM TODO
|
{MTL::PixelFormatASTC_10x6_LDR, 0, {0, 0}, false}, // ASTC_2D_10X6_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_10x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X6_SRGB TODO
|
{MTL::PixelFormatASTC_10x6_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X6_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_10x5_LDR, 0, {0, 0}, false}, // ASTC_2D_10X5_UNORM TODO
|
{MTL::PixelFormatASTC_10x5_LDR, 0, {0, 0}, false}, // ASTC_2D_10X5_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_10x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X5_SRGB TODO
|
{MTL::PixelFormatASTC_10x5_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X5_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_10x10_LDR, 0, {0, 0}, false}, // ASTC_2D_10X10_UNORM TODO
|
{MTL::PixelFormatASTC_10x10_LDR, 0, {0, 0}, false}, // ASTC_2D_10X10_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_10x10_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X10_SRGB TODO
|
{MTL::PixelFormatASTC_10x10_sRGB, 0, {0, 0}, false}, // ASTC_2D_10X10_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_12x10_LDR, 0, {0, 0}, false}, // ASTC_2D_12X10_UNORM TODO
|
{MTL::PixelFormatASTC_12x10_LDR, 0, {0, 0}, false}, // ASTC_2D_12X10_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_12x10_sRGB, 0, {0, 0}, false}, // ASTC_2D_12X10_SRGB TODO
|
{MTL::PixelFormatASTC_12x10_sRGB, 0, {0, 0}, false}, // ASTC_2D_12X10_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_12x12_LDR, 0, {0, 0}, false}, // ASTC_2D_12X12_UNORM TODO
|
{MTL::PixelFormatASTC_12x12_LDR, 0, {0, 0}, false}, // ASTC_2D_12X12_UNORM TODO
|
||||||
{MTL::PixelFormatASTC_12x12_sRGB, 0, {0, 0}, false}, // ASTC_2D_12X12_SRGB TODO
|
{MTL::PixelFormatASTC_12x12_sRGB, 0, {0, 0}, false}, // ASTC_2D_12X12_SRGB TODO
|
||||||
{MTL::PixelFormatASTC_8x6_LDR, 0, {0, 0}, false}, // ASTC_2D_8X6_UNORM TODO
|
{MTL::PixelFormatASTC_8x6_LDR, 0, {0, 0}, false}, // ASTC_2D_8X6_UNORM TODO
|
||||||
{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 TODO
|
{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 TODO
|
{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 TODO
|
{MTL::PixelFormatInvalid, 0}, // S8_UINT_D24_UNORM TODO
|
||||||
{MTL::PixelFormatDepth32Float_Stencil8, 0}, // D32_FLOAT_S8_UINT
|
{MTL::PixelFormatDepth32Float_Stencil8, 0}, // D32_FLOAT_S8_UINT
|
||||||
}};
|
}};
|
||||||
|
|
||||||
inline const PixelFormatInfo GetPixelFormatInfo(VideoCore::Surface::PixelFormat pixel_format) {
|
inline const PixelFormatInfo GetPixelFormatInfo(VideoCore::Surface::PixelFormat pixel_format) {
|
||||||
|
@ -146,7 +146,8 @@ inline size_t GetTextureBytesPerRow(VideoCore::Surface::PixelFormat pixel_format
|
||||||
format_info.bytes_per_block;
|
format_info.bytes_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MTL::VertexFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) {
|
inline MTL::VertexFormat VertexFormat(Maxwell::VertexAttribute::Type type,
|
||||||
|
Maxwell::VertexAttribute::Size size) {
|
||||||
const MTL::VertexFormat format{([&]() {
|
const MTL::VertexFormat format{([&]() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway:
|
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway:
|
||||||
|
|
|
@ -83,8 +83,8 @@ void BufferCacheRuntime::CopyBuffer(MTL::Buffer* dst_buffer, MTL::Buffer* src_bu
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferCacheRuntime::ClearBuffer(MTL::Buffer* dest_buffer, u32 offset, size_t size, u32 value) {
|
void BufferCacheRuntime::ClearBuffer(MTL::Buffer* dest_buffer, u32 offset, size_t size, u32 value) {
|
||||||
LOG_DEBUG(Render_Metal, "called (buffer: {}, offset: {}, size: {}, value: {})", (void*)dest_buffer,
|
LOG_DEBUG(Render_Metal, "called (buffer: {}, offset: {}, size: {}, value: {})",
|
||||||
offset, size, value);
|
(void*)dest_buffer, offset, size, value);
|
||||||
// TODO: clear buffer
|
// TODO: clear buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,8 +110,7 @@ public:
|
||||||
|
|
||||||
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
|
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
|
||||||
|
|
||||||
void BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size,
|
void BindVertexBuffer(u32 index, MTL::Buffer* buffer, u32 offset, u32 size, u32 stride);
|
||||||
u32 stride);
|
|
||||||
|
|
||||||
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@ struct BoundIndexBuffer {
|
||||||
size_t offset{0};
|
size_t offset{0};
|
||||||
MTL::IndexType index_type;
|
MTL::IndexType index_type;
|
||||||
size_t index_size;
|
size_t index_size;
|
||||||
//MTL::PrimitiveType primitive_topology;
|
// MTL::PrimitiveType primitive_topology;
|
||||||
//u32 num_indices;
|
// u32 num_indices;
|
||||||
//u32 base_vertex;
|
// u32 base_vertex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RenderState {
|
struct RenderState {
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "video_core/buffer_cache/buffer_cache_base.h"
|
#include "video_core/buffer_cache/buffer_cache_base.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
|
#include "video_core/renderer_metal/maxwell_to_mtl.h"
|
||||||
#include "video_core/renderer_metal/mtl_command_recorder.h"
|
#include "video_core/renderer_metal/mtl_command_recorder.h"
|
||||||
#include "video_core/renderer_metal/mtl_device.h"
|
#include "video_core/renderer_metal/mtl_device.h"
|
||||||
#include "video_core/shader_notify.h"
|
#include "video_core/shader_notify.h"
|
||||||
#include "video_core/texture_cache/texture_cache.h"
|
#include "video_core/texture_cache/texture_cache.h"
|
||||||
#include "video_core/texture_cache/texture_cache_base.h"
|
#include "video_core/texture_cache/texture_cache_base.h"
|
||||||
#include "video_core/renderer_metal/maxwell_to_mtl.h"
|
|
||||||
|
|
||||||
namespace Metal {
|
namespace Metal {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -211,8 +211,7 @@ void GraphicsPipeline::MakePipeline(MTL::RenderPassDescriptor* render_pass) {
|
||||||
const auto& regs{maxwell3d->regs};
|
const auto& regs{maxwell3d->regs};
|
||||||
|
|
||||||
// Shader stages
|
// Shader stages
|
||||||
MTL::RenderPipelineDescriptor* desc =
|
MTL::RenderPipelineDescriptor* desc = MTL::RenderPipelineDescriptor::alloc()->init();
|
||||||
MTL::RenderPipelineDescriptor::alloc()->init();
|
|
||||||
desc->setVertexFunction(functions[0]);
|
desc->setVertexFunction(functions[0]);
|
||||||
desc->setFragmentFunction(functions[4]);
|
desc->setFragmentFunction(functions[4]);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ RasterizerMetal::RasterizerMetal(Tegra::GPU& gpu_,
|
||||||
texture_cache_runtime(device, command_recorder, staging_buffer_pool),
|
texture_cache_runtime(device, command_recorder, staging_buffer_pool),
|
||||||
texture_cache(texture_cache_runtime, device_memory),
|
texture_cache(texture_cache_runtime, device_memory),
|
||||||
pipeline_cache(device_memory, device, command_recorder, buffer_cache, texture_cache,
|
pipeline_cache(device_memory, device, command_recorder, buffer_cache, texture_cache,
|
||||||
gpu.ShaderNotify()), accelerate_dma(buffer_cache) {}
|
gpu.ShaderNotify()),
|
||||||
|
accelerate_dma(buffer_cache) {}
|
||||||
RasterizerMetal::~RasterizerMetal() = default;
|
RasterizerMetal::~RasterizerMetal() = default;
|
||||||
|
|
||||||
void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
||||||
|
@ -98,19 +99,24 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
||||||
const DrawParams draw_params{MakeDrawParams(draw_state, instance_count, is_indexed)};
|
const DrawParams draw_params{MakeDrawParams(draw_state, instance_count, is_indexed)};
|
||||||
|
|
||||||
// TODO: get the primitive type
|
// TODO: get the primitive type
|
||||||
MTL::PrimitiveType primitiveType = MTL::PrimitiveTypeTriangle;//MaxwellToMTL::PrimitiveType(draw_state.topology);
|
MTL::PrimitiveType primitiveType =
|
||||||
|
MTL::PrimitiveTypeTriangle; // MaxwellToMTL::PrimitiveType(draw_state.topology);
|
||||||
|
|
||||||
if (is_indexed) {
|
if (is_indexed) {
|
||||||
auto& index_buffer = command_recorder.GetBoundIndexBuffer();
|
auto& index_buffer = command_recorder.GetBoundIndexBuffer();
|
||||||
size_t index_buffer_offset = index_buffer.offset + draw_params.first_index * index_buffer.index_size;
|
size_t index_buffer_offset =
|
||||||
|
index_buffer.offset + draw_params.first_index * index_buffer.index_size;
|
||||||
|
|
||||||
ASSERT(index_buffer_offset % 4 == 0);
|
ASSERT(index_buffer_offset % 4 == 0);
|
||||||
|
|
||||||
command_recorder.GetRenderCommandEncoder()->drawIndexedPrimitives(primitiveType, draw_params.num_vertices, index_buffer.index_type, index_buffer.buffer, index_buffer_offset, draw_params.num_instances,
|
command_recorder.GetRenderCommandEncoder()->drawIndexedPrimitives(
|
||||||
draw_params.base_vertex, draw_params.base_instance);
|
primitiveType, draw_params.num_vertices, index_buffer.index_type, index_buffer.buffer,
|
||||||
|
index_buffer_offset, draw_params.num_instances, draw_params.base_vertex,
|
||||||
|
draw_params.base_instance);
|
||||||
} else {
|
} else {
|
||||||
command_recorder.GetRenderCommandEncoder()->drawPrimitives(primitiveType,
|
command_recorder.GetRenderCommandEncoder()->drawPrimitives(
|
||||||
draw_params.base_vertex, draw_params.num_vertices, draw_params.num_instances, draw_params.base_instance);
|
primitiveType, draw_params.base_vertex, draw_params.num_vertices,
|
||||||
|
draw_params.num_instances, draw_params.base_instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +187,9 @@ void RasterizerMetal::FlushRegion(DAddr addr, u64 size, VideoCommon::CacheType w
|
||||||
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
buffer_cache.DownloadMemory(addr, size);
|
buffer_cache.DownloadMemory(addr, size);
|
||||||
}
|
}
|
||||||
//if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
// if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
||||||
// query_cache.FlushRegion(addr, size);
|
// query_cache.FlushRegion(addr, size);
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RasterizerMetal::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheType which) {
|
bool RasterizerMetal::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheType which) {
|
||||||
|
@ -228,9 +234,9 @@ void RasterizerMetal::InvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheT
|
||||||
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
if ((True(which & VideoCommon::CacheType::BufferCache))) {
|
||||||
buffer_cache.WriteMemory(addr, size);
|
buffer_cache.WriteMemory(addr, size);
|
||||||
}
|
}
|
||||||
//if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
// if ((True(which & VideoCommon::CacheType::QueryCache))) {
|
||||||
// query_cache.InvalidateRegion(addr, size);
|
// query_cache.InvalidateRegion(addr, size);
|
||||||
//}
|
// }
|
||||||
if ((True(which & VideoCommon::CacheType::ShaderCache))) {
|
if ((True(which & VideoCommon::CacheType::ShaderCache))) {
|
||||||
pipeline_cache.InvalidateRegion(addr, size);
|
pipeline_cache.InvalidateRegion(addr, size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ StagingBuffer::StagingBuffer(MTL::Buffer* buffer_, std::span<u8> mapped_span_)
|
||||||
|
|
||||||
StagingBuffer::~StagingBuffer() {
|
StagingBuffer::~StagingBuffer() {
|
||||||
// TODO: uncomment
|
// TODO: uncomment
|
||||||
//buffer->release();
|
// buffer->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
StagingBufferRef StagingBuffer::Ref() const noexcept {
|
StagingBufferRef StagingBuffer::Ref() const noexcept {
|
||||||
|
@ -38,7 +38,7 @@ StagingBufferRef StagingBuffer::Ref() const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use the _MiB suffix
|
// TODO: use the _MiB suffix
|
||||||
constexpr size_t STREAM_BUFFER_SIZE = 128 * 1024 * 1024;//128_MiB;
|
constexpr size_t STREAM_BUFFER_SIZE = 128 * 1024 * 1024; // 128_MiB;
|
||||||
constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
|
constexpr size_t REGION_SIZE = STREAM_BUFFER_SIZE / StagingBufferPool::NUM_SYNCS;
|
||||||
|
|
||||||
StagingBufferPool::StagingBufferPool(const Device& device_, CommandRecorder& command_recorder_)
|
StagingBufferPool::StagingBufferPool(const Device& device_, CommandRecorder& command_recorder_)
|
||||||
|
|
Loading…
Reference in a new issue