mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-04 14:02:45 +01:00
renderer_vulkan: work around turnip binding bug in a610
This commit is contained in:
parent
e357896674
commit
fba3fa705d
2 changed files with 23 additions and 13 deletions
|
@ -563,22 +563,27 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
|
||||||
}
|
}
|
||||||
buffer_handles.push_back(handle);
|
buffer_handles.push_back(handle);
|
||||||
}
|
}
|
||||||
|
const u32 device_max = device.GetMaxVertexInputBindings();
|
||||||
|
const u32 min_binding = std::min(bindings.min_index, device_max);
|
||||||
|
const u32 max_binding = std::min(bindings.max_index, device_max);
|
||||||
|
const u32 binding_count = max_binding - min_binding;
|
||||||
|
if (binding_count == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (device.IsExtExtendedDynamicStateSupported()) {
|
if (device.IsExtExtendedDynamicStateSupported()) {
|
||||||
scheduler.Record([this, bindings_ = std::move(bindings),
|
scheduler.Record([bindings_ = std::move(bindings),
|
||||||
buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
|
buffer_handles_ = std::move(buffer_handles),
|
||||||
cmdbuf.BindVertexBuffers2EXT(bindings_.min_index,
|
binding_count](vk::CommandBuffer cmdbuf) {
|
||||||
std::min(bindings_.max_index - bindings_.min_index,
|
cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, binding_count, buffer_handles_.data(),
|
||||||
device.GetMaxVertexInputBindings()),
|
bindings_.offsets.data(), bindings_.sizes.data(),
|
||||||
buffer_handles_.data(), bindings_.offsets.data(),
|
bindings_.strides.data());
|
||||||
bindings_.sizes.data(), bindings_.strides.data());
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
scheduler.Record([this, bindings_ = std::move(bindings),
|
scheduler.Record([bindings_ = std::move(bindings),
|
||||||
buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
|
buffer_handles_ = std::move(buffer_handles),
|
||||||
cmdbuf.BindVertexBuffers(bindings_.min_index,
|
binding_count](vk::CommandBuffer cmdbuf) {
|
||||||
std::min(bindings_.max_index - bindings_.min_index,
|
cmdbuf.BindVertexBuffers(bindings_.min_index, binding_count, buffer_handles_.data(),
|
||||||
device.GetMaxVertexInputBindings()),
|
bindings_.offsets.data());
|
||||||
buffer_handles_.data(), bindings_.offsets.data());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -695,6 +695,11 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
||||||
std::min(properties.properties.limits.maxVertexInputBindings, 16U);
|
std::min(properties.properties.limits.maxVertexInputBindings, 16U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_turnip) {
|
||||||
|
LOG_WARNING(Render_Vulkan, "Turnip requires higher-than-reported binding limits");
|
||||||
|
properties.properties.limits.maxVertexInputBindings = 32;
|
||||||
|
}
|
||||||
|
|
||||||
if (!extensions.extended_dynamic_state && extensions.extended_dynamic_state2) {
|
if (!extensions.extended_dynamic_state && extensions.extended_dynamic_state2) {
|
||||||
LOG_INFO(Render_Vulkan,
|
LOG_INFO(Render_Vulkan,
|
||||||
"Removing extendedDynamicState2 due to missing extendedDynamicState");
|
"Removing extendedDynamicState2 due to missing extendedDynamicState");
|
||||||
|
|
Loading…
Reference in a new issue