| 92 | gfx::ComparisonFunc getGFXComparisonFunc(ComparisonFunc func); |
| 93 | |
| 94 | Sampler::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 | |
| 118 | Sampler::~Sampler() |
| 119 | { |
nothing calls this directly
no test coverage detected