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

View File

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