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

[d3d11] Use Map() for host-visible buffers in UpdateSubresource

This commit is contained in:
Philip Rebohle 2018-01-23 12:16:28 +01:00
parent 3148155c35
commit 2c20bf4dcb
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 6 additions and 14 deletions

View File

@ -30,7 +30,7 @@ namespace dxvk {
} }
UINT D3D11CommandList::GetContextFlags() { UINT STDMETHODCALLTYPE D3D11CommandList::GetContextFlags() {
return m_contextFlags; return m_contextFlags;
} }

View File

@ -21,7 +21,7 @@ namespace dxvk {
void STDMETHODCALLTYPE GetDevice( void STDMETHODCALLTYPE GetDevice(
ID3D11Device **ppDevice) final; ID3D11Device **ppDevice) final;
UINT GetContextFlags(); UINT STDMETHODCALLTYPE GetContextFlags() final;
void AddChunk(Rc<DxvkCsChunk>&& Chunk); void AddChunk(Rc<DxvkCsChunk>&& Chunk);

View File

@ -564,18 +564,10 @@ namespace dxvk {
if (((size == bufferSlice.length()) if (((size == bufferSlice.length())
&& (bufferSlice.buffer()->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))) { && (bufferSlice.buffer()->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))) {
auto physicalSlice = bufferSlice.buffer()->allocPhysicalSlice(); D3D11_MAPPED_SUBRESOURCE mappedSr;
physicalSlice.resource()->acquire(); Map(pDstResource, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedSr);
std::memcpy(mappedSr.pData, pSrcData, size);
std::memcpy(physicalSlice.mapPtr(0), pSrcData, size); Unmap(pDstResource, 0);
EmitCs([
cDstBuffer = bufferSlice.buffer(),
cPhysicalSlice = std::move(physicalSlice)
] (DxvkContext* ctx) {
ctx->invalidateBuffer(cDstBuffer, cPhysicalSlice);
cPhysicalSlice.resource()->release();
});
} else { } else {
EmitCs([ EmitCs([
cDataBuffer = Rc<DxvkDataBuffer>(new DxvkDataBuffer(pSrcData, size)), cDataBuffer = Rc<DxvkDataBuffer>(new DxvkDataBuffer(pSrcData, size)),