Add ClearUA to GPUContext to clear texture with float values
This commit is contained in:
committed by
Wojtek Figat
parent
bac8058aa8
commit
afed5a30bc
@@ -755,6 +755,20 @@ void GPUContextDX12::ClearUA(GPUTexture* texture, const uint32 value[4])
|
||||
_commandList->ClearUnorderedAccessViewUint(desc.GPU, uav, texDX12->GetResource(), value, 0, nullptr);
|
||||
}
|
||||
|
||||
void GPUContextDX12::ClearUA(GPUTexture* texture, const Vector4& value)
|
||||
{
|
||||
ASSERT(texture != nullptr && texture->IsUnorderedAccess());
|
||||
auto texDX12 = reinterpret_cast<GPUTextureDX12*>(texture);
|
||||
|
||||
SetResourceState(texDX12, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
|
||||
flushRBs();
|
||||
|
||||
auto uav = ((GPUTextureViewDX12*)(texDX12->IsVolume() ? texDX12->ViewVolume() : texDX12->View(0)))->UAV();
|
||||
Descriptor desc;
|
||||
GetActiveHeapDescriptor(uav, desc);
|
||||
_commandList->ClearUnorderedAccessViewFloat(desc.GPU, uav, texDX12->GetResource(), value.Raw, 0, nullptr);
|
||||
}
|
||||
|
||||
void GPUContextDX12::ResetRenderTarget()
|
||||
{
|
||||
if (_rtDepth || _rtCount != 0)
|
||||
|
||||
@@ -160,6 +160,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