From 88bdf2b5920dd2533993e3b74965d766420f91a2 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 7 Aug 2022 16:48:05 +0200 Subject: [PATCH] [dxvk] Use vertex extent from vertex binding info Computing this at runtime is fairly expensive, so try to avoid. --- src/dxvk/dxvk_context.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 8d74b436..52908ca9 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2371,20 +2371,18 @@ namespace dxvk { m_state.gp.state.ilBindings[i] = DxvkIlBinding( bindings[i].binding, 0, bindings[i].inputRate, bindings[i].fetchRate); - m_state.vi.vertexExtents[bindings[i].binding] = 0; + m_state.vi.vertexExtents[i] = bindings[i].extent; } - for (uint32_t i = bindingCount; i < m_state.gp.state.il.bindingCount(); i++) + for (uint32_t i = bindingCount; i < m_state.gp.state.il.bindingCount(); i++) { m_state.gp.state.ilBindings[i] = DxvkIlBinding(); + m_state.vi.vertexExtents[i] = 0; + } for (uint32_t i = 0; i < attributeCount; i++) { m_state.gp.state.ilAttributes[i] = DxvkIlAttribute( attributes[i].location, attributes[i].binding, attributes[i].format, attributes[i].offset); - - uint32_t extent = attributes[i].offset + lookupFormatInfo(attributes[i].format)->elementSize; - m_state.vi.vertexExtents[attributes[i].binding] = std::max(extent, - m_state.vi.vertexExtents[attributes[i].binding]); } for (uint32_t i = attributeCount; i < m_state.gp.state.il.attributeCount(); i++) @@ -5137,7 +5135,7 @@ namespace dxvk { if (strides[i]) { // Dynamic strides are only allowed if the stride is not smaller // than highest attribute offset + format size for given binding - newDynamicStrides &= strides[i] >= m_state.vi.vertexExtents[binding]; + newDynamicStrides &= strides[i] >= m_state.vi.vertexExtents[i]; } if (m_vbTracked.set(binding))