Skip to content

Commit d7a0201

Browse files
corporatesharkmeta-codesync[bot]
authored andcommitted
igl | IGLU | Add Tracy profiler markers to texture_loader/DataReader
Reviewed By: rudybear Differential Revision: D115179613 fbshipit-source-id: 4ef51fd0d2497b85bc1039845249faf612081ad5
1 parent 47b4b99 commit d7a0201

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

IGLU/texture_loader/DataReader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <IGLU/texture_loader/DataReader.h>
99

1010
#include <type_traits>
11+
#include <igl/Macros.h>
1112

1213
static_assert(std::is_trivially_copyable_v<iglu::textureloader::DataReader>);
1314

@@ -16,6 +17,7 @@ namespace iglu::textureloader {
1617
std::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

3840
const 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

5154
bool 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
6064
bool 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

Comments
 (0)