| 804 | } |
| 805 | |
| 806 | inline 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 | |
| 829 | FALCOR_SCRIPT_BINDING(Texture) |
| 830 | { |
nothing calls this directly
no test coverage detected