Add GPUDevice::CreateConstantBuffer for custom constants buffers usage

This commit is contained in:
Wojtek Figat
2022-11-26 21:17:05 +01:00
parent 39dc439cd8
commit 189575efec
20 changed files with 73 additions and 91 deletions

View File

@@ -2045,6 +2045,11 @@ GPUSwapChain* GPUDeviceVulkan::CreateSwapChain(Window* window)
return New<GPUSwapChainVulkan>(this, window);
}
GPUConstantBuffer* GPUDeviceVulkan::CreateConstantBuffer(uint32 size, const StringView& name)
{
return New<GPUConstantBufferVulkan>(this, size);
}
SemaphoreVulkan::SemaphoreVulkan(GPUDeviceVulkan* device)
: _device(device)
{

View File

@@ -708,6 +708,7 @@ public:
GPUBuffer* CreateBuffer(const StringView& name) override;
GPUSampler* CreateSampler() override;
GPUSwapChain* CreateSwapChain(Window* window) override;
GPUConstantBuffer* CreateConstantBuffer(uint32 size, const StringView& name) override;
};
/// <summary>

View File

@@ -234,16 +234,4 @@ GPUShaderProgram* GPUShaderVulkan::CreateGPUShaderProgram(ShaderStage type, cons
return shader;
}
GPUConstantBuffer* GPUShaderVulkan::CreateCB(const String& name, uint32 size, MemoryReadStream& stream)
{
return new(_cbs) GPUConstantBufferVulkan(_device, size);
}
void GPUShaderVulkan::OnReleaseGPU()
{
_cbs.Clear();
GPUShader::OnReleaseGPU();
}
#endif

View File

@@ -126,10 +126,6 @@ public:
/// </summary>
class GPUShaderVulkan : public GPUResourceVulkan<GPUShader>
{
private:
Array<GPUConstantBufferVulkan, FixedAllocation<MAX_CONSTANT_BUFFER_SLOTS>> _cbs;
public:
/// <summary>
@@ -146,8 +142,6 @@ protected:
// [GPUShader]
GPUShaderProgram* CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, byte* cacheBytes, uint32 cacheSize, MemoryReadStream& stream) override;
GPUConstantBuffer* CreateCB(const String& name, uint32 size, MemoryReadStream& stream) override;
void OnReleaseGPU() override;
};
#endif