1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d11] Implemented vertex buffer binding

This commit is contained in:
Philip Rebohle 2017-12-07 14:03:15 +01:00
parent a901a85401
commit 05ef218326
4 changed files with 47 additions and 1 deletions

View File

@ -60,4 +60,9 @@ namespace dxvk {
*pDesc = m_desc;
}
Rc<DxvkBuffer> D3D11Buffer::GetDXVKBuffer() {
return m_resource->GetDXVKBuffer();
}
}

View File

@ -37,6 +37,8 @@ namespace dxvk {
void GetDesc(
D3D11_BUFFER_DESC *pDesc) final;
Rc<DxvkBuffer> GetDXVKBuffer();
private:
D3D11Device* const m_device;

View File

@ -517,7 +517,29 @@ namespace dxvk {
ID3D11Buffer* const* ppVertexBuffers,
const UINT* pStrides,
const UINT* pOffsets) {
Logger::err("D3D11DeviceContext::IASetVertexBuffers: Not implemented");
// TODO check if any of these buffers
// are bound as UAVs or stream outputs
for (uint32_t i = 0; i < NumBuffers; i++) {
D3D11VertexBufferBinding binding;
binding.buffer = static_cast<D3D11Buffer*>(ppVertexBuffers[i]);
binding.offset = pOffsets[i];
binding.stride = pStrides[i];
m_state.ia.vertexBuffers.at(StartSlot + i) = binding;
DxvkBufferBinding dxvkBinding;
if (binding.buffer != nullptr) {
Rc<DxvkBuffer> dxvkBuffer = binding.buffer->GetDXVKBuffer();
dxvkBinding = DxvkBufferBinding(
dxvkBuffer, binding.offset,
dxvkBuffer->info().size - binding.offset);
}
m_context->bindVertexBuffer(
StartSlot + i, dxvkBinding,
binding.stride);
}
}

View File

@ -61,9 +61,26 @@ namespace dxvk {
};
struct D3D11VertexBufferBinding {
Com<D3D11Buffer> buffer = nullptr;
UINT offset = 0;
UINT stride = 0;
};
struct D3D11IndexBufferBinding {
Com<D3D11Buffer> buffer = nullptr;
UINT offset = 0;
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
};
struct D3D11ContextStateIA {
Com<D3D11InputLayout> inputLayout;
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers;
D3D11IndexBufferBinding indexBuffer;
};