Skip to content

Conversation

Fletterio
Copy link
Contributor

@Fletterio Fletterio commented Jul 24, 2025

}

// Generate upload data
auto uploadData = generateTileUploadData(cachedImageRecord->type, NDCToWorld, cachedImageRecord->georeferencedImageState.get());
Copy link
Contributor

@Erfan-Ahmadi Erfan-Ahmadi Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it's caculating tiles to load and then requesting loading them.
maybe a better name along "computeTilesAndLoad"

my thought process out loud:
I'm also thinking about if separating this into two function "compute" + "load" would do us any benefit when we use futures (instead of actually loading them on demand)
but I don't think so, this function can just return a bunch of futures to hold onto and wait upon...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this one open so that we remember there's this option when we introduce futures


DrawResourcesFiller::TileUploadData DrawResourcesFiller::generateTileUploadData(const ImageType imageType, const float64_t3x3& NDCToWorld, GeoreferencedImageStreamingState* imageStreamingState)
{
// I think eventually it's better to just transform georeferenced images that aren't big enough into static images and forget about them
Copy link
Contributor

@Erfan-Ahmadi Erfan-Ahmadi Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! let's try to have similar logic in n4ce codebase as well when we integrate and make it not go through georeferenced paths if image is small enough

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the criteria should be: the memory the image consumes is smaller than the GPU-resident image used for streaming

{
// Decide whether the image can reside fully into memory rather than get streamed.
// TODO: Improve logic, currently just a simple check to see if the full-screen image has more pixels that viewport or not
// TODO: add criterial that the size of the full-res image shouldn't consume more than 30% of the total memory arena for images (if we allowed larger than viewport extents)
const bool betterToResideFullyInMem = georeferencedImageParams.imageExtents.x * georeferencedImageParams.imageExtents.y <= georeferencedImageParams.viewportExtents.x * georeferencedImageParams.viewportExtents.y;
const bool betterToResideFullyInMem = params.imageExtents.x * params.imageExtents.y <= params.viewportExtents.x * params.viewportExtents.y;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just hit a problem where params.imageExtent was 2^17 and the multiplication resulted in 0 because it's uint32_t.
change original imageExtents to be uint64_t (only on cpu side ofcourse) and make sure you're not limited by uint64_t and modify the check to :
if params.imageExtent.x < 2^14 && params.imageExtent.y < 2^14 && imagePixels <= viewportPixels to make sure we're doing "Streamed" if the image extent is larger than a certain threshold unrelated to the viewport.
Check if we're getting similar issues with uint32_t2 imageExtents being large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants