You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
o3de/Gems/Atom/RHI/DX12/Code/Source/RHI/Sampler.cpp

43 lines
1.2 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <RHI/Sampler.h>
#include <RHI/Conversions.h>
#include <RHI/DescriptorContext.h>
#include <RHI/Device.h>
namespace AZ
{
namespace DX12
{
RHI::Ptr<Sampler> Sampler::Create()
{
return aznew Sampler();
}
void Sampler::Init(Device& device, const RHI::SamplerState& samplerState)
{
Base::Init(device);
DescriptorContext& context = device.GetDescriptorContext();
context.CreateSampler(samplerState, m_descriptor);
}
DescriptorHandle Sampler::GetDescriptorHandle() const
{
return m_descriptor;
}
void Sampler::Shutdown()
{
auto& device = static_cast<Device&>(GetDevice());
DescriptorContext& context = device.GetDescriptorContext();
context.ReleaseDescriptor(m_descriptor);
m_descriptor = DescriptorHandle();
Base::Shutdown();
}
}
}