#pragma once

#include "Betriebssystem.h"
#include "ReferenceCounter.h"

//! DirectX12 Datentypen
struct ID3D12CommandAllocator;
struct ID3D12CommandQueue;
struct ID3D12Fence;
struct ID3D12Device;
struct ID3D12GraphicsCommandList;

namespace Framework
{
    class DX12Command;

    class DX12CommandQueue : public virtual ReferenceCounter
    {
    protected:
        ID3D12CommandAllocator* allocator;
        ID3D12GraphicsCommandList* commandList;
        ID3D12CommandQueue* queue;
        ID3D12Fence* fence;
        ID3D12Device* device;
        HANDLE event;
        unsigned __int64 fenceValue;

        DX12CommandQueue(int typ, ID3D12Device* device);

    public:
        virtual ~DX12CommandQueue();
        unsigned __int64 addSignalFromGPU();
        void whaitForGPUSignal();
        void whaitForGPUSignal(unsigned __int64 value);
        void flush();
        ID3D12CommandAllocator* getAllocator() const;
        ID3D12GraphicsCommandList* getCommandList() const;
        ID3D12CommandQueue* getQueue() const;
        void execute();
    };

    class DX12DirectCommandQueue : public DX12CommandQueue
    {
    public:
        DX12DirectCommandQueue(ID3D12Device* device);
    };

    class DX12CopyCommandQueue : public DX12CommandQueue
    {
    public:
        DX12CopyCommandQueue(ID3D12Device* device);
    };

    class DX12ComputeCommandQueue : public DX12CommandQueue
    {
    public:
        DX12ComputeCommandQueue(ID3D12Device* device);
    };
}; // namespace Framework