#pragma once
#include "DxilConstants.h"
#include "dxc/DXIL/DxilCompType.h"
#include "dxc/DXIL/DxilResourceBase.h"
namespace hlsl {
class DxilResource : public DxilResourceBase {
public:
static unsigned GetNumCoords(Kind ResourceKind);
static unsigned GetNumDimensions(Kind ResourceKind);
static unsigned GetNumDimensionsForCalcLOD(Kind ResourceKind);
static unsigned GetNumOffsets(Kind ResourceKind);
static bool IsAnyTexture(Kind ResourceKind);
static bool IsAnyArrayTexture(Kind ResourceKind);
static bool IsAnyTextureCube(Kind ResourceKind);
static bool IsFeedbackTexture(Kind ResourceKind);
static bool IsArrayKind(Kind ResourceKind);
DxilResource();
CompType GetCompType() const;
void SetCompType(const CompType CT);
llvm::Type *GetRetType() const;
unsigned GetSampleCount() const;
void SetSampleCount(unsigned SampleCount);
unsigned GetElementStride() const;
void SetElementStride(unsigned ElemStride);
unsigned GetBaseAlignLog2() const;
void SetBaseAlignLog2(unsigned baseAlignLog2);
DXIL::SamplerFeedbackType GetSamplerFeedbackType() const;
void SetSamplerFeedbackType(DXIL::SamplerFeedbackType Value);
bool IsGloballyCoherent() const;
void SetGloballyCoherent(bool b);
bool IsReorderCoherent() const;
void SetReorderCoherent(bool b);
bool HasCounter() const;
void SetHasCounter(bool b);
bool IsRO() const;
bool IsRW() const;
void SetRW(bool bRW);
bool IsROV() const;
void SetROV(bool bROV);
bool IsAnyTexture() const;
bool IsStructuredBuffer() const;
bool IsTypedBuffer() const;
bool IsRawBuffer() const;
bool IsTBuffer() const;
bool IsFeedbackTexture() const;
bool IsAnyArrayTexture() const;
bool IsAnyTextureCube() const;
bool IsArrayKind() const;
bool HasAtomic64Use() const;
void SetHasAtomic64Use(bool b);
static bool classof(const DxilResourceBase *R) {
return R->GetClass() == DXIL::ResourceClass::SRV ||
R->GetClass() == DXIL::ResourceClass::UAV;
}
private:
unsigned m_SampleCount;
unsigned m_ElementStride;
unsigned m_baseAlignLog2 = 0;
CompType m_CompType;
DXIL::SamplerFeedbackType m_SamplerFeedbackType;
bool m_bGloballyCoherent;
bool m_bReorderCoherent;
bool m_bHasCounter;
bool m_bROV;
bool m_bHasAtomic64Use;
};
}