mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-26 08:44:08 +00:00
hal/gles: small fixes for external context
This commit is contained in:
parent
e924aa1a05
commit
f8a63c4055
@ -442,7 +442,8 @@ impl super::Adapter {
|
||||
let r = renderer.to_lowercase();
|
||||
// Check for Mesa sRGB clear bug. See
|
||||
// [`super::PrivateCapabilities::MESA_I915_SRGB_SHADER_CLEAR`].
|
||||
if r.contains("mesa")
|
||||
if context.is_owned()
|
||||
&& r.contains("mesa")
|
||||
&& r.contains("intel")
|
||||
&& r.split(&[' ', '(', ')'][..])
|
||||
.any(|substr| substr.len() == 3 && substr.chars().nth(2) == Some('l'))
|
||||
|
@ -293,6 +293,10 @@ unsafe impl Sync for AdapterContext {}
|
||||
unsafe impl Send for AdapterContext {}
|
||||
|
||||
impl AdapterContext {
|
||||
pub fn is_owned(&self) -> bool {
|
||||
self.egl.is_some()
|
||||
}
|
||||
|
||||
#[cfg(feature = "renderdoc")]
|
||||
pub fn raw_context(&self) -> *mut raw::c_void {
|
||||
match self.egl {
|
||||
|
@ -46,11 +46,13 @@ impl super::Queue {
|
||||
gl.draw_buffers(&[glow::COLOR_ATTACHMENT0 + draw_buffer]);
|
||||
gl.draw_arrays(glow::TRIANGLES, 0, 3);
|
||||
|
||||
// Reset the draw buffers to what they were before the clear
|
||||
let indices = (0..self.draw_buffer_count as u32)
|
||||
.map(|i| glow::COLOR_ATTACHMENT0 + i)
|
||||
.collect::<ArrayVec<_, { crate::MAX_COLOR_TARGETS }>>();
|
||||
gl.draw_buffers(&indices);
|
||||
if self.draw_buffer_count != 0 {
|
||||
// Reset the draw buffers to what they were before the clear
|
||||
let indices = (0..self.draw_buffer_count as u32)
|
||||
.map(|i| glow::COLOR_ATTACHMENT0 + i)
|
||||
.collect::<ArrayVec<_, { crate::MAX_COLOR_TARGETS }>>();
|
||||
gl.draw_buffers(&indices);
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
for draw_buffer in 0..self.draw_buffer_count as u32 {
|
||||
gl.disable_draw_buffer(glow::BLEND, draw_buffer);
|
||||
|
@ -11,6 +11,10 @@ pub struct AdapterContext {
|
||||
}
|
||||
|
||||
impl AdapterContext {
|
||||
pub fn is_owned(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Obtain a lock to the EGL context and get handle to the [`glow::Context`] that can be used to
|
||||
/// do rendering.
|
||||
#[track_caller]
|
||||
|
Loading…
Reference in New Issue
Block a user