Files
video-v1/vav2/platforms/windows/tests/large-resolution/src/D3D12Manager.h
2025-10-05 22:51:27 +09:00

39 lines
880 B
C++

#pragma once
#include <d3d12.h>
#include <dxgi1_6.h>
#include <windows.h>
#include <stdint.h>
class D3D12Manager
{
public:
D3D12Manager();
~D3D12Manager();
bool Initialize();
void Cleanup();
// Create NV12 texture for CUDA interop
ID3D12Resource* CreateNV12Texture(uint32_t width, uint32_t height);
// Readback D3D12 texture to CPU memory
uint8_t* ReadbackTexture(ID3D12Resource* texture, uint32_t width, uint32_t height);
// Get D3D12 device
ID3D12Device* GetDevice() const { return m_device; }
private:
ID3D12Device* m_device;
ID3D12CommandQueue* m_command_queue;
ID3D12CommandAllocator* m_command_allocator;
ID3D12GraphicsCommandList* m_command_list;
ID3D12Fence* m_fence;
UINT64 m_fence_value;
HANDLE m_fence_event;
bool CreateDevice();
bool CreateCommandObjects();
void WaitForGPU();
};