diff options
| author | 2023-02-18 18:23:36 +0000 | |
|---|---|---|
| committer | 2023-06-03 00:05:31 -0700 | |
| commit | 158a1896ec91c46a43fa3172fa472e6fc7c9eb05 (patch) | |
| tree | c9fefdf4e2a3f948d08bc32211675f19d936139e /src/video_core/renderer_vulkan | |
| parent | Disable push descriptors on adreno drivers (diff) | |
| download | yuzu-158a1896ec91c46a43fa3172fa472e6fc7c9eb05.tar.gz yuzu-158a1896ec91c46a43fa3172fa472e6fc7c9eb05.tar.xz yuzu-158a1896ec91c46a43fa3172fa472e6fc7c9eb05.zip | |
Implement scaled vertex buffer format emulation
These formats are unsupported by mobile GPUs so they need to be emulated in shaders instead.
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/maxwell_to_vk.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp index b75d7220d..9a0b10568 100644 --- a/src/video_core/renderer_vulkan/maxwell_to_vk.cpp +++ b/src/video_core/renderer_vulkan/maxwell_to_vk.cpp | |||
| @@ -347,6 +347,14 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const Device& device, | |||
| 347 | 347 | ||
| 348 | VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, | 348 | VkFormat VertexFormat(const Device& device, Maxwell::VertexAttribute::Type type, |
| 349 | Maxwell::VertexAttribute::Size size) { | 349 | Maxwell::VertexAttribute::Size size) { |
| 350 | if (device.MustEmulateScaledFormats()) { | ||
| 351 | if (type == Maxwell::VertexAttribute::Type::SScaled) { | ||
| 352 | type = Maxwell::VertexAttribute::Type::SInt; | ||
| 353 | } else if (type == Maxwell::VertexAttribute::Type::UScaled) { | ||
| 354 | type = Maxwell::VertexAttribute::Type::UInt; | ||
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 350 | const VkFormat format{([&]() { | 358 | const VkFormat format{([&]() { |
| 351 | switch (type) { | 359 | switch (type) { |
| 352 | case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway: | 360 | case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway: |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index ec55e11b1..e39713761 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -114,14 +114,16 @@ Shader::AttributeType CastAttributeType(const FixedPipelineState::VertexAttribut | |||
| 114 | return Shader::AttributeType::Disabled; | 114 | return Shader::AttributeType::Disabled; |
| 115 | case Maxwell::VertexAttribute::Type::SNorm: | 115 | case Maxwell::VertexAttribute::Type::SNorm: |
| 116 | case Maxwell::VertexAttribute::Type::UNorm: | 116 | case Maxwell::VertexAttribute::Type::UNorm: |
| 117 | case Maxwell::VertexAttribute::Type::UScaled: | ||
| 118 | case Maxwell::VertexAttribute::Type::SScaled: | ||
| 119 | case Maxwell::VertexAttribute::Type::Float: | 117 | case Maxwell::VertexAttribute::Type::Float: |
| 120 | return Shader::AttributeType::Float; | 118 | return Shader::AttributeType::Float; |
| 121 | case Maxwell::VertexAttribute::Type::SInt: | 119 | case Maxwell::VertexAttribute::Type::SInt: |
| 122 | return Shader::AttributeType::SignedInt; | 120 | return Shader::AttributeType::SignedInt; |
| 123 | case Maxwell::VertexAttribute::Type::UInt: | 121 | case Maxwell::VertexAttribute::Type::UInt: |
| 124 | return Shader::AttributeType::UnsignedInt; | 122 | return Shader::AttributeType::UnsignedInt; |
| 123 | case Maxwell::VertexAttribute::Type::UScaled: | ||
| 124 | return Shader::AttributeType::UnsignedScaled; | ||
| 125 | case Maxwell::VertexAttribute::Type::SScaled: | ||
| 126 | return Shader::AttributeType::SignedScaled; | ||
| 125 | } | 127 | } |
| 126 | return Shader::AttributeType::Float; | 128 | return Shader::AttributeType::Float; |
| 127 | } | 129 | } |
| @@ -331,6 +333,7 @@ PipelineCache::PipelineCache(RasterizerVulkan& rasterizer_, const Device& device | |||
| 331 | .support_derivative_control = true, | 333 | .support_derivative_control = true, |
| 332 | .support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(), | 334 | .support_geometry_shader_passthrough = device.IsNvGeometryShaderPassthroughSupported(), |
| 333 | .support_native_ndc = device.IsExtDepthClipControlSupported(), | 335 | .support_native_ndc = device.IsExtDepthClipControlSupported(), |
| 336 | .support_scaled_attributes = !device.MustEmulateScaledFormats(), | ||
| 334 | 337 | ||
| 335 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(), | 338 | .warp_size_potentially_larger_than_guest = device.IsWarpSizePotentiallyBiggerThanGuest(), |
| 336 | 339 | ||