librashader/librashader-runtime-gl/src/gl/gl46/texture_bind.rs

26 lines
806 B
Rust
Raw Normal View History

2022-11-30 15:56:10 +11:00
use crate::gl::BindTexture;
use crate::samplers::SamplerSet;
use crate::texture::Texture;
2022-11-30 17:38:05 +11:00
use librashader_reflect::reflect::semantics::TextureBinding;
2022-11-30 15:56:10 +11:00
pub struct Gl46BindTexture;
impl BindTexture for Gl46BindTexture {
fn bind_texture(samplers: &SamplerSet, binding: &TextureBinding, texture: &Texture) {
unsafe {
// eprintln!("setting {} to texunit {}", texture.image.handle, binding.binding);
gl::BindTextureUnit(binding.binding, texture.image.handle);
2022-11-30 17:38:05 +11:00
gl::BindSampler(
binding.binding,
samplers.get(texture.wrap_mode, texture.filter, texture.mip_filter),
);
2022-11-30 15:56:10 +11:00
}
}
fn gen_mipmaps(texture: &Texture) {
unsafe {
gl::GenerateTextureMipmap(texture.image.handle)
}
}
2022-11-30 17:38:05 +11:00
}