diff options
| author | 2019-11-08 22:38:26 -0300 | |
|---|---|---|
| committer | 2019-11-14 18:21:42 -0300 | |
| commit | 48a1687f515110b602c64ffbc27eacef3e57a575 (patch) | |
| tree | 16a9945ee8d4f01e2d1a7c0dde0313464e1f9c18 /src/video_core/renderer_vulkan | |
| parent | Merge pull request #3110 from greggameplayer/CompleteRGBA16UI (diff) | |
| download | yuzu-48a1687f515110b602c64ffbc27eacef3e57a575.tar.gz yuzu-48a1687f515110b602c64ffbc27eacef3e57a575.tar.xz yuzu-48a1687f515110b602c64ffbc27eacef3e57a575.zip | |
texture_cache: Drop abstracted ComponentType
Abstracted ComponentType was not being used in a meaningful way.
This commit drops its usage.
There is one place where it was being used to test compatibility between
two cached surfaces, but this one is implied in the pixel format.
Removing the component type test doesn't change the behaviour.
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 142 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.h | 3 |
2 files changed, 71 insertions, 74 deletions
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index 3c5acda3e..463ed43ae 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -95,83 +95,82 @@ vk::CompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compar | |||
| 95 | } // namespace Sampler | 95 | } // namespace Sampler |
| 96 | 96 | ||
| 97 | struct FormatTuple { | 97 | struct FormatTuple { |
| 98 | vk::Format format; ///< Vulkan format | 98 | vk::Format format; ///< Vulkan format |
| 99 | ComponentType component_type; ///< Abstracted component type | 99 | bool attachable; ///< True when this format can be used as an attachment |
| 100 | bool attachable; ///< True when this format can be used as an attachment | ||
| 101 | }; | 100 | }; |
| 102 | 101 | ||
| 103 | static constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{ | 102 | static constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> tex_format_tuples = {{ |
| 104 | {vk::Format::eA8B8G8R8UnormPack32, ComponentType::UNorm, true}, // ABGR8U | 103 | {vk::Format::eA8B8G8R8UnormPack32, true}, // ABGR8U |
| 105 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ABGR8S | 104 | {vk::Format::eUndefined, false}, // ABGR8S |
| 106 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ABGR8UI | 105 | {vk::Format::eUndefined, false}, // ABGR8UI |
| 107 | {vk::Format::eB5G6R5UnormPack16, ComponentType::UNorm, false}, // B5G6R5U | 106 | {vk::Format::eB5G6R5UnormPack16, false}, // B5G6R5U |
| 108 | {vk::Format::eA2B10G10R10UnormPack32, ComponentType::UNorm, true}, // A2B10G10R10U | 107 | {vk::Format::eA2B10G10R10UnormPack32, true}, // A2B10G10R10U |
| 109 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // A1B5G5R5U | 108 | {vk::Format::eUndefined, false}, // A1B5G5R5U |
| 110 | {vk::Format::eR8Unorm, ComponentType::UNorm, true}, // R8U | 109 | {vk::Format::eR8Unorm, true}, // R8U |
| 111 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R8UI | 110 | {vk::Format::eUndefined, false}, // R8UI |
| 112 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBA16F | 111 | {vk::Format::eUndefined, false}, // RGBA16F |
| 113 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBA16U | 112 | {vk::Format::eUndefined, false}, // RGBA16U |
| 114 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBA16UI | 113 | {vk::Format::eUndefined, false}, // RGBA16UI |
| 115 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R11FG11FB10F | 114 | {vk::Format::eUndefined, false}, // R11FG11FB10F |
| 116 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBA32UI | 115 | {vk::Format::eUndefined, false}, // RGBA32UI |
| 117 | {vk::Format::eBc1RgbaUnormBlock, ComponentType::UNorm, false}, // DXT1 | 116 | {vk::Format::eBc1RgbaUnormBlock, false}, // DXT1 |
| 118 | {vk::Format::eBc2UnormBlock, ComponentType::UNorm, false}, // DXT23 | 117 | {vk::Format::eBc2UnormBlock, false}, // DXT23 |
| 119 | {vk::Format::eBc3UnormBlock, ComponentType::UNorm, false}, // DXT45 | 118 | {vk::Format::eBc3UnormBlock, false}, // DXT45 |
| 120 | {vk::Format::eBc4UnormBlock, ComponentType::UNorm, false}, // DXN1 | 119 | {vk::Format::eBc4UnormBlock, false}, // DXN1 |
| 121 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // DXN2UNORM | 120 | {vk::Format::eUndefined, false}, // DXN2UNORM |
| 122 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // DXN2SNORM | 121 | {vk::Format::eUndefined, false}, // DXN2SNORM |
| 123 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BC7U | 122 | {vk::Format::eUndefined, false}, // BC7U |
| 124 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BC6H_UF16 | 123 | {vk::Format::eUndefined, false}, // BC6H_UF16 |
| 125 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BC6H_SF16 | 124 | {vk::Format::eUndefined, false}, // BC6H_SF16 |
| 126 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_4X4 | 125 | {vk::Format::eUndefined, false}, // ASTC_2D_4X4 |
| 127 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BGRA8 | 126 | {vk::Format::eUndefined, false}, // BGRA8 |
| 128 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBA32F | 127 | {vk::Format::eUndefined, false}, // RGBA32F |
| 129 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG32F | 128 | {vk::Format::eUndefined, false}, // RG32F |
| 130 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R32F | 129 | {vk::Format::eUndefined, false}, // R32F |
| 131 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R16F | 130 | {vk::Format::eUndefined, false}, // R16F |
| 132 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R16U | 131 | {vk::Format::eUndefined, false}, // R16U |
| 133 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R16S | 132 | {vk::Format::eUndefined, false}, // R16S |
| 134 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R16UI | 133 | {vk::Format::eUndefined, false}, // R16UI |
| 135 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R16I | 134 | {vk::Format::eUndefined, false}, // R16I |
| 136 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG16 | 135 | {vk::Format::eUndefined, false}, // RG16 |
| 137 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG16F | 136 | {vk::Format::eUndefined, false}, // RG16F |
| 138 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG16UI | 137 | {vk::Format::eUndefined, false}, // RG16UI |
| 139 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG16I | 138 | {vk::Format::eUndefined, false}, // RG16I |
| 140 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG16S | 139 | {vk::Format::eUndefined, false}, // RG16S |
| 141 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGB32F | 140 | {vk::Format::eUndefined, false}, // RGB32F |
| 142 | {vk::Format::eA8B8G8R8SrgbPack32, ComponentType::UNorm, true}, // RGBA8_SRGB | 141 | {vk::Format::eA8B8G8R8SrgbPack32, true}, // RGBA8_SRGB |
| 143 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG8U | 142 | {vk::Format::eUndefined, false}, // RG8U |
| 144 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG8S | 143 | {vk::Format::eUndefined, false}, // RG8S |
| 145 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RG32UI | 144 | {vk::Format::eUndefined, false}, // RG32UI |
| 146 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // RGBX16F | 145 | {vk::Format::eUndefined, false}, // RGBX16F |
| 147 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // R32UI | 146 | {vk::Format::eUndefined, false}, // R32UI |
| 148 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_8X8 | 147 | {vk::Format::eUndefined, false}, // ASTC_2D_8X8 |
| 149 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_8X5 | 148 | {vk::Format::eUndefined, false}, // ASTC_2D_8X5 |
| 150 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_5X4 | 149 | {vk::Format::eUndefined, false}, // ASTC_2D_5X4 |
| 151 | 150 | ||
| 152 | // Compressed sRGB formats | 151 | // Compressed sRGB formats |
| 153 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BGRA8_SRGB | 152 | {vk::Format::eUndefined, false}, // BGRA8_SRGB |
| 154 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // DXT1_SRGB | 153 | {vk::Format::eUndefined, false}, // DXT1_SRGB |
| 155 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // DXT23_SRGB | 154 | {vk::Format::eUndefined, false}, // DXT23_SRGB |
| 156 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // DXT45_SRGB | 155 | {vk::Format::eUndefined, false}, // DXT45_SRGB |
| 157 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // BC7U_SRGB | 156 | {vk::Format::eUndefined, false}, // BC7U_SRGB |
| 158 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_4X4_SRGB | 157 | {vk::Format::eUndefined, false}, // ASTC_2D_4X4_SRGB |
| 159 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_8X8_SRGB | 158 | {vk::Format::eUndefined, false}, // ASTC_2D_8X8_SRGB |
| 160 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_8X5_SRGB | 159 | {vk::Format::eUndefined, false}, // ASTC_2D_8X5_SRGB |
| 161 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_5X4_SRGB | 160 | {vk::Format::eUndefined, false}, // ASTC_2D_5X4_SRGB |
| 162 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_5X5 | 161 | {vk::Format::eUndefined, false}, // ASTC_2D_5X5 |
| 163 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_5X5_SRGB | 162 | {vk::Format::eUndefined, false}, // ASTC_2D_5X5_SRGB |
| 164 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_10X8 | 163 | {vk::Format::eUndefined, false}, // ASTC_2D_10X8 |
| 165 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // ASTC_2D_10X8_SRGB | 164 | {vk::Format::eUndefined, false}, // ASTC_2D_10X8_SRGB |
| 166 | 165 | ||
| 167 | // Depth formats | 166 | // Depth formats |
| 168 | {vk::Format::eD32Sfloat, ComponentType::Float, true}, // Z32F | 167 | {vk::Format::eD32Sfloat, true}, // Z32F |
| 169 | {vk::Format::eD16Unorm, ComponentType::UNorm, true}, // Z16 | 168 | {vk::Format::eD16Unorm, true}, // Z16 |
| 170 | 169 | ||
| 171 | // DepthStencil formats | 170 | // DepthStencil formats |
| 172 | {vk::Format::eD24UnormS8Uint, ComponentType::UNorm, true}, // Z24S8 | 171 | {vk::Format::eD24UnormS8Uint, true}, // Z24S8 |
| 173 | {vk::Format::eD24UnormS8Uint, ComponentType::UNorm, true}, // S8Z24 (emulated) | 172 | {vk::Format::eD24UnormS8Uint, true}, // S8Z24 (emulated) |
| 174 | {vk::Format::eUndefined, ComponentType::Invalid, false}, // Z32FS8 | 173 | {vk::Format::eUndefined, false}, // Z32FS8 |
| 175 | }}; | 174 | }}; |
| 176 | 175 | ||
| 177 | static constexpr bool IsZetaFormat(PixelFormat pixel_format) { | 176 | static constexpr bool IsZetaFormat(PixelFormat pixel_format) { |
| @@ -180,14 +179,13 @@ static constexpr bool IsZetaFormat(PixelFormat pixel_format) { | |||
| 180 | } | 179 | } |
| 181 | 180 | ||
| 182 | std::pair<vk::Format, bool> SurfaceFormat(const VKDevice& device, FormatType format_type, | 181 | std::pair<vk::Format, bool> SurfaceFormat(const VKDevice& device, FormatType format_type, |
| 183 | PixelFormat pixel_format, ComponentType component_type) { | 182 | PixelFormat pixel_format) { |
| 184 | ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size()); | 183 | ASSERT(static_cast<std::size_t>(pixel_format) < tex_format_tuples.size()); |
| 185 | 184 | ||
| 186 | const auto tuple = tex_format_tuples[static_cast<u32>(pixel_format)]; | 185 | const auto tuple = tex_format_tuples[static_cast<u32>(pixel_format)]; |
| 187 | UNIMPLEMENTED_IF_MSG(tuple.format == vk::Format::eUndefined, | 186 | UNIMPLEMENTED_IF_MSG(tuple.format == vk::Format::eUndefined, |
| 188 | "Unimplemented texture format with pixel format={} and component type={}", | 187 | "Unimplemented texture format with pixel format={}", |
| 189 | static_cast<u32>(pixel_format), static_cast<u32>(component_type)); | 188 | static_cast<u32>(pixel_format)); |
| 190 | ASSERT_MSG(component_type == tuple.component_type, "Component type mismatch"); | ||
| 191 | 189 | ||
| 192 | auto usage = vk::FormatFeatureFlagBits::eSampledImage | | 190 | auto usage = vk::FormatFeatureFlagBits::eSampledImage | |
| 193 | vk::FormatFeatureFlagBits::eTransferDst | vk::FormatFeatureFlagBits::eTransferSrc; | 191 | vk::FormatFeatureFlagBits::eTransferDst | vk::FormatFeatureFlagBits::eTransferSrc; |
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.h b/src/video_core/renderer_vulkan/maxwell_to_vk.h index 4cadc0721..5b0ffd87a 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.h +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.h | |||
| @@ -16,7 +16,6 @@ namespace Vulkan::MaxwellToVK { | |||
| 16 | 16 | ||
| 17 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 17 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
| 18 | using PixelFormat = VideoCore::Surface::PixelFormat; | 18 | using PixelFormat = VideoCore::Surface::PixelFormat; |
| 19 | using ComponentType = VideoCore::Surface::ComponentType; | ||
| 20 | 19 | ||
| 21 | namespace Sampler { | 20 | namespace Sampler { |
| 22 | 21 | ||
| @@ -31,7 +30,7 @@ vk::CompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compar | |||
| 31 | } // namespace Sampler | 30 | } // namespace Sampler |
| 32 | 31 | ||
| 33 | std::pair<vk::Format, bool> SurfaceFormat(const VKDevice& device, FormatType format_type, | 32 | std::pair<vk::Format, bool> SurfaceFormat(const VKDevice& device, FormatType format_type, |
| 34 | PixelFormat pixel_format, ComponentType component_type); | 33 | PixelFormat pixel_format); |
| 35 | 34 | ||
| 36 | vk::ShaderStageFlagBits ShaderStage(Maxwell::ShaderStage stage); | 35 | vk::ShaderStageFlagBits ShaderStage(Maxwell::ShaderStage stage); |
| 37 | 36 | ||