You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Texture::draw() takes a DrawParams as a value. Which makes it impossible to reuse the DrawParams object.
Motivation/Examples
I was optimizing my program by reusing the same objects. I was able to reuse the Texture objects by calling the replace_data instead of creating a new object every frame. But I couldn't do the same for the DrawParams object because the draw method takes ownership of it. I also don't know the reason behind the use of generics in this case. Because I made a small change to code by eliminating the generics and accepting a reference instead of a value and it worked.
aakodadi
changed the title
Pass DrawParams as a reference to the Texture's draw method
Passe DrawParams as a reference to the Texture's draw method
Mar 20, 2023
aakodadi
changed the title
Passe DrawParams as a reference to the Texture's draw method
Pass DrawParams as a reference to the Texture's draw method
Mar 20, 2023
Summary
The Texture::draw() takes a DrawParams as a value. Which makes it impossible to reuse the DrawParams object.
Motivation/Examples
I was optimizing my program by reusing the same objects. I was able to reuse the Texture objects by calling the
replace_data
instead of creating a new object every frame. But I couldn't do the same for the DrawParams object because the draw method takes ownership of it. I also don't know the reason behind the use of generics in this case. Because I made a small change to code by eliminating the generics and accepting a reference instead of a value and it worked.My changes:
Alternatives Considered
No response
The text was updated successfully, but these errors were encountered: