2 // Copyright (c) Microsoft. All rights reserved.
3 // This code is licensed under the MIT License (MIT).
4 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
5 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
6 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
7 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 // Developed by Minigraph
11 // Author(s): James Stanard
16 #include "SamplerManager.h"
17 #include "GraphicsCore.h"
22 using namespace Graphics
;
26 map
< size_t, D3D12_CPU_DESCRIPTOR_HANDLE
> s_SamplerCache
;
29 D3D12_CPU_DESCRIPTOR_HANDLE
SamplerDesc::CreateDescriptor()
31 size_t hashValue
= Utility::HashState(this);
32 auto iter
= s_SamplerCache
.find(hashValue
);
33 if (iter
!= s_SamplerCache
.end())
38 D3D12_CPU_DESCRIPTOR_HANDLE Handle
= AllocateDescriptor(D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER
);
39 g_Device
->CreateSampler(this, Handle
);
43 void SamplerDesc::CreateDescriptor( D3D12_CPU_DESCRIPTOR_HANDLE
& Handle
)
45 g_Device
->CreateSampler(this, Handle
);