mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Report all messages processed by the webgl thread.
This commit is contained in:
parent
f3f20e6c35
commit
25a61f3783
3 changed files with 36 additions and 6 deletions
|
@ -117,6 +117,7 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> {
|
||||||
/// Handles a generic WebGLMsg message
|
/// Handles a generic WebGLMsg message
|
||||||
#[inline]
|
#[inline]
|
||||||
fn handle_msg(&mut self, msg: WebGLMsg, webgl_chan: &WebGLChan) -> bool {
|
fn handle_msg(&mut self, msg: WebGLMsg, webgl_chan: &WebGLChan) -> bool {
|
||||||
|
trace!("processing {:?}", msg);
|
||||||
match msg {
|
match msg {
|
||||||
WebGLMsg::CreateContext(version, size, attributes, result_sender) => {
|
WebGLMsg::CreateContext(version, size, attributes, result_sender) => {
|
||||||
let result = self.create_webgl_context(version, size, attributes);
|
let result = self.create_webgl_context(version, size, attributes);
|
||||||
|
@ -1104,7 +1105,7 @@ impl WebGLImpl {
|
||||||
alpha_treatment,
|
alpha_treatment,
|
||||||
y_axis_treatment,
|
y_axis_treatment,
|
||||||
pixel_format,
|
pixel_format,
|
||||||
Cow::Borrowed(data),
|
Cow::Borrowed(&*data),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.gl()
|
ctx.gl()
|
||||||
|
@ -1144,7 +1145,7 @@ impl WebGLImpl {
|
||||||
alpha_treatment,
|
alpha_treatment,
|
||||||
y_axis_treatment,
|
y_axis_treatment,
|
||||||
pixel_format,
|
pixel_format,
|
||||||
Cow::Borrowed(data),
|
Cow::Borrowed(&*data),
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.gl()
|
ctx.gl()
|
||||||
|
|
|
@ -9,7 +9,9 @@ use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||||
use pixels::PixelFormat;
|
use pixels::PixelFormat;
|
||||||
use serde_bytes::ByteBuf;
|
use serde_bytes::ByteBuf;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
use std::fmt;
|
||||||
use std::num::NonZeroU32;
|
use std::num::NonZeroU32;
|
||||||
|
use std::ops::Deref;
|
||||||
use webrender_api::{DocumentId, ImageKey, PipelineId};
|
use webrender_api::{DocumentId, ImageKey, PipelineId};
|
||||||
|
|
||||||
/// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands.
|
/// Helper function that creates a WebGL channel (WebGLSender, WebGLReceiver) to be used in WebGLCommands.
|
||||||
|
@ -173,6 +175,33 @@ impl WebGLMsgSender {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize)]
|
||||||
|
pub struct TruncatedDebug<T>(T);
|
||||||
|
|
||||||
|
impl<T> From<T> for TruncatedDebug<T> {
|
||||||
|
fn from(v: T) -> TruncatedDebug<T> {
|
||||||
|
TruncatedDebug(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: fmt::Debug> fmt::Debug for TruncatedDebug<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let mut s = format!("{:?}", self.0);
|
||||||
|
if s.len() > 20 {
|
||||||
|
s.truncate(20);
|
||||||
|
s.push_str("...");
|
||||||
|
}
|
||||||
|
write!(f, "{}", s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Deref for TruncatedDebug<T> {
|
||||||
|
type Target = T;
|
||||||
|
fn deref(&self) -> &T {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// WebGL Commands for a specific WebGLContext
|
/// WebGL Commands for a specific WebGLContext
|
||||||
#[derive(Debug, Deserialize, Serialize)]
|
#[derive(Debug, Deserialize, Serialize)]
|
||||||
pub enum WebGLCommand {
|
pub enum WebGLCommand {
|
||||||
|
@ -284,7 +313,7 @@ pub enum WebGLCommand {
|
||||||
alpha_treatment: Option<AlphaTreatment>,
|
alpha_treatment: Option<AlphaTreatment>,
|
||||||
y_axis_treatment: YAxisTreatment,
|
y_axis_treatment: YAxisTreatment,
|
||||||
pixel_format: Option<PixelFormat>,
|
pixel_format: Option<PixelFormat>,
|
||||||
data: IpcSharedMemory,
|
data: TruncatedDebug<IpcSharedMemory>,
|
||||||
},
|
},
|
||||||
TexSubImage2D {
|
TexSubImage2D {
|
||||||
target: u32,
|
target: u32,
|
||||||
|
@ -300,7 +329,7 @@ pub enum WebGLCommand {
|
||||||
alpha_treatment: Option<AlphaTreatment>,
|
alpha_treatment: Option<AlphaTreatment>,
|
||||||
y_axis_treatment: YAxisTreatment,
|
y_axis_treatment: YAxisTreatment,
|
||||||
pixel_format: Option<PixelFormat>,
|
pixel_format: Option<PixelFormat>,
|
||||||
data: IpcSharedMemory,
|
data: TruncatedDebug<IpcSharedMemory>,
|
||||||
},
|
},
|
||||||
DrawingBufferWidth(WebGLSender<i32>),
|
DrawingBufferWidth(WebGLSender<i32>),
|
||||||
DrawingBufferHeight(WebGLSender<i32>),
|
DrawingBufferHeight(WebGLSender<i32>),
|
||||||
|
|
|
@ -708,7 +708,7 @@ impl WebGLRenderingContext {
|
||||||
alpha_treatment,
|
alpha_treatment,
|
||||||
y_axis_treatment,
|
y_axis_treatment,
|
||||||
pixel_format: pixels.pixel_format,
|
pixel_format: pixels.pixel_format,
|
||||||
data: pixels.data,
|
data: pixels.data.into(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some(fb) = self.bound_framebuffer.get() {
|
if let Some(fb) = self.bound_framebuffer.get() {
|
||||||
|
@ -783,7 +783,7 @@ impl WebGLRenderingContext {
|
||||||
alpha_treatment,
|
alpha_treatment,
|
||||||
y_axis_treatment,
|
y_axis_treatment,
|
||||||
pixel_format: pixels.pixel_format,
|
pixel_format: pixels.pixel_format,
|
||||||
data: pixels.data,
|
data: pixels.data.into(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue