Add Types.h with generic cross-platform types for RHI abstraction layer
This commit is contained in:
224
engine/include/XCEngine/RHI/Types.h
Normal file
224
engine/include/XCEngine/RHI/Types.h
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace XCEngine {
|
||||||
|
namespace RHI {
|
||||||
|
|
||||||
|
struct Viewport {
|
||||||
|
float topLeftX;
|
||||||
|
float topLeftY;
|
||||||
|
float width;
|
||||||
|
float height;
|
||||||
|
float minDepth;
|
||||||
|
float maxDepth;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Rect {
|
||||||
|
int32_t left;
|
||||||
|
int32_t top;
|
||||||
|
int32_t right;
|
||||||
|
int32_t bottom;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Color {
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float a;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ClearValue {
|
||||||
|
Color color;
|
||||||
|
float depth;
|
||||||
|
uint8_t stencil;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ShaderCompileMacro {
|
||||||
|
std::wstring name;
|
||||||
|
std::wstring definition;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ShaderCompileDesc {
|
||||||
|
std::wstring entryPoint;
|
||||||
|
std::wstring profile;
|
||||||
|
std::wstring fileName;
|
||||||
|
std::vector<ShaderCompileMacro> macros;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct InputElementDesc {
|
||||||
|
std::string semanticName;
|
||||||
|
uint32_t semanticIndex;
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t inputSlot;
|
||||||
|
uint32_t alignedByteOffset;
|
||||||
|
uint32_t inputSlotClass;
|
||||||
|
uint32_t instanceDataStepRate;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct InputLayoutDesc {
|
||||||
|
std::vector<InputElementDesc> elements;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VertexBufferBinding {
|
||||||
|
uint64_t bufferLocation;
|
||||||
|
uint32_t sizeInBytes;
|
||||||
|
uint32_t strideInBytes;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TextureCopyLocation {
|
||||||
|
uint64_t plSubresourceIndex;
|
||||||
|
void* pResource;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DescriptorHandle {
|
||||||
|
uint64_t ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GPUDescriptorHandle {
|
||||||
|
uint64_t ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CPUDescriptorHandle {
|
||||||
|
uint64_t ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SubresourceRange {
|
||||||
|
uint32_t baseMipLevel;
|
||||||
|
uint32_t mipLevels;
|
||||||
|
uint32_t baseArraySlice;
|
||||||
|
uint32_t arraySize;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TextureDesc {
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint32_t depth;
|
||||||
|
uint32_t mipLevels;
|
||||||
|
uint32_t arraySize;
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t textureType;
|
||||||
|
uint32_t sampleCount;
|
||||||
|
uint32_t sampleQuality;
|
||||||
|
uint64_t flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BufferDesc {
|
||||||
|
uint64_t size;
|
||||||
|
uint32_t stride;
|
||||||
|
uint32_t bufferType;
|
||||||
|
uint64_t flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RenderTargetDesc {
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t sampleCount;
|
||||||
|
uint32_t sampleQuality;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DepthStencilDesc {
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t sampleCount;
|
||||||
|
uint32_t sampleQuality;
|
||||||
|
bool depthEnable;
|
||||||
|
bool stencilEnable;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DescriptorHeapDesc {
|
||||||
|
uint32_t descriptorCount;
|
||||||
|
uint32_t heapType;
|
||||||
|
uint32_t flags;
|
||||||
|
uint32_t nodeMask;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CommandQueueDesc {
|
||||||
|
uint32_t queueType;
|
||||||
|
uint32_t priority;
|
||||||
|
uint32_t nodeMask;
|
||||||
|
uint64_t flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CommandListDesc {
|
||||||
|
uint32_t commandListType;
|
||||||
|
uint32_t nodeMask;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CommandAllocatorDesc {
|
||||||
|
uint32_t commandListType;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FenceDesc {
|
||||||
|
uint64_t initialValue;
|
||||||
|
uint32_t flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct QueryHeapDesc {
|
||||||
|
uint32_t queryType;
|
||||||
|
uint32_t count;
|
||||||
|
uint32_t nodeMask;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SamplerDesc {
|
||||||
|
uint32_t filter;
|
||||||
|
uint32_t addressU;
|
||||||
|
uint32_t addressV;
|
||||||
|
uint32_t addressW;
|
||||||
|
float mipLodBias;
|
||||||
|
uint32_t maxAnisotropy;
|
||||||
|
uint32_t comparisonFunc;
|
||||||
|
float borderColorR;
|
||||||
|
float borderColorG;
|
||||||
|
float borderColorB;
|
||||||
|
float borderColorA;
|
||||||
|
float minLod;
|
||||||
|
float maxLod;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SwapChainDesc {
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint32_t bufferCount;
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t refreshRate;
|
||||||
|
uint32_t sampleCount;
|
||||||
|
uint32_t sampleQuality;
|
||||||
|
uint32_t swapEffect;
|
||||||
|
uint32_t flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RenderTargetViewDesc {
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t viewDimension;
|
||||||
|
uint32_t mipSlice;
|
||||||
|
uint32_t firstArraySlice;
|
||||||
|
uint32_t arraySize;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DepthStencilViewDesc {
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t viewDimension;
|
||||||
|
uint32_t mipSlice;
|
||||||
|
uint32_t firstArraySlice;
|
||||||
|
uint32_t arraySize;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ShaderResourceViewDesc {
|
||||||
|
uint32_t format;
|
||||||
|
uint32_t viewDimension;
|
||||||
|
uint32_t shader4ComponentMapping;
|
||||||
|
TextureDesc textureDesc;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ConstantBufferViewDesc {
|
||||||
|
uint64_t bufferLocation;
|
||||||
|
uint32_t sizeInBytes;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace RHI
|
||||||
|
} // namespace XCEngine
|
||||||
Reference in New Issue
Block a user