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

Method uploadInitData

Source/Falcor/Core/API/Texture.cpp:643–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void Texture::uploadInitData(RenderContext* pRenderContext, const void* pData, bool autoGenMips)
644{
645 if (autoGenMips)
646 {
647 // Upload just the first mip-level
648 size_t arraySliceSize = mWidth * mHeight * getFormatBytesPerBlock(mFormat);
649 const uint8_t* pSrc = (uint8_t*)pData;
650 uint32_t numFaces = (mType == Texture::Type::TextureCube) ? 6 : 1;
651 for (uint32_t i = 0; i < mArraySize * numFaces; i++)
652 {
653 uint32_t subresource = getSubresourceIndex(i, 0);
654 pRenderContext->updateSubresourceData(this, subresource, pSrc);
655 pSrc += arraySliceSize;
656 }
657 }
658 else
659 {
660 pRenderContext->updateTextureData(this, pData);
661 }
662
663 if (autoGenMips)
664 {
665 generateMips(pRenderContext);
666 invalidateViews();
667 }
668}
669
670void Texture::generateMips(RenderContext* pContext, bool minMaxMips)
671{

Callers

nothing calls this directly

Calls 4

getFormatBytesPerBlockFunction · 0.85
getSubresourceIndexFunction · 0.85
updateSubresourceDataMethod · 0.80
updateTextureDataMethod · 0.80

Tested by

no test coverage detected