88#include < IGLU/texture_loader/DataReader.h>
99
1010#include < type_traits>
11+ #include < igl/Macros.h>
1112
1213static_assert (std::is_trivially_copyable_v<iglu::textureloader::DataReader>);
1314
@@ -16,6 +17,7 @@ namespace iglu::textureloader {
1617std::optional<DataReader> DataReader::tryCreate (const uint8_t * FOLLY_NONNULL data,
1718 uint32_t size,
1819 igl::Result* IGL_NULLABLE outResult) {
20+ IGL_PROFILER_FUNCTION_COLOR (IGL_PROFILER_COLOR_CREATE );
1921 if (data == nullptr ) {
2022 igl::Result::setResult (outResult, igl::Result::Code::ArgumentInvalid, " data is nullptr." );
2123 return {};
@@ -37,6 +39,7 @@ uint32_t DataReader::size() const noexcept {
3739
3840const uint8_t * IGL_NULLABLE DataReader::tryAt (uint32_t offset,
3941 igl::Result* IGL_NULLABLE outResult) const noexcept {
42+ IGL_PROFILER_FUNCTION ();
4043 if (!ensureLength (0 , offset, outResult)) {
4144 return nullptr ;
4245 }
@@ -49,6 +52,7 @@ const uint8_t* IGL_NONNULL DataReader::at(uint32_t offset) const noexcept {
4952}
5053
5154bool DataReader::tryAdvance (uint32_t bytesToAdvance, igl::Result* IGL_NULLABLE outResult) noexcept {
55+ IGL_PROFILER_FUNCTION ();
5256 if (!ensureLength (bytesToAdvance, 0 , outResult)) {
5357 return false ;
5458 }
@@ -60,6 +64,7 @@ bool DataReader::tryAdvance(uint32_t bytesToAdvance, igl::Result* IGL_NULLABLE o
6064bool DataReader::ensureLength (uint32_t requestedLength,
6165 uint32_t offset,
6266 igl::Result* IGL_NULLABLE outResult) const noexcept {
67+ IGL_PROFILER_FUNCTION ();
6368 if (offset > size_ || requestedLength > size_ - offset) {
6469 igl::Result::setResult (
6570 outResult, igl::Result::Code::InvalidOperation, " data size is too small." );
0 commit comments