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

Method create2D

Source/Falcor/Core/API/FBO.cpp:516–556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516ref<Fbo> Fbo::create2D(
517 ref<Device> pDevice,
518 uint32_t width,
519 uint32_t height,
520 const Fbo::Desc& fboDesc,
521 uint32_t arraySize,
522 uint32_t mipLevels
523)
524{
525 uint32_t sampleCount = fboDesc.getSampleCount();
526
527 FALCOR_CHECK(width > 0, "'width' must not be zero.");
528 FALCOR_CHECK(height > 0, "'height' must not be zero.");
529 FALCOR_CHECK(arraySize > 0, "'arraySize' must not be zero.");
530 FALCOR_CHECK(mipLevels > 0, "'mipLevels' must not be zero.");
531 FALCOR_CHECK(sampleCount == 1 || mipLevels == 1, "Cannot create multi-sampled texture with more than one mip-level.");
532
533 ref<Fbo> pFbo = create(pDevice);
534
535 // Create the color targets
536 for (uint32_t i = 0; i < Fbo::getMaxColorTargetCount(); i++)
537 {
538 if (fboDesc.getColorTargetFormat(i) != ResourceFormat::Unknown)
539 {
540 ResourceBindFlags flags = getBindFlags(false, fboDesc.isColorTargetUav(i));
541 ref<Texture> pTex =
542 createTexture2D(pDevice, width, height, fboDesc.getColorTargetFormat(i), sampleCount, arraySize, mipLevels, flags);
543 pFbo->attachColorTarget(pTex, i, 0, 0, kAttachEntireMipLevel);
544 }
545 }
546
547 if (fboDesc.getDepthStencilFormat() != ResourceFormat::Unknown)
548 {
549 ResourceBindFlags flags = getBindFlags(true, fboDesc.isDepthStencilUav());
550 ref<Texture> pDepth =
551 createTexture2D(pDevice, width, height, fboDesc.getDepthStencilFormat(), sampleCount, arraySize, mipLevels, flags);
552 pFbo->attachDepthStencilTarget(pDepth, 0, 0, kAttachEntireMipLevel);
553 }
554
555 return pFbo;
556}
557
558ref<Fbo> Fbo::createCubemap(
559 ref<Device> pDevice,

Callers

nothing calls this directly

Calls 5

createTexture2DFunction · 0.85
attachColorTargetMethod · 0.80
createFunction · 0.70
getBindFlagsFunction · 0.70

Tested by

no test coverage detected