1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-13 07:08:50 +01:00
dxvk/src/d3d9/d3d9_initializer.h
2021-06-29 00:51:20 +02:00

62 lines
1.3 KiB
C++

#pragma once
#include "d3d9_common_buffer.h"
#include "d3d9_common_texture.h"
namespace dxvk {
/**
* \brief Resource initialization context
*
* Manages a context which is used for resource
* initialization. This includes
* zero-initialization for buffers and images.
*/
class D3D9Initializer {
constexpr static size_t MaxTransferMemory = 32 * 1024 * 1024;
constexpr static size_t MaxTransferCommands = 512;
public:
D3D9Initializer(
const Rc<DxvkDevice>& Device);
~D3D9Initializer();
void Flush();
void InitBuffer(
D3D9CommonBuffer* pBuffer);
void InitTexture(
D3D9CommonTexture* pTexture,
void* pInitialData = nullptr);
private:
dxvk::mutex m_mutex;
Rc<DxvkDevice> m_device;
Rc<DxvkContext> m_context;
size_t m_transferCommands = 0;
size_t m_transferMemory = 0;
void InitDeviceLocalBuffer(
DxvkBufferSlice Slice);
void InitHostVisibleBuffer(
DxvkBufferSlice Slice);
void InitDeviceLocalTexture(
D3D9CommonTexture* pTexture);
void InitHostVisibleTexture(
D3D9CommonTexture* pTexture,
void* pInitialData);
void FlushImplicit();
void FlushInternal();
};
}