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

Function texture_from_numpy

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

Source from the content-addressed store, hash-verified

804}
805
806inline void texture_from_numpy(Texture& self, pybind11::ndarray<pybind11::numpy> data, uint32_t mip_level, uint32_t array_slice)
807{
808 FALCOR_CHECK(
809 mip_level < self.getMipCount(), "'mip_level' ({}) is out of bounds. Only {} level(s) available.", mip_level, self.getMipCount()
810 );
811 FALCOR_CHECK(
812 array_slice < self.getArraySize(),
813 "'array_slice' ({}) is out of bounds. Only {} slice(s) available.",
814 array_slice,
815 self.getArraySize()
816 );
817 FALCOR_CHECK(isNdarrayContiguous(data), "numpy array is not contiguous");
818
819 uint32_t subresource = self.getSubresourceIndex(array_slice, mip_level);
820 Texture::SubresourceLayout layout = self.getSubresourceLayout(subresource);
821
822 size_t subresourceSize = layout.getTotalByteSize();
823 size_t dataSize = getNdarrayByteSize(data);
824 FALCOR_CHECK(dataSize == subresourceSize, "numpy array is doesn't match the subresource size ({} != {})", dataSize, subresourceSize);
825
826 self.setSubresourceBlob(subresource, data.data(), dataSize);
827}
828
829FALCOR_SCRIPT_BINDING(Texture)
830{

Callers

nothing calls this directly

Calls 6

isNdarrayContiguousFunction · 0.85
getNdarrayByteSizeFunction · 0.85
getSubresourceLayoutMethod · 0.80
getTotalByteSizeMethod · 0.80
setSubresourceBlobMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected