Remove legacy RHI header files
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Enums.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class ICommandAllocator {
|
||||
public:
|
||||
virtual ~ICommandAllocator() = default;
|
||||
virtual void Reset() = 0;
|
||||
virtual bool IsReady() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,79 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Enums.h"
|
||||
#include "Types.h"
|
||||
#include "Resource.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class ICommandAllocator;
|
||||
class IPipelineState;
|
||||
class IRootSignature;
|
||||
class IDescriptorHeap;
|
||||
class IQueryHeap;
|
||||
class IBuffer;
|
||||
class ITexture;
|
||||
class IRenderTargetView;
|
||||
class IDepthStencilView;
|
||||
class IShaderResourceView;
|
||||
|
||||
class ICommandList {
|
||||
public:
|
||||
virtual ~ICommandList() = default;
|
||||
|
||||
virtual void TransitionBarrier(uint32_t count, const ResourceBarrierDesc* barriers) = 0;
|
||||
virtual void UAVBarrier(IResource* resource = nullptr) = 0;
|
||||
virtual void AliasBarrier(IResource* before, IResource* after) = 0;
|
||||
|
||||
virtual void SetPipelineState(IPipelineState* pso) = 0;
|
||||
virtual void SetRootSignature(IRootSignature* signature) = 0;
|
||||
virtual void SetViewport(const Viewport& viewport) = 0;
|
||||
virtual void SetViewports(uint32_t count, const Viewport* viewports) = 0;
|
||||
virtual void SetScissorRect(const Rect& rect) = 0;
|
||||
virtual void SetScissorRects(uint32_t count, const Rect* rects) = 0;
|
||||
virtual void SetPrimitiveTopology(PrimitiveTopology topology) = 0;
|
||||
virtual void SetRenderTargets(uint32_t count, IResource** renderTargets, IResource* depthStencil) = 0;
|
||||
|
||||
virtual void SetVertexBuffer(uint32_t slot, IBuffer* buffer, uint32_t offset, uint32_t stride) = 0;
|
||||
virtual void SetVertexBuffers(uint32_t startSlot, uint32_t count, const VertexBufferBinding* bindings) = 0;
|
||||
virtual void SetIndexBuffer(IBuffer* buffer, uint32_t offset, Format indexFormat) = 0;
|
||||
virtual void SetConstantBuffer(uint32_t rootParameterIndex, IBuffer* buffer, uint32_t offset, uint32_t size) = 0;
|
||||
virtual void SetShaderResource(uint32_t rootParameterIndex, IResource* resource) = 0;
|
||||
virtual void SetUnorderedAccess(uint32_t rootParameterIndex, IResource* resource) = 0;
|
||||
virtual void SetDescriptorHeap(IDescriptorHeap* heap) = 0;
|
||||
virtual void SetGraphicsDescriptorTable(uint32_t rootParameterIndex, GPUDescriptorHandle baseHandle) = 0;
|
||||
virtual void SetComputeDescriptorTable(uint32_t rootParameterIndex, GPUDescriptorHandle baseHandle) = 0;
|
||||
|
||||
virtual void SetStencilRef(uint8_t stencilRef) = 0;
|
||||
virtual void SetBlendFactor(const float blendFactor[4]) = 0;
|
||||
virtual void SetDepthBias(float depthBias, float slopeScaledDepthBias, float depthBiasClamp) = 0;
|
||||
|
||||
virtual void Draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t startVertex, uint32_t startInstance) = 0;
|
||||
virtual void DrawIndexed(uint32_t indexCount, uint32_t instanceCount, uint32_t startIndex, int32_t baseVertex, uint32_t startInstance) = 0;
|
||||
virtual void DrawInstancedIndirect(IBuffer* argBuffer, uint32_t alignedByteOffset) = 0;
|
||||
virtual void DrawIndexedInstancedIndirect(IBuffer* argBuffer, uint32_t alignedByteOffset) = 0;
|
||||
|
||||
virtual void ClearRenderTargetView(IResource* renderTarget, const float color[4]) = 0;
|
||||
virtual void ClearDepthStencilView(IResource* depthStencil, uint32_t clearFlags, float depth, uint8_t stencil) = 0;
|
||||
virtual void ClearUnorderedAccessView(IResource* unorderedAccess, const float values[4]) = 0;
|
||||
|
||||
virtual void CopyResource(IResource* dst, IResource* src) = 0;
|
||||
virtual void CopyBuffer(IBuffer* dst, uint64_t dstOffset, IBuffer* src, uint64_t srcOffset, uint64_t size) = 0;
|
||||
virtual void CopyTexture(ITexture* dst, const TextureCopyLocation& dstLocation, ITexture* src, const TextureCopyLocation& srcLocation) = 0;
|
||||
|
||||
virtual void BeginQuery(IQueryHeap* queryHeap, QueryType type, uint32_t index) = 0;
|
||||
virtual void EndQuery(IQueryHeap* queryHeap, QueryType type, uint32_t index) = 0;
|
||||
virtual void ResolveQueryData(IQueryHeap* queryHeap, QueryType type, uint32_t startIndex, uint32_t count, IBuffer* resultBuffer, uint64_t resultOffset) = 0;
|
||||
|
||||
virtual void Close() = 0;
|
||||
virtual void Reset(ICommandAllocator* allocator) = 0;
|
||||
|
||||
virtual void Dispatch(uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ) = 0;
|
||||
virtual void DispatchIndirect(IBuffer* argBuffer, uint32_t alignedByteOffset) = 0;
|
||||
|
||||
virtual void ExecuteBundle(ICommandList* bundle) = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Enums.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class ICommandList;
|
||||
class IFence;
|
||||
|
||||
class ICommandQueue {
|
||||
public:
|
||||
virtual ~ICommandQueue() = default;
|
||||
|
||||
virtual void ExecuteCommandLists(uint32_t count, ICommandList** lists) = 0;
|
||||
virtual void Signal(IFence* fence, uint64_t value) = 0;
|
||||
virtual void Wait(IFence* fence, uint64_t value) = 0;
|
||||
virtual uint64_t GetCompletedValue() = 0;
|
||||
virtual void WaitForIdle() = 0;
|
||||
|
||||
virtual CommandQueueType GetType() const = 0;
|
||||
virtual uint64_t GetTimestampFrequency() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include "D3D12Enum.h"
|
||||
#include "../SwapChain.h"
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include "D3D12Enum.h"
|
||||
#include "../SwapChain.h"
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Enums.h"
|
||||
#include "Types.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class IDescriptorHeap {
|
||||
public:
|
||||
virtual ~IDescriptorHeap() = default;
|
||||
virtual CPUDescriptorHandle GetCPUDescriptorHandle(uint32_t index) = 0;
|
||||
virtual GPUDescriptorHandle GetGPUDescriptorHandle(uint32_t index) = 0;
|
||||
virtual uint32_t GetDescriptorCount() const = 0;
|
||||
virtual DescriptorType GetType() const = 0;
|
||||
};
|
||||
|
||||
class IQueryHeap {
|
||||
public:
|
||||
virtual ~IQueryHeap() = default;
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
virtual QueryType GetType() const = 0;
|
||||
virtual uint32_t GetCount() const = 0;
|
||||
};
|
||||
|
||||
class IRootSignature {
|
||||
public:
|
||||
virtual ~IRootSignature() = default;
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
virtual uint32_t GetParameterCount() const = 0;
|
||||
};
|
||||
|
||||
class IPipelineState {
|
||||
public:
|
||||
virtual ~IPipelineState() = default;
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
virtual PipelineType GetType() const = 0;
|
||||
};
|
||||
|
||||
class ISampler {
|
||||
public:
|
||||
virtual ~ISampler() = default;
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class IFence {
|
||||
public:
|
||||
virtual ~IFence() = default;
|
||||
virtual void Signal(uint64_t value) = 0;
|
||||
virtual void Wait(uint64_t value) = 0;
|
||||
virtual uint64_t GetCompletedValue() = 0;
|
||||
virtual void* GetEventHandle() = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,75 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
#include "Enums.h"
|
||||
#include "Types.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
struct DeviceInfo {
|
||||
std::wstring deviceName;
|
||||
std::wstring driverVersion;
|
||||
uint64_t dedicatedVideoMemory;
|
||||
uint64_t dedicatedSystemMemory;
|
||||
uint64_t sharedSystemMemory;
|
||||
uint32_t vendorId;
|
||||
uint32_t deviceId;
|
||||
bool supportsRaytracing;
|
||||
bool supportsMeshShaders;
|
||||
bool supportsSamplerFeedback;
|
||||
};
|
||||
|
||||
class ICommandQueue;
|
||||
class ICommandList;
|
||||
class ICommandAllocator;
|
||||
class IFence;
|
||||
class IDescriptorHeap;
|
||||
class IQueryHeap;
|
||||
class IRootSignature;
|
||||
class IPipelineState;
|
||||
class ISampler;
|
||||
class ITexture;
|
||||
class IBuffer;
|
||||
class ISwapChain;
|
||||
class IShader;
|
||||
class IRenderTargetView;
|
||||
class IDepthStencilView;
|
||||
class IShaderResourceView;
|
||||
class IUnorderedAccessView;
|
||||
class IConstantBufferView;
|
||||
|
||||
class IRHIDevice {
|
||||
public:
|
||||
virtual ~IRHIDevice() = default;
|
||||
|
||||
virtual ICommandQueue* CreateCommandQueue(const CommandQueueDesc& desc) = 0;
|
||||
virtual ICommandList* CreateCommandList(const CommandListDesc& desc) = 0;
|
||||
virtual ICommandAllocator* CreateCommandAllocator(const CommandAllocatorDesc& desc) = 0;
|
||||
virtual IFence* CreateFence(const FenceDesc& desc) = 0;
|
||||
virtual IDescriptorHeap* CreateDescriptorHeap(const DescriptorHeapDesc& desc) = 0;
|
||||
virtual IQueryHeap* CreateQueryHeap(const QueryHeapDesc& desc) = 0;
|
||||
virtual IRootSignature* CreateRootSignature(const RootSignatureDesc& desc) = 0;
|
||||
virtual IPipelineState* CreatePipelineState(const PipelineStateDesc& desc) = 0;
|
||||
virtual ISampler* CreateSampler(const SamplerDesc& desc) = 0;
|
||||
virtual ITexture* CreateTexture(const TextureDesc& desc) = 0;
|
||||
virtual IBuffer* CreateBuffer(const BufferDesc& desc) = 0;
|
||||
virtual ISwapChain* CreateSwapChain(const SwapChainDesc& desc) = 0;
|
||||
virtual IShader* CompileShader(const ShaderCompileDesc& desc) = 0;
|
||||
|
||||
virtual IRenderTargetView* CreateRenderTargetView(IBuffer* resource, const RenderTargetViewDesc& desc) = 0;
|
||||
virtual IDepthStencilView* CreateDepthStencilView(IBuffer* resource, const DepthStencilViewDesc& desc) = 0;
|
||||
virtual IShaderResourceView* CreateShaderResourceView(IBuffer* resource, const ShaderResourceViewDesc& desc) = 0;
|
||||
virtual IUnorderedAccessView* CreateUnorderedAccessView(IBuffer* resource, const UnorderedAccessViewDesc& desc) = 0;
|
||||
virtual IConstantBufferView* CreateConstantBufferView(IBuffer* resource, const ConstantBufferViewDesc& desc) = 0;
|
||||
|
||||
virtual void GetDeviceInfo(DeviceInfo& info) const = 0;
|
||||
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,54 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
struct RHISystemConfig {
|
||||
void* nativeWindowHandle = nullptr;
|
||||
uint32_t width = 1280;
|
||||
uint32_t height = 720;
|
||||
bool fullscreen = false;
|
||||
uint32_t backBufferCount = 2;
|
||||
bool enableDebugLayer = false;
|
||||
bool enableGBV = false;
|
||||
};
|
||||
|
||||
class IRHIDevice;
|
||||
class ISwapChain;
|
||||
|
||||
class RHISystem {
|
||||
public:
|
||||
static RHISystem& Get();
|
||||
|
||||
bool Initialize(const RHISystemConfig& config);
|
||||
void Shutdown();
|
||||
|
||||
IRHIDevice* GetDevice();
|
||||
ISwapChain* GetSwapChain();
|
||||
|
||||
void BeginFrame();
|
||||
void EndFrame();
|
||||
|
||||
void Resize(uint32_t width, uint32_t height);
|
||||
void SetFullscreen(bool fullscreen);
|
||||
bool IsFullscreen() const;
|
||||
|
||||
bool IsInitialized() const { return m_initialized; }
|
||||
|
||||
private:
|
||||
RHISystem() = default;
|
||||
~RHISystem() = default;
|
||||
RHISystem(const RHISystem&) = delete;
|
||||
RHISystem& operator=(const RHISystem&) = delete;
|
||||
|
||||
std::unique_ptr<IRHIDevice> m_device;
|
||||
std::unique_ptr<ISwapChain> m_swapChain;
|
||||
RHISystemConfig m_config;
|
||||
bool m_initialized = false;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ResourceView.h"
|
||||
#include "Types.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class IRenderTargetView : public IResourceView {
|
||||
public:
|
||||
virtual ~IRenderTargetView() = default;
|
||||
};
|
||||
|
||||
class IDepthStencilView : public IResourceView {
|
||||
public:
|
||||
virtual ~IDepthStencilView() = default;
|
||||
};
|
||||
|
||||
class IShaderResourceView : public IResourceView {
|
||||
public:
|
||||
virtual ~IShaderResourceView() = default;
|
||||
};
|
||||
|
||||
class IUnorderedAccessView : public IResourceView {
|
||||
public:
|
||||
virtual ~IUnorderedAccessView() = default;
|
||||
};
|
||||
|
||||
class IConstantBufferView : public IResourceView {
|
||||
public:
|
||||
virtual ~IConstantBufferView() = default;
|
||||
virtual uint64_t GetGPUVirtualAddress() const = 0;
|
||||
virtual uint32_t GetSizeInBytes() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,27 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Enums.h"
|
||||
#include "Types.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class IResource {
|
||||
public:
|
||||
virtual ~IResource() = default;
|
||||
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
virtual ResourceStates GetState() const = 0;
|
||||
virtual void SetState(ResourceStates state) = 0;
|
||||
|
||||
virtual uint64_t GetGPUAddress() const = 0;
|
||||
virtual size_t GetSize() const = 0;
|
||||
|
||||
virtual const std::string& GetName() const = 0;
|
||||
virtual void SetName(const std::string& name) = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class IResourceView {
|
||||
public:
|
||||
virtual ~IResourceView() = default;
|
||||
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
virtual IResource* GetResource() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
@@ -1,54 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Enums.h"
|
||||
#include "Types.h"
|
||||
#include "Resource.h"
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class ISwapChain {
|
||||
public:
|
||||
virtual ~ISwapChain() = default;
|
||||
|
||||
virtual uint32_t GetCurrentBackBufferIndex() const = 0;
|
||||
virtual IResource* GetBackBuffer(uint32_t index) const = 0;
|
||||
virtual void Present(uint32_t syncInterval, uint32_t flags) = 0;
|
||||
virtual void Resize(uint32_t width, uint32_t height) = 0;
|
||||
virtual void SetFullscreen(bool fullscreen) = 0;
|
||||
virtual bool IsFullscreen() const = 0;
|
||||
|
||||
virtual void* GetNativeHandle() const = 0;
|
||||
};
|
||||
|
||||
class ITexture : public IResource {
|
||||
public:
|
||||
virtual uint32_t GetWidth() const = 0;
|
||||
virtual uint32_t GetHeight() const = 0;
|
||||
virtual uint32_t GetDepth() const = 0;
|
||||
virtual uint32_t GetMipLevels() const = 0;
|
||||
virtual uint32_t GetArraySize() const = 0;
|
||||
virtual Format GetFormat() const = 0;
|
||||
virtual TextureType GetTextureType() const = 0;
|
||||
};
|
||||
|
||||
class IBuffer : public IResource {
|
||||
public:
|
||||
virtual uint64_t GetSize() const = 0;
|
||||
virtual uint32_t GetStride() const = 0;
|
||||
virtual BufferType GetBufferType() const = 0;
|
||||
};
|
||||
|
||||
class IShader {
|
||||
public:
|
||||
virtual ~IShader() = default;
|
||||
|
||||
virtual const void* GetBytecode() const = 0;
|
||||
virtual size_t GetBytecodeSize() const = 0;
|
||||
virtual ShaderType GetType() const = 0;
|
||||
|
||||
virtual const InputLayoutDesc& GetInputLayout() const = 0;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user