Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't upload texture if locked using TEXTURELOCK_READ #6003

Merged
merged 4 commits into from Feb 2, 2024

Conversation

liamdon
Copy link
Contributor

@liamdon liamdon commented Jan 27, 2024

The API docs suggest that you can call texture.lock() with a mode of either TEXTURELOCK_READ or TEXTURELOCK_WRITE, but in this option doesn't do anything.

This is a small change so that a lock that's opened with TEXTURELOCK_READ will not call texture.upload() when unlocked. It also uses the mode to check the state, instead of overloading texture._lockedLevel for this purpose.

I also have some related questions about how we should handle mip updates via API - please see #6004

Copy link
Contributor

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

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

You can completely remove _lockedLevel as it's unused after your changes.

@liamdon
Copy link
Contributor Author

liamdon commented Jan 29, 2024

You can completely remove _lockedLevel as it's unused after your changes.

Definitely - but I think it could still be put to good use as described in #6004, so depending on what the PC team thinks about that, I may add more to this PR.

@slimbuck slimbuck assigned slimbuck and mvaligursky and unassigned slimbuck Jan 29, 2024
@slimbuck
Copy link
Member

TBH the team had internally mumbled wanting to completely rewrite the texture API, but this is often a pipe-dream. Breaking backwards compatibility is very painful for us and our users.

I love this PR and the issue you created with explanation. It is well thought out and a clear improvement to the API - thanks so much!

@mvaligursky
Copy link
Contributor

related to #4237

@liamdon
Copy link
Contributor Author

liamdon commented Jan 31, 2024

related to #4237

Ha, I actually forgot about this! I guess this API has been on my mind for a while 😄

Copy link
Contributor

@willeastcott willeastcott left a comment

Choose a reason for hiding this comment

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

Nice PR - approving (although agree with the feedback from @mvaligursky)

Copy link
Contributor

@mvaligursky mvaligursky left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@mvaligursky mvaligursky merged commit 912a837 into playcanvas:main Feb 2, 2024
7 checks passed
@liamdon
Copy link
Contributor Author

liamdon commented Feb 2, 2024

I'll probably follow up (soon-ish) with a PR that implements my proposal in #6004; it may be easier to consider/discuss when you see a concrete implementation.

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.

None yet

5 participants