MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / Sampler

Method Sampler

Source/Falcor/Core/API/Sampler.cpp:94–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92gfx::ComparisonFunc getGFXComparisonFunc(ComparisonFunc func);
93
94Sampler::Sampler(ref<Device> pDevice, const Desc& desc) : mpDevice(std::move(pDevice)), mDesc(desc)
95{
96 gfx::ISamplerState::Desc gfxDesc = {};
97 gfxDesc.addressU = getGFXAddressMode(desc.addressModeU);
98 gfxDesc.addressV = getGFXAddressMode(desc.addressModeV);
99 gfxDesc.addressW = getGFXAddressMode(desc.addressModeW);
100
101 static_assert(sizeof(gfxDesc.borderColor) == sizeof(desc.borderColor));
102 std::memcpy(gfxDesc.borderColor, &desc.borderColor, sizeof(desc.borderColor));
103
104 gfxDesc.comparisonFunc = getGFXComparisonFunc(desc.comparisonFunc);
105 gfxDesc.magFilter = getGFXFilter(desc.magFilter);
106 gfxDesc.maxAnisotropy = desc.maxAnisotropy;
107 gfxDesc.maxLOD = desc.maxLod;
108 gfxDesc.minFilter = getGFXFilter(desc.minFilter);
109 gfxDesc.minLOD = desc.minLod;
110 gfxDesc.mipFilter = getGFXFilter(desc.mipFilter);
111 gfxDesc.mipLODBias = desc.lodBias;
112 gfxDesc.reductionOp =
113 (desc.comparisonFunc != ComparisonFunc::Disabled) ? gfx::TextureReductionOp::Comparison : getGFXReductionMode(desc.reductionMode);
114
115 FALCOR_GFX_CALL(mpDevice->getGfxDevice()->createSamplerState(gfxDesc, mGfxSamplerState.writeRef()));
116}
117
118Sampler::~Sampler()
119{

Callers

nothing calls this directly

Calls 5

getGFXAddressModeFunction · 0.85
getGFXComparisonFuncFunction · 0.85
getGFXFilterFunction · 0.85
getGFXReductionModeFunction · 0.85
writeRefMethod · 0.80

Tested by

no test coverage detected