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
At the moment the only way of creating a Texture with your own sampler (e.g. for nearest mag filtering) is to call Texture::from_raw_parts. However, to create a binding group we need to supply a shared reference to the texture layout which is currently a private field in the Renderer struct. The way I'm getting around it at the moment is to copy-paste the texture layout code from Renderer::new, but a better approach would be either for Renderer to have a function that returns the texture layout as a shared reference, or for Texture to have a new method that takes a SamplerDescriptor.
The text was updated successfully, but these errors were encountered:
or for Texture to have a new method that takes a SamplerDescriptor
At first glance it seems that you could move the SamplerDescriptor creation which is currently in Texture::new into the default impl for TextureConfig and expose it that way.
(If you don't just need the SamplerDescriptor, but also the Sampler then this won't work because of the dependency on the device...)
Using ..Default() for TextureConfig means that this does not impact other users.
At first glance it seems that you could move the SamplerDescriptor creation which is currently in Texture::new into the default impl for TextureConfig and expose it that way.
...
Using ..Default() for TextureConfig means that this does not impact other users.
This would work fine. It is backwards incompatible since it will break for users not using ..Default() which should only be done for a major semver change, but being a 0.x semver I guess it's ok?
At the moment the only way of creating a
Texture
with your own sampler (e.g. for nearest mag filtering) is to callTexture::from_raw_parts
. However, to create a binding group we need to supply a shared reference to the texture layout which is currently a private field in theRenderer
struct. The way I'm getting around it at the moment is to copy-paste the texture layout code fromRenderer::new
, but a better approach would be either forRenderer
to have a function that returns the texture layout as a shared reference, or forTexture
to have anew
method that takes aSamplerDescriptor
.The text was updated successfully, but these errors were encountered: