1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[d3d11] Implement depth-stencil uploads in resource initializer

This commit is contained in:
Philip Rebohle 2019-03-26 17:49:14 +01:00
parent fc3515c16f
commit 302c6b5e6c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 31 additions and 11 deletions

View File

@ -39,7 +39,7 @@ namespace dxvk {
m_d3d11Formats (m_dxvkAdapter),
m_d3d11Options (m_dxvkAdapter->instance()->config()),
m_dxbcOptions (m_dxvkDevice, m_d3d11Options) {
m_initializer = new D3D11Initializer(m_dxvkDevice);
m_initializer = new D3D11Initializer(this);
m_context = new D3D11ImmediateContext(this, m_dxvkDevice);
m_d3d10Device = new D3D10Device(this, m_context);

View File

@ -1,12 +1,15 @@
#include <cstring>
#include "d3d11_device.h"
#include "d3d11_initializer.h"
namespace dxvk {
D3D11Initializer::D3D11Initializer(
const Rc<DxvkDevice>& Device)
: m_device(Device), m_context(m_device->createContext()) {
D3D11Device* pParent)
: m_parent(pParent),
m_device(pParent->GetDXVKDevice()),
m_context(m_device->createContext()) {
m_context->beginRecording(
m_device->createCommandList());
}
@ -104,6 +107,9 @@ namespace dxvk {
Rc<DxvkImage> image = pTexture->GetImage();
VkFormat packedFormat = m_parent->LookupPackedFormat(
pTexture->Desc()->Format, pTexture->GetFormatMode()).Format;
auto formatInfo = imageFormatInfo(image->info().format);
if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) {
@ -131,13 +137,24 @@ namespace dxvk {
m_transferMemory += util::computeImageDataSize(
image->info().format, mipLevelExtent);
m_context->updateImage(
image, subresourceLayers,
mipLevelOffset,
mipLevelExtent,
pInitialData[id].pSysMem,
pInitialData[id].SysMemPitch,
pInitialData[id].SysMemSlicePitch);
if (formatInfo->aspectMask != (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
m_context->updateImage(
image, subresourceLayers,
mipLevelOffset,
mipLevelExtent,
pInitialData[id].pSysMem,
pInitialData[id].SysMemPitch,
pInitialData[id].SysMemSlicePitch);
} else {
m_context->updateDepthStencilImage(
image, subresourceLayers,
VkOffset2D { mipLevelOffset.x, mipLevelOffset.y },
VkExtent2D { mipLevelExtent.width, mipLevelExtent.height },
pInitialData[id].pSysMem,
pInitialData[id].SysMemPitch,
pInitialData[id].SysMemSlicePitch,
packedFormat);
}
}
}
} else {

View File

@ -5,6 +5,8 @@
namespace dxvk {
class D3D11Device;
/**
* \brief Resource initialization context
*
@ -19,7 +21,7 @@ namespace dxvk {
public:
D3D11Initializer(
const Rc<DxvkDevice>& Device);
D3D11Device* pParent);
~D3D11Initializer();
@ -37,6 +39,7 @@ namespace dxvk {
std::mutex m_mutex;
D3D11Device* m_parent;
Rc<DxvkDevice> m_device;
Rc<DxvkContext> m_context;