Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-08-23 15:54:42 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-08-24 14:12:07 +0300
commit64828e2c6c1eef17a221888da203c43ac8a5ae15 (patch)
tree7aec765399ba82a60de0060ab06c70ed2ba45404
parenta4f2a49a023ef0747b87bcde24d5f4c3f17546b5 (diff)
[dxvk] Use vkCmdBindIndexBuffer2 if supported
-rw-r--r--src/dxvk/dxvk_cmdlist.h10
-rw-r--r--src/dxvk/dxvk_context.cpp20
-rw-r--r--src/dxvk/dxvk_context_state.h1
3 files changed, 27 insertions, 4 deletions
diff --git a/src/dxvk/dxvk_cmdlist.h b/src/dxvk/dxvk_cmdlist.h
index ca8e5d44..b9b9a165 100644
--- a/src/dxvk/dxvk_cmdlist.h
+++ b/src/dxvk/dxvk_cmdlist.h
@@ -467,6 +467,16 @@ namespace dxvk {
}
+ void cmdBindIndexBuffer2(
+ VkBuffer buffer,
+ VkDeviceSize offset,
+ VkDeviceSize size,
+ VkIndexType indexType) {
+ m_vkd->vkCmdBindIndexBuffer2KHR(m_cmd.execBuffer,
+ buffer, offset, size, indexType);
+ }
+
+
void cmdBindPipeline(
VkPipelineBindPoint pipelineBindPoint,
VkPipeline pipeline) {
diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp
index 61ad7016..80c2620d 100644
--- a/src/dxvk/dxvk_context.cpp
+++ b/src/dxvk/dxvk_context.cpp
@@ -61,6 +61,10 @@ namespace dxvk {
// requested rasterizer sample count changes
if (m_device->features().core.features.variableMultisampleRate)
m_features.set(DxvkContextFeature::VariableMultisampleRate);
+
+ // Maintenance5 introduced a bounded BindIndexBuffer function
+ if (m_device->features().khrMaintenance5.maintenance5)
+ m_features.set(DxvkContextFeature::IndexBufferRobustness);
}
@@ -5589,10 +5593,18 @@ namespace dxvk {
m_flags.clr(DxvkContextFlag::GpDirtyIndexBuffer);
auto bufferInfo = m_state.vi.indexBuffer.getDescriptor();
- m_cmd->cmdBindIndexBuffer(
- bufferInfo.buffer.buffer,
- bufferInfo.buffer.offset,
- m_state.vi.indexType);
+ if (m_features.test(DxvkContextFeature::IndexBufferRobustness)) {
+ m_cmd->cmdBindIndexBuffer2(
+ bufferInfo.buffer.buffer,
+ bufferInfo.buffer.offset,
+ bufferInfo.buffer.range,
+ m_state.vi.indexType);
+ } else {
+ m_cmd->cmdBindIndexBuffer(
+ bufferInfo.buffer.buffer,
+ bufferInfo.buffer.offset,
+ m_state.vi.indexType);
+ }
if (m_vbTracked.set(MaxNumVertexBindings))
m_cmd->trackResource<DxvkAccess::Read>(m_state.vi.indexBuffer.buffer());
diff --git a/src/dxvk/dxvk_context_state.h b/src/dxvk/dxvk_context_state.h
index 23f2e248..b6066cb8 100644
--- a/src/dxvk/dxvk_context_state.h
+++ b/src/dxvk/dxvk_context_state.h
@@ -65,6 +65,7 @@ namespace dxvk {
enum class DxvkContextFeature : uint32_t {
TrackGraphicsPipeline,
VariableMultisampleRate,
+ IndexBufferRobustness,
FeatureCount
};