ID3D12Device::CreateSampler method
Create a sampler object that encapsulates sampling information for a texture.
Syntax
void CreateSampler( [in] const D3D12_SAMPLER_DESC *pDesc, [in] D3D12_CPU_DESCRIPTOR_HANDLE DestDescriptor );
Parameters
- pDesc [in]
-
Type: const D3D12_SAMPLER_DESC*
A pointer to a D3D12_SAMPLER_DESC structure that describes the sampler.
- DestDescriptor [in]
-
Type: D3D12_CPU_DESCRIPTOR_HANDLE
Describes the CPU descriptor handle that represents the start of the heap that holds the sampler.
Return value
Returns nothing.
Examples
The D3D12Bundles sample uses ID3D12Device::CreateSampler as follows:
// Describe and create a sampler.
D3D12_SAMPLER_DESC samplerDesc = {};
samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_WRAP;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D12_FLOAT32_MAX;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
m_device->CreateSampler(&samplerDesc, m_samplerHeap->GetCPUDescriptorHandleForHeapStart());
Refer to the Example Code in the D3D12 Reference.
Requirements
|
Header |
|
|---|---|
|
Library |
|
|
DLL |
|
See also
Show: