mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 17:44:09 +01:00
hal/gles: small fixes for external context
This commit is contained in:
1 parent
e924aa1a05
commit
f8a63c4055
4 files changed
+17
-6
No files matched your search
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user