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:
parent
fc3515c16f
commit
302c6b5e6c
@ -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);
|
||||||
|
|
||||||
|
@ -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,13 +137,24 @@ namespace dxvk {
|
|||||||
m_transferMemory += util::computeImageDataSize(
|
m_transferMemory += util::computeImageDataSize(
|
||||||
image->info().format, mipLevelExtent);
|
image->info().format, mipLevelExtent);
|
||||||
|
|
||||||
m_context->updateImage(
|
if (formatInfo->aspectMask != (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||||
image, subresourceLayers,
|
m_context->updateImage(
|
||||||
mipLevelOffset,
|
image, subresourceLayers,
|
||||||
mipLevelExtent,
|
mipLevelOffset,
|
||||||
pInitialData[id].pSysMem,
|
mipLevelExtent,
|
||||||
pInitialData[id].SysMemPitch,
|
pInitialData[id].pSysMem,
|
||||||
pInitialData[id].SysMemSlicePitch);
|
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 {
|
} else {
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user