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

Method executeInternal

Source/RenderPasses/DLSSPass/DLSSPass.cpp:206–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206void DLSSPass::executeInternal(RenderContext* pRenderContext, const RenderData& renderData)
207{
208 // Determine pass I/O sizes based on bound textures.
209 const auto& pOutput = renderData.getTexture(kOutput);
210 const auto& pColor = renderData.getTexture(kColorInput);
211 FALCOR_ASSERT(pColor && pOutput);
212
213 mPassOutputSize = {pOutput->getWidth(), pOutput->getHeight()};
214 const uint2 inputSize = {pColor->getWidth(), pColor->getHeight()};
215
216 if (!mEnabled || !mpScene)
217 {
218 pRenderContext->blit(pColor->getSRV(), pOutput->getRTV());
219 return;
220 }
221
222 if (mExposureUpdated)
223 {
224 float exposure = pow(2.f, mExposure);
225 pRenderContext->updateTextureData(mpExposure.get(), &exposure);
226 mExposureUpdated = false;
227 }
228
229 if (mRecreate || any(inputSize != mInputSize))
230 {
231 mRecreate = false;
232 mInputSize = inputSize;
233
234 initializeDLSS(pRenderContext);
235
236 // If pass output is configured to be fixed to DLSS output, but the sizes don't match,
237 // we'll trigger a graph recompile to update the pass I/O size requirements.
238 // This causes a one frame delay, but unfortunately we don't know the size until after initializeDLSS().
239 if (mOutputSizeSelection == RenderPassHelpers::IOSize::Fixed && any(mPassOutputSize != mDLSSOutputSize))
240 requestRecompile();
241 }
242
243 {
244 // Fetch inputs and verify their dimensions.
245 auto getInput = [=](const std::string& name)
246 {
247 auto tex = renderData.getTexture(name);
248 if (!tex)
249 FALCOR_THROW("DLSSPass: Missing input '{}'", name);
250 if (tex->getWidth() != mInputSize.x || tex->getHeight() != mInputSize.y)
251 FALCOR_THROW("DLSSPass: Input '{}' has mismatching size. All inputs must be of the same size.", name);
252 return tex;
253 };
254
255 auto color = getInput(kColorInput);
256 auto depth = getInput(kDepthInput);
257 auto motionVectors = getInput(kMotionVectorsInput);
258
259 // Determine if we can write directly to the render pass output.
260 // Otherwise we'll output to an internal buffer and blit to the pass output.
261 FALCOR_ASSERT(mpOutput->getWidth() == mDLSSOutputSize.x && mpOutput->getHeight() == mDLSSOutputSize.y);
262 bool useInternalBuffer = (any(mDLSSOutputSize != mPassOutputSize) || pOutput->getFormat() != mpOutput->getFormat());
263

Callers

nothing calls this directly

Calls 13

requestRecompileFunction · 0.85
getWidthMethod · 0.80
getHeightMethod · 0.80
blitMethod · 0.80
getRTVMethod · 0.80
updateTextureDataMethod · 0.80
getFormatMethod · 0.80
evaluateDLSSMethod · 0.80
powFunction · 0.50
anyFunction · 0.50
getTextureMethod · 0.45
getSRVMethod · 0.45

Tested by

no test coverage detected