mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-29 19:07:04 +02:00
[vulkan] Another take for BindingStride
This commit is contained in:
parent
06a179fb2a
commit
705090c8da
3 changed files with 10 additions and 11 deletions
|
|
@ -555,9 +555,7 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset
|
||||||
if (index >= device.GetMaxVertexInputBindings()) {
|
if (index >= device.GetMaxVertexInputBindings()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const bool use_stride_dynamic = device.IsExtExtendedDynamicStateSupported() &&
|
const bool use_stride_dynamic = use_dynamic_vertex_binding_stride;
|
||||||
!(device.IsExtVertexInputDynamicStateSupported() &&
|
|
||||||
Settings::values.vertex_input_dynamic_state.GetValue());
|
|
||||||
if (use_stride_dynamic) {
|
if (use_stride_dynamic) {
|
||||||
scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) {
|
scheduler.Record([index, buffer, offset, size, stride](vk::CommandBuffer cmdbuf) {
|
||||||
const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0;
|
const VkDeviceSize vk_offset = buffer != VK_NULL_HANDLE ? offset : 0;
|
||||||
|
|
@ -598,14 +596,8 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
|
||||||
if (binding_count == 0) {
|
if (binding_count == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Use BindVertexBuffers2EXT (with stride) only if:
|
const bool use_stride_dynamic = use_dynamic_vertex_binding_stride;
|
||||||
// 1. VK_EXT_extended_dynamic_state is supported (provides VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT)
|
if (use_stride_dynamic) {
|
||||||
// 2. AND VK_EXT_vertex_input_dynamic_state is NOT active (supported + enabled by toggle)
|
|
||||||
// Because VIDS and BINDING_STRIDE are mutually exclusive in the pipeline
|
|
||||||
const bool use_stride_dynamic = device.IsExtExtendedDynamicStateSupported() &&
|
|
||||||
!(device.IsExtVertexInputDynamicStateSupported() &&
|
|
||||||
Settings::values.vertex_input_dynamic_state.GetValue());
|
|
||||||
if (use_stride_dynamic) {
|
|
||||||
scheduler.Record([bindings_ = std::move(bindings),
|
scheduler.Record([bindings_ = std::move(bindings),
|
||||||
buffer_handles_ = std::move(buffer_handles),
|
buffer_handles_ = std::move(buffer_handles),
|
||||||
binding_count](vk::CommandBuffer cmdbuf) {
|
binding_count](vk::CommandBuffer cmdbuf) {
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,10 @@ public:
|
||||||
|
|
||||||
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
||||||
|
|
||||||
|
void SetUseDynamicVertexBindingStride(bool enabled) noexcept {
|
||||||
|
use_dynamic_vertex_binding_stride = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size);
|
void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size);
|
||||||
|
|
||||||
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings);
|
||||||
|
|
@ -185,6 +189,7 @@ private:
|
||||||
|
|
||||||
bool limit_dynamic_storage_buffers = false;
|
bool limit_dynamic_storage_buffers = false;
|
||||||
u32 max_dynamic_storage_buffers = (std::numeric_limits<u32>::max)();
|
u32 max_dynamic_storage_buffers = (std::numeric_limits<u32>::max)();
|
||||||
|
bool use_dynamic_vertex_binding_stride = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BufferCacheParams {
|
struct BufferCacheParams {
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,8 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
std::scoped_lock lock{buffer_cache.mutex, texture_cache.mutex};
|
||||||
|
buffer_cache_runtime.SetUseDynamicVertexBindingStride(
|
||||||
|
pipeline->UsesExtendedDynamicState() && !pipeline->HasDynamicVertexInput());
|
||||||
// update engine as channel may be different.
|
// update engine as channel may be different.
|
||||||
pipeline->SetEngine(maxwell3d, gpu_memory);
|
pipeline->SetEngine(maxwell3d, gpu_memory);
|
||||||
if (!pipeline->Configure(is_indexed))
|
if (!pipeline->Configure(is_indexed))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue