Skip to content

Send metadata for textures to get correct upload cost estimate.#5554

Open
Rider-Linden wants to merge 2 commits intorelease/2026.02from
rider/mesh_upload
Open

Send metadata for textures to get correct upload cost estimate.#5554
Rider-Linden wants to merge 2 commits intorelease/2026.02from
rider/mesh_upload

Conversation

@Rider-Linden
Copy link
Contributor

@Rider-Linden Rider-Linden commented Mar 18, 2026

When sending the request for a cost estimate for texture upload, include metadata about the texture size.

Issue: #5547

Description

During the price check phase of mesh upload, the simulator would send an array of empty textures (0 byte blobs).

In order to apply the correct upload cost, the simulator must be provided with at least the dimensions of the expected textures.

Related Issues

Issue: https://github.com/secondlife/server/issues/2392
Pull: https://github.com/secondlife/server/pull/2402


Checklist

Please ensure the following before requesting review:

  • I have provided a clear title and detailed description for this pull request.
  • If useful, I have included media such as screenshots and video to show off my changes.
  • The PR is linked to a relevant issue with sufficient context.
  • I have tested the changes locally and verified they work as intended.
  • All new and existing tests pass.
  • Code follows the project's style guidelines.
  • Documentation has been updated if needed.
  • Any dependent changes have been merged and published in downstream modules
  • I have reviewed the contributing guidelines.

Additional Notes

  • 26.02 is the first viewer to allow 2K texture uploads as part of the mesh upload.
  • The simulator requires a full "texture_list" array on the final upload.
  • The simulator will still use the "texture_list" array for estimation if the "texture_info" is missing from the estimate request. In this case it assumes that the textures are 1K. The price check (expected != actual) will fail if the uploaded textures are larger and have not been scaled down by the viewer.

… upload, include metadata about the texture size.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the mesh upload fee estimation request so the simulator receives enough texture metadata (dimensions) to correctly estimate upload cost when full texture binaries are not included.

Changes:

  • Add texture_info entries (width/height) during the fee-estimation path (include_textures == false) instead of sending only empty texture blobs.
  • Preserve existing behavior for full uploads (include_textures == true) by still sending the complete texture_list.
  • Minor indentation/formatting fix in wholeModelToLLSD().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +2855 to +2858
else
{ // When not including the whole texture, we need to send some metadata about the image
// to ensure accurate price estimation. If not included, the server will assume all
// textures are 1024 x 1024, which could lead to a low estimate.
Comment on lines +2860 to +2861
info["width"] = texture->getFullWidth();
info["height"] = texture->getFullHeight();
Copy link
Contributor

@akleshchev akleshchev Mar 18, 2026

Choose a reason for hiding this comment

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

It's unlikely texture won't be loaded, but actual values in getFullWidth/getFullHeight might be inaccurate as texture wasn't yet converted to upload format from native format (mesh uploader just takes them as is, see LLImportMaterial), so it's better to convert to LLImageJ2C first.

And if getFullWidth() is 0, there likely is nothing to upload. If it haven't loaded by this point, likely never will, uploader would have waitied for it. Reporting a placeholder size would be counter productive.

@akleshchev akleshchev requested a review from marchcat March 18, 2026 23:31
Copy link
Contributor

@marchcat marchcat left a comment

Choose a reason for hiding this comment

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

I'm trying to bring back my earlier attempt on better GLTF material uploading alongside the model.
This fix doesn't seem to interfere with that work.

@akleshchev akleshchev linked an issue Mar 19, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

For mesh upload, viewer does not send texture information.

4 participants