Add ClearUA to GPUContext to clear texture with float values
This commit is contained in:
committed by
Wojtek Figat
parent
bac8058aa8
commit
afed5a30bc
@@ -874,6 +874,23 @@ void GPUContextVulkan::ClearUA(GPUTexture* texture, const uint32 value[4])
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextVulkan::ClearUA(GPUTexture* texture, const Vector4& value)
|
||||
{
|
||||
const auto texVulkan = static_cast<GPUTextureVulkan*>(texture);
|
||||
if (texVulkan)
|
||||
{
|
||||
auto rtVulkan = ((GPUTextureViewVulkan*)(texVulkan->IsVolume() ? texVulkan->ViewVolume() : texVulkan->View(0)));
|
||||
const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer();
|
||||
if (cmdBuffer->IsInsideRenderPass())
|
||||
EndRenderPass();
|
||||
|
||||
AddImageBarrier(rtVulkan, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
FlushBarriers();
|
||||
|
||||
vkCmdClearColorImage(cmdBuffer->GetHandle(), rtVulkan->Image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (const VkClearColorValue*)value.Raw, 1, &rtVulkan->Info.subresourceRange);
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextVulkan::ResetRenderTarget()
|
||||
{
|
||||
if (_rtDepth || _rtCount != 0)
|
||||
|
||||
@@ -176,6 +176,7 @@ public:
|
||||
void ClearUA(GPUBuffer* buf, const Vector4& value) override;
|
||||
void ClearUA(GPUBuffer* buf, const uint32 value[4]) override;
|
||||
void ClearUA(GPUTexture* texture, const uint32 value[4]) override;
|
||||
void ClearUA(GPUTexture* texture, const Vector4& value) override;
|
||||
void ResetRenderTarget() override;
|
||||
void SetRenderTarget(GPUTextureView* rt) override;
|
||||
void SetRenderTarget(GPUTextureView* depthBuffer, GPUTextureView* rt) override;
|
||||
|
||||
Reference in New Issue
Block a user