Add D3D11 shaders naming for profiling

This commit is contained in:
Wojtek Figat
2024-06-02 22:05:45 +02:00
parent 59e0b43585
commit bba14d265a
2 changed files with 4 additions and 33 deletions

View File

@@ -14,11 +14,9 @@ template<typename BaseType, typename BufferType>
class GPUShaderProgramDX11 : public BaseType class GPUShaderProgramDX11 : public BaseType
{ {
protected: protected:
BufferType* _buffer; BufferType* _buffer;
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramDX11"/> class.
/// </summary> /// </summary>
@@ -28,6 +26,9 @@ public:
: _buffer(buffer) : _buffer(buffer)
{ {
BaseType::Init(initializer); BaseType::Init(initializer);
#if GPU_ENABLE_RESOURCE_NAMING
SetDebugObjectName(buffer, initializer.Name.Get(), initializer.Name.Length());
#endif
} }
/// <summary> /// <summary>
@@ -39,24 +40,20 @@ public:
} }
public: public:
/// <summary> /// <summary>
/// Gets DirectX 11 buffer handle. /// Gets DirectX 11 buffer handle.
/// </summary> /// </summary>
/// <returns>The DirectX 11 buffer.</returns>
FORCE_INLINE BufferType* GetBufferHandleDX11() const FORCE_INLINE BufferType* GetBufferHandleDX11() const
{ {
return _buffer; return _buffer;
} }
public: public:
// [BaseType] // [BaseType]
uint32 GetBufferSize() const override uint32 GetBufferSize() const override
{ {
return 0; return 0;
} }
void* GetBufferHandle() const override void* GetBufferHandle() const override
{ {
return _buffer; return _buffer;
@@ -69,12 +66,10 @@ public:
class GPUShaderProgramVSDX11 : public GPUShaderProgramDX11<GPUShaderProgramVS, ID3D11VertexShader> class GPUShaderProgramVSDX11 : public GPUShaderProgramDX11<GPUShaderProgramVS, ID3D11VertexShader>
{ {
private: private:
byte _inputLayoutSize; byte _inputLayoutSize;
ID3D11InputLayout* _inputLayout; ID3D11InputLayout* _inputLayout;
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramVSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramVSDX11"/> class.
/// </summary> /// </summary>
@@ -98,24 +93,20 @@ public:
} }
public: public:
/// <summary> /// <summary>
/// Gets the DirectX 11 input layout handle /// Gets the DirectX 11 input layout handle
/// </summary> /// </summary>
/// <returns>DirectX 11 input layout</returns>
FORCE_INLINE ID3D11InputLayout* GetInputLayoutDX11() const FORCE_INLINE ID3D11InputLayout* GetInputLayoutDX11() const
{ {
return _inputLayout; return _inputLayout;
} }
public: public:
// [GPUShaderProgramDX11] // [GPUShaderProgramDX11]
void* GetInputLayout() const override void* GetInputLayout() const override
{ {
return (void*)_inputLayout; return (void*)_inputLayout;
} }
byte GetInputLayoutSize() const override byte GetInputLayoutSize() const override
{ {
return _inputLayoutSize; return _inputLayoutSize;
@@ -129,7 +120,6 @@ public:
class GPUShaderProgramHSDX11 : public GPUShaderProgramDX11<GPUShaderProgramHS, ID3D11HullShader> class GPUShaderProgramHSDX11 : public GPUShaderProgramDX11<GPUShaderProgramHS, ID3D11HullShader>
{ {
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramHSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramHSDX11"/> class.
/// </summary> /// </summary>
@@ -149,7 +139,6 @@ public:
class GPUShaderProgramDSDX11 : public GPUShaderProgramDX11<GPUShaderProgramDS, ID3D11DomainShader> class GPUShaderProgramDSDX11 : public GPUShaderProgramDX11<GPUShaderProgramDS, ID3D11DomainShader>
{ {
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramDSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramDSDX11"/> class.
/// </summary> /// </summary>
@@ -169,7 +158,6 @@ public:
class GPUShaderProgramGSDX11 : public GPUShaderProgramDX11<GPUShaderProgramGS, ID3D11GeometryShader> class GPUShaderProgramGSDX11 : public GPUShaderProgramDX11<GPUShaderProgramGS, ID3D11GeometryShader>
{ {
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramGSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramGSDX11"/> class.
/// </summary> /// </summary>
@@ -188,7 +176,6 @@ public:
class GPUShaderProgramPSDX11 : public GPUShaderProgramDX11<GPUShaderProgramPS, ID3D11PixelShader> class GPUShaderProgramPSDX11 : public GPUShaderProgramDX11<GPUShaderProgramPS, ID3D11PixelShader>
{ {
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramPSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramPSDX11"/> class.
/// </summary> /// </summary>
@@ -206,7 +193,6 @@ public:
class GPUShaderProgramCSDX11 : public GPUShaderProgramDX11<GPUShaderProgramCS, ID3D11ComputeShader> class GPUShaderProgramCSDX11 : public GPUShaderProgramDX11<GPUShaderProgramCS, ID3D11ComputeShader>
{ {
public: public:
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="GPUShaderProgramCSDX11"/> class. /// Initializes a new instance of the <see cref="GPUShaderProgramCSDX11"/> class.
/// </summary> /// </summary>

View File

@@ -16,12 +16,9 @@ template<typename BaseType>
class GPUShaderProgramDX12 : public BaseType class GPUShaderProgramDX12 : public BaseType
{ {
protected: protected:
Array<byte> _data; Array<byte> _data;
public: public:
GPUShaderProgramDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize) GPUShaderProgramDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize)
: Header(*header) : Header(*header)
{ {
@@ -30,11 +27,9 @@ public:
} }
public: public:
DxShaderHeader Header; DxShaderHeader Header;
public: public:
// [BaseType] // [BaseType]
void* GetBufferHandle() const override void* GetBufferHandle() const override
{ {
@@ -52,12 +47,10 @@ public:
class GPUShaderProgramVSDX12 : public GPUShaderProgramDX12<GPUShaderProgramVS> class GPUShaderProgramVSDX12 : public GPUShaderProgramDX12<GPUShaderProgramVS>
{ {
private: private:
byte _inputLayoutSize; byte _inputLayoutSize;
D3D12_INPUT_ELEMENT_DESC _inputLayout[VERTEX_SHADER_MAX_INPUT_ELEMENTS]; D3D12_INPUT_ELEMENT_DESC _inputLayout[VERTEX_SHADER_MAX_INPUT_ELEMENTS];
public: public:
GPUShaderProgramVSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize, D3D12_INPUT_ELEMENT_DESC* inputLayout, byte inputLayoutSize) GPUShaderProgramVSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize, D3D12_INPUT_ELEMENT_DESC* inputLayout, byte inputLayoutSize)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
, _inputLayoutSize(inputLayoutSize) , _inputLayoutSize(inputLayoutSize)
@@ -67,7 +60,6 @@ public:
} }
public: public:
// [GPUShaderProgramDX12] // [GPUShaderProgramDX12]
void* GetInputLayout() const override void* GetInputLayout() const override
{ {
@@ -86,7 +78,6 @@ public:
class GPUShaderProgramHSDX12 : public GPUShaderProgramDX12<GPUShaderProgramHS> class GPUShaderProgramHSDX12 : public GPUShaderProgramDX12<GPUShaderProgramHS>
{ {
public: public:
GPUShaderProgramHSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize, int32 controlPointsCount) GPUShaderProgramHSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize, int32 controlPointsCount)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
{ {
@@ -100,7 +91,6 @@ public:
class GPUShaderProgramDSDX12 : public GPUShaderProgramDX12<GPUShaderProgramDS> class GPUShaderProgramDSDX12 : public GPUShaderProgramDX12<GPUShaderProgramDS>
{ {
public: public:
GPUShaderProgramDSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize) GPUShaderProgramDSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
{ {
@@ -115,7 +105,6 @@ public:
class GPUShaderProgramGSDX12 : public GPUShaderProgramDX12<GPUShaderProgramGS> class GPUShaderProgramGSDX12 : public GPUShaderProgramDX12<GPUShaderProgramGS>
{ {
public: public:
GPUShaderProgramGSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize) GPUShaderProgramGSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
{ {
@@ -129,7 +118,6 @@ public:
class GPUShaderProgramPSDX12 : public GPUShaderProgramDX12<GPUShaderProgramPS> class GPUShaderProgramPSDX12 : public GPUShaderProgramDX12<GPUShaderProgramPS>
{ {
public: public:
GPUShaderProgramPSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize) GPUShaderProgramPSDX12(const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
{ {
@@ -142,27 +130,24 @@ public:
class GPUShaderProgramCSDX12 : public GPUShaderProgramDX12<GPUShaderProgramCS> class GPUShaderProgramCSDX12 : public GPUShaderProgramDX12<GPUShaderProgramCS>
{ {
private: private:
GPUDeviceDX12* _device; GPUDeviceDX12* _device;
Array<byte> _data; Array<byte> _data;
ID3D12PipelineState* _state; ID3D12PipelineState* _state;
public: public:
GPUShaderProgramCSDX12(GPUDeviceDX12* device, const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize) GPUShaderProgramCSDX12(GPUDeviceDX12* device, const GPUShaderProgramInitializer& initializer, DxShaderHeader* header, byte* cacheBytes, uint32 cacheSize)
: GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize) : GPUShaderProgramDX12(initializer, header, cacheBytes, cacheSize)
, _device(device) , _device(device)
, _state(nullptr) , _state(nullptr)
{ {
} }
~GPUShaderProgramCSDX12() ~GPUShaderProgramCSDX12()
{ {
_device->AddResourceToLateRelease(_state); _device->AddResourceToLateRelease(_state);
} }
public: public:
/// <summary> /// <summary>
/// Gets DirectX 12 compute pipeline state object /// Gets DirectX 12 compute pipeline state object
/// </summary> /// </summary>