mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Bind dummy resource for unbound vertex and index buffers
Allows GTA V to run, although heavy rendering artifacts remain.
This commit is contained in:
parent
0791c8ca4c
commit
d4a0581f8f
@ -1185,8 +1185,12 @@ namespace dxvk {
|
|||||||
m_flags.clr(DxvkContextFlag::GpDirtyPipelineState);
|
m_flags.clr(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < m_state.gp.state.ilBindingCount; i++) {
|
for (uint32_t i = 0; i < m_state.gp.state.ilBindingCount; i++) {
|
||||||
|
const uint32_t binding = m_state.gp.state.ilBindings[i].binding;
|
||||||
|
|
||||||
m_state.gp.state.ilBindings[i].stride
|
m_state.gp.state.ilBindings[i].stride
|
||||||
= m_state.vi.vertexStrides[m_state.gp.state.ilBindings[i].binding];
|
= (m_state.vi.bindingMask & (1u << binding)) != 0
|
||||||
|
? m_state.vi.vertexStrides[binding]
|
||||||
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t i = m_state.gp.state.ilBindingCount; i < MaxNumVertexBindings; i++)
|
for (uint32_t i = m_state.gp.state.ilBindingCount; i < MaxNumVertexBindings; i++)
|
||||||
@ -1399,6 +1403,10 @@ namespace dxvk {
|
|||||||
m_state.vi.indexType);
|
m_state.vi.indexType);
|
||||||
m_cmd->trackResource(
|
m_cmd->trackResource(
|
||||||
physicalSlice.resource());
|
physicalSlice.resource());
|
||||||
|
} else {
|
||||||
|
m_cmd->cmdBindIndexBuffer(
|
||||||
|
m_device->dummyBufferHandle(),
|
||||||
|
0, VK_INDEX_TYPE_UINT32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1408,6 +1416,8 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers)) {
|
if (m_flags.test(DxvkContextFlag::GpDirtyVertexBuffers)) {
|
||||||
m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers);
|
m_flags.clr(DxvkContextFlag::GpDirtyVertexBuffers);
|
||||||
|
|
||||||
|
uint32_t bindingMask = 0;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < m_state.gp.state.ilBindingCount; i++) {
|
for (uint32_t i = 0; i < m_state.gp.state.ilBindingCount; i++) {
|
||||||
const uint32_t binding = m_state.gp.state.ilBindings[i].binding;
|
const uint32_t binding = m_state.gp.state.ilBindings[i].binding;
|
||||||
|
|
||||||
@ -1419,8 +1429,20 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_cmd->cmdBindVertexBuffers(binding, 1, &handle, &offset);
|
m_cmd->cmdBindVertexBuffers(binding, 1, &handle, &offset);
|
||||||
m_cmd->trackResource(vbo.resource());
|
m_cmd->trackResource(vbo.resource());
|
||||||
|
|
||||||
|
bindingMask |= 1u << binding;
|
||||||
|
} else {
|
||||||
|
const VkBuffer handle = m_device->dummyBufferHandle();
|
||||||
|
const VkDeviceSize offset = 0;
|
||||||
|
|
||||||
|
m_cmd->cmdBindVertexBuffers(binding, 1, &handle, &offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_state.vi.bindingMask != bindingMask) {
|
||||||
|
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
|
m_state.vi.bindingMask = bindingMask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
struct DxvkVertexInputState {
|
struct DxvkVertexInputState {
|
||||||
DxvkBufferSlice indexBuffer;
|
DxvkBufferSlice indexBuffer;
|
||||||
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
VkIndexType indexType = VK_INDEX_TYPE_UINT32;
|
||||||
|
uint32_t bindingMask = 0;
|
||||||
|
|
||||||
std::array<DxvkBufferSlice,
|
std::array<DxvkBufferSlice,
|
||||||
DxvkLimits::MaxNumVertexBindings> vertexBuffers;
|
DxvkLimits::MaxNumVertexBindings> vertexBuffers;
|
||||||
|
@ -275,6 +275,14 @@ namespace dxvk {
|
|||||||
const Rc<DxvkSurface>& surface,
|
const Rc<DxvkSurface>& surface,
|
||||||
const DxvkSwapchainProperties& properties);
|
const DxvkSwapchainProperties& properties);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Dummy buffer handle
|
||||||
|
* \returns Use for unbound vertex buffers.
|
||||||
|
*/
|
||||||
|
VkBuffer dummyBufferHandle() const {
|
||||||
|
return m_unboundResources.bufferHandle();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Dummy buffer descriptor
|
* \brief Dummy buffer descriptor
|
||||||
* \returns Descriptor that points to a dummy buffer
|
* \returns Descriptor that points to a dummy buffer
|
||||||
|
@ -20,10 +20,22 @@ namespace dxvk {
|
|||||||
DxvkUnboundResources(DxvkDevice* dev);
|
DxvkUnboundResources(DxvkDevice* dev);
|
||||||
~DxvkUnboundResources();
|
~DxvkUnboundResources();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Dummy buffer handle
|
||||||
|
*
|
||||||
|
* Returns a handle to a buffer filled
|
||||||
|
* with zeroes. Use for unbound vertex
|
||||||
|
* and index buffers.
|
||||||
|
* \returns Dummy buffer handle
|
||||||
|
*/
|
||||||
|
VkBuffer bufferHandle() const {
|
||||||
|
return m_buffer->slice().handle();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Dummy buffer descriptor
|
* \brief Dummy buffer descriptor
|
||||||
*
|
*
|
||||||
* Points to a tiny buffer with undefined
|
* Points to a small buffer with undefined
|
||||||
* values. Do not access this buffer.
|
* values. Do not access this buffer.
|
||||||
* \returns Dummy buffer descriptor
|
* \returns Dummy buffer descriptor
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user