1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 14:52:10 +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_d3d11Formats (m_dxvkAdapter),
m_d3d11Options (m_dxvkAdapter->instance()->config()), m_d3d11Options (m_dxvkAdapter->instance()->config()),
m_dxbcOptions (m_dxvkDevice, m_d3d11Options) { 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_context = new D3D11ImmediateContext(this, m_dxvkDevice);
m_d3d10Device = new D3D10Device(this, m_context); m_d3d10Device = new D3D10Device(this, m_context);

View File

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

View File

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