hal/gles: force unbind samplers (#2226)

This commit is contained in:
Dzmitry Malyshau authored and Dzmitry Malyshau committed 2021-12-01 21:48:44 -05:00
1 parent 7244c23cf1
commit 05aeaf10b6
3 files changed
+13 -12

No files matched your search

+11 -10
View File
@@ -119,16 +119,17 @@ impl super::CommandEncoder {
fn rebind_sampler_states(&mut self, dirty_textures: u32, dirty_samplers: u32) {
for (texture_index, slot) in self.state.texture_slots.iter().enumerate() {
if let Some(sampler_index) = slot.sampler_index {
if dirty_textures & (1 << texture_index) != 0
|| dirty_samplers & (1 << sampler_index) != 0
{
if let Some(sampler) = self.state.samplers[sampler_index as usize] {
self.cmd_buffer
.commands
.push(C::BindSampler(texture_index as u32, sampler));
}
}
if dirty_textures & (1 << texture_index) != 0
|| slot
.sampler_index
.map_or(false, |si| dirty_samplers & (1 << si) != 0)
{
let sampler = slot
.sampler_index
.and_then(|si| self.state.samplers[si as usize]);
self.cmd_buffer
.commands
.push(C::BindSampler(texture_index as u32, sampler));
}
}
}
+1 -1
View File
@@ -685,7 +685,7 @@ enum Command {
offset: i32,
size: i32,
},
BindSampler(u32, glow::Sampler),
BindSampler(u32, Option<glow::Sampler>),
BindTexture {
slot: u32,
texture: glow::Texture,
+1 -1
View File
@@ -967,7 +967,7 @@ impl super::Queue {
gl.bind_buffer_range(target, slot, Some(buffer), offset, size);
}
C::BindSampler(texture_index, sampler) => {
gl.bind_sampler(texture_index, Some(sampler));
gl.bind_sampler(texture_index, sampler);
}
C::BindTexture {
slot,