Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@reosfire
Copy link
Contributor

It seems pretty reasonable to wrap existing buffer because it provides very convinient methods to manipulate with bytes. Also because the mem property is public buffer content already can be changed from outside but it's impossible to mark this object dirty so I've added upload() method to make it possible

Copy link
Collaborator

@soywiz soywiz left a comment

Choose a reason for hiding this comment

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

Functionality looks fine to me. I have a few thoughts on naming:

For example, upload could be renamed to reupload or uploadCurrent? Or just make markAsDirty public?

The wrap method is also calling markAsDirty.
Could be named as upload as well or wrap AndUpload or setBuffer?

What do you think?

@reosfire
Copy link
Contributor Author

Pretty hard question I must admit XD. I can't choose between them. Each makes sense to me. AI says to make markAsDirty public and save wrap as is :)

@soywiz soywiz requested a review from Copilot May 14, 2025 04:28
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 adds two new methods to AGBuffer to support explicit GPU upload handling and in-place buffer wrapping.

  • Added a no-argument upload() method that marks the buffer as dirty for subsequent GPU upload
  • Added a wrap(data: Buffer) method to update the internal buffer with a new Buffer while marking it as dirty

@soywiz
Copy link
Collaborator

soywiz commented May 14, 2025

Well, not anything super critical. Ideally names should be as short as possible, but also describing side-effects. Maybe even existing naming with upload could be improved.

wrap + public markAsDirty would work for me. But not sure if possible since markAsDirty comes from an upper object. So let's use your upload as it is for now. It should be possible to deprecate and rename later if required.

@soywiz soywiz merged commit b590958 into korlibs:main May 14, 2025
6 checks passed
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