mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
app: add debug str to gfx batches
This commit is contained in:
@@ -44,9 +44,6 @@ Instr = Union[SetScale, Move, SetPos, ApplyView, Draw]
|
||||
def hex(dat):
|
||||
return " ".join(f"{b:02x}" for b in dat)
|
||||
|
||||
def read_tag(cur):
|
||||
return serial.decode_str(cur)
|
||||
|
||||
DrawCall = namedtuple("DrawCall", [
|
||||
"dc_id",
|
||||
"instrs",
|
||||
@@ -94,16 +91,16 @@ def read_instr(cur):
|
||||
case 4:
|
||||
vert_id = serial.read_u32(cur)
|
||||
vert_epoch = serial.read_u32(cur)
|
||||
vert_tag = serial.decode_opt(cur, read_tag)
|
||||
vert_tag = serial.decode_opt(cur, serial.decode_str)
|
||||
vert_buftype = serial.read_u8(cur)
|
||||
index_id = serial.read_u32(cur)
|
||||
index_epoch = serial.read_u32(cur)
|
||||
index_tag = serial.decode_opt(cur, read_tag)
|
||||
index_tag = serial.decode_opt(cur, serial.decode_str)
|
||||
index_buftype = serial.read_u8(cur)
|
||||
def read_tex(cur):
|
||||
id = serial.read_u32(cur)
|
||||
epoch = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
return (id, epoch, tag)
|
||||
tex = serial.decode_opt(cur, read_tex)
|
||||
num_elements = serial.read_i32(cur)
|
||||
@@ -145,6 +142,7 @@ class PutDrawCall:
|
||||
class PutStartBatch:
|
||||
epoch: int
|
||||
batch_id: int
|
||||
debug_str: str
|
||||
stat: int
|
||||
|
||||
@dataclass
|
||||
@@ -240,19 +238,20 @@ def read_section(f):
|
||||
case 1:
|
||||
epoch = serial.read_u32(cur)
|
||||
batch_id = serial.read_u32(cur)
|
||||
debug_str = serial.decode_opt(cur, serial.decode_str)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"put_start_batch epoch={epoch}, batch_id={batch_id}, stat={stat}")
|
||||
sect = PutStartBatch(epoch, batch_id, timest, dcs, stats)
|
||||
sect = PutStartBatch(epoch, batch_id, debug_str, stats)
|
||||
case 2:
|
||||
epoch = serial.read_u32(cur)
|
||||
batch_id = serial.read_u32(cur)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"put_end_batch epoch={epoch}, batch_id={batch_id}, stat={stat}")
|
||||
sect = PutEndBatch(epoch, batch_id, timest, dcs, stats)
|
||||
sect = PutEndBatch(epoch, batch_id, stats)
|
||||
case 3:
|
||||
epoch = serial.read_u32(cur)
|
||||
tex = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"put_tex epoch={epoch}, tex={tex}, tag='{tag}', stat={stat}")
|
||||
sect = PutTex(epoch, tex, tag, stat)
|
||||
@@ -260,7 +259,7 @@ def read_section(f):
|
||||
epoch = serial.read_u32(cur)
|
||||
verts = serial.decode_arr(cur, read_vert)
|
||||
buf = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
buftype = serial.read_u8(cur)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"put_verts epoch={epoch}, buf={buf}, tag='{tag}', buftype={buftype}, stat={stat}")
|
||||
@@ -269,7 +268,7 @@ def read_section(f):
|
||||
epoch = serial.read_u32(cur)
|
||||
idxs = serial.decode_arr(cur, serial.read_u16)
|
||||
buf = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
buftype = serial.read_u8(cur)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"put_idxs epoch={epoch}, buf={buf}, tag='{tag}', buftype={buftype}, stat={stat}")
|
||||
@@ -277,14 +276,14 @@ def read_section(f):
|
||||
case 6:
|
||||
epoch = serial.read_u32(cur)
|
||||
buf = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"del_tex epoch={epoch}, buf={buf}, tag='{tag}', stat={stat}")
|
||||
sect = DelTex(epoch, buf, tag, stat)
|
||||
case 7:
|
||||
epoch = serial.read_u32(cur)
|
||||
buf = serial.read_u32(cur)
|
||||
tag = serial.decode_opt(cur, read_tag)
|
||||
tag = serial.decode_opt(cur, serial.decode_str)
|
||||
buftype = serial.read_u8(cur)
|
||||
stat = serial.read_u8(cur)
|
||||
#print(f"del_buf epoch={epoch}, buf={buf}, tag='{tag}', buftype={buftype}, stat={stat}")
|
||||
|
||||
@@ -27,7 +27,7 @@ use crate::android;
|
||||
|
||||
use crate::{
|
||||
error::Error,
|
||||
gfx::{EpochIndex, GraphicsEventPublisherPtr, RenderApi},
|
||||
gfx::{gfxtag, EpochIndex, GraphicsEventPublisherPtr, RenderApi},
|
||||
plugin::PluginSettings,
|
||||
prop::{Property, PropertyAtomicGuard, PropertySubType, PropertyType, PropertyValue, Role},
|
||||
scene::{Pimpl, SceneNode, SceneNodePtr, SceneNodeType},
|
||||
@@ -221,7 +221,7 @@ impl App {
|
||||
}
|
||||
|
||||
async fn trigger_draw(&self) {
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("App::trigger_draw"));
|
||||
let window_node = self.sg_root.lookup_node("/window").expect("no window attached!");
|
||||
match window_node.pimpl() {
|
||||
Pimpl::Window(win) => win.draw(atom).await,
|
||||
|
||||
@@ -29,6 +29,7 @@ use crate::{
|
||||
App,
|
||||
},
|
||||
expr::{self, Compiler},
|
||||
gfx::gfxtag,
|
||||
plugin::darkirc,
|
||||
prop::{
|
||||
Property, PropertyAtomicGuard, PropertyBool, PropertyFloat32, PropertyStr, PropertySubType,
|
||||
@@ -291,7 +292,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let goback = async move || {
|
||||
info!(target: "app::chat", "clicked back");
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("goback action"));
|
||||
|
||||
let editz_node = layer_node2.lookup_node("/content/editz").unwrap();
|
||||
editz_node.call_method("unfocus", vec![]).await.unwrap();
|
||||
@@ -847,7 +848,7 @@ pub async fn make(
|
||||
let chatview_node = chatview_node.clone();
|
||||
let render_api = render_api.clone();
|
||||
async move {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("sendmsg action"));
|
||||
|
||||
let mut text = editz_text.get();
|
||||
info!(target: "app::chat", "Send '{text}' to channel: {channel}");
|
||||
@@ -972,7 +973,7 @@ pub async fn make(
|
||||
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
info!(target: "app::chat", "clicked emoji");
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("emoji click action"));
|
||||
|
||||
if cfg!(target_os = "android") {
|
||||
let keyb_height = android_keyboard_height();
|
||||
@@ -1049,7 +1050,7 @@ pub async fn make(
|
||||
let listen_click = app.ex.spawn(async move {
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
info!(target: "app::chat", "clicked /nick");
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("nickcmd_clicked action"));
|
||||
// This will autohide this popup due to ending in a space.
|
||||
// Setting the property will retrigger the logic whether to show popup.
|
||||
editz_text2.set(atom, "/nick ");
|
||||
@@ -1315,7 +1316,7 @@ pub async fn make(
|
||||
let listen_click = app.ex.spawn(async move {
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
info!(target: "app::chat", "clicked copy");
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("copy_clicked action"));
|
||||
actions_is_visible2.set(atom, false);
|
||||
let select_text = editz_select_text2.get_str(0).unwrap();
|
||||
miniquad::window::clipboard_set(&select_text);
|
||||
@@ -1342,7 +1343,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let listen_click = app.ex.spawn(async move {
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("paste_clicked action"));
|
||||
if let Some(text) = miniquad::window::clipboard_get() {
|
||||
info!(target: "app::chat", "clicked paste: {text}");
|
||||
let mut data = vec![];
|
||||
@@ -1406,7 +1407,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let listen_click = app.ex.spawn(async move {
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("paste_req action"));
|
||||
pasta_is_visible2.set(atom, true);
|
||||
}
|
||||
});
|
||||
@@ -1492,7 +1493,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let listen_click = app.ex.spawn(async move {
|
||||
while let Ok(_) = recvr.recv().await {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("paste_clicked action"));
|
||||
if let Some(text) = miniquad::window::clipboard_get() {
|
||||
info!(target: "app::chat", "clicked paste: {text}");
|
||||
let mut data = vec![];
|
||||
@@ -1513,7 +1514,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let editz_select_task = app.ex.spawn(async move {
|
||||
while let Ok(_) = editz_select_sub.receive().await {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("edit select task"));
|
||||
if editz_select_text.is_null(0).unwrap() {
|
||||
info!(target: "app::chat", "selection changed: null");
|
||||
actions_is_visible.set(atom, false);
|
||||
@@ -1533,7 +1534,7 @@ pub async fn make(
|
||||
let render_api = app.render_api.clone();
|
||||
let editz_text_task = app.ex.spawn(async move {
|
||||
while let Ok(_) = editz_text_sub.receive().await {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("chatedit txt changed"));
|
||||
pasta_is_visible.set(atom, false);
|
||||
|
||||
let text = editz_text.get();
|
||||
|
||||
@@ -22,6 +22,7 @@ use crate::{
|
||||
App,
|
||||
},
|
||||
expr,
|
||||
gfx::gfxtag,
|
||||
prop::{PropertyAtomicGuard, PropertyBool, PropertyFloat32, Role},
|
||||
scene::{SceneNodePtr, Slot},
|
||||
ui::{Button, Layer, ShapeVertex, Shortcut, Text, VectorArt, VectorShape},
|
||||
@@ -255,7 +256,7 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
|
||||
|
||||
let render_api = app.render_api.clone();
|
||||
let select_channel = move || {
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("channel_clicked"));
|
||||
info!(target: "app::menu", "clicked: {channel}!");
|
||||
chatview_is_visible.set(atom, true);
|
||||
menu_is_visible.set(atom, false);
|
||||
|
||||
@@ -26,6 +26,7 @@ use crate::{
|
||||
App,
|
||||
},
|
||||
expr::{self, Compiler},
|
||||
gfx::gfxtag,
|
||||
prop::{PropertyAtomicGuard, Role},
|
||||
scene::{SceneNodePtr, Slot},
|
||||
shape,
|
||||
@@ -153,7 +154,7 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
|
||||
scale.encode(&mut file).unwrap();
|
||||
}
|
||||
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("zoom_out shortcut"));
|
||||
window_scale2.set_property_f32(atom, Role::User, "value", scale).unwrap();
|
||||
}
|
||||
});
|
||||
@@ -181,7 +182,7 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
|
||||
scale.encode(&mut file).unwrap();
|
||||
}
|
||||
|
||||
let atom = &mut render_api.make_guard();
|
||||
let atom = &mut render_api.make_guard(gfxtag!("zoom_in shortcut"));
|
||||
window_scale2.set_property_f32(atom, Role::User, "value", scale).unwrap();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -266,8 +266,8 @@ impl RenderApi {
|
||||
self.send(method);
|
||||
}
|
||||
|
||||
fn start_batch(&self, batch_id: BatchGuardId) {
|
||||
let method = GraphicsMethod::StartBatch(batch_id);
|
||||
fn start_batch(&self, batch_id: BatchGuardId, debug_str: Option<&'static str>) {
|
||||
let method = GraphicsMethod::StartBatch((batch_id, debug_str));
|
||||
self.send(method);
|
||||
}
|
||||
fn end_batch(&self, batch_id: BatchGuardId) {
|
||||
@@ -275,9 +275,9 @@ impl RenderApi {
|
||||
self.send(method);
|
||||
}
|
||||
|
||||
pub fn make_guard(&self) -> PropertyAtomicGuard {
|
||||
pub fn make_guard(&self, debug_str: Option<&'static str>) -> PropertyAtomicGuard {
|
||||
let r = self.clone();
|
||||
let start_batch = Box::new(move |bid| r.start_batch(bid));
|
||||
let start_batch = Box::new(move |bid| r.start_batch(bid, debug_str));
|
||||
let r = self.clone();
|
||||
let end_batch = Box::new(move |bid| r.end_batch(bid));
|
||||
PropertyAtomicGuard::new(start_batch, end_batch)
|
||||
@@ -676,7 +676,7 @@ pub enum GraphicsMethod {
|
||||
NewIndexBuffer((Vec<u16>, GfxBufferId, DebugTag)),
|
||||
DeleteBuffer((GfxBufferId, DebugTag, u8)),
|
||||
ReplaceDrawCalls { batch_id: BatchGuardId, timest: Timestamp, dcs: Vec<(DcId, GfxDrawCall)> },
|
||||
StartBatch(BatchGuardId),
|
||||
StartBatch((BatchGuardId, Option<&'static str>)),
|
||||
EndBatch(BatchGuardId),
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ impl std::fmt::Debug for GraphicsMethod {
|
||||
Self::ReplaceDrawCalls { batch_id: bid, timest: _, dcs: _ } => {
|
||||
write!(f, "ReplaceDrawCalls({bid})")
|
||||
}
|
||||
Self::StartBatch(bid) => write!(f, "StartBatch({bid})"),
|
||||
Self::StartBatch((bid, debug_str)) => write!(f, "StartBatch({bid}, {debug_str:?})"),
|
||||
Self::EndBatch(bid) => write!(f, "EndBatch({bid})"),
|
||||
}
|
||||
}
|
||||
@@ -953,7 +953,8 @@ impl Stage {
|
||||
}
|
||||
GraphicsMethod::DeleteBuffer((gbuff_id, _, _)) => self.method_delete_buffer(*gbuff_id),
|
||||
GraphicsMethod::ReplaceDrawCalls { batch_id, timest, dcs } => {
|
||||
t!("Commit dc to {batch_id}");
|
||||
let debug_strs: Vec<_> = dcs.iter().map(|(_, dc)| dc.debug_str).collect();
|
||||
t!("Commit dc to {batch_id}: {debug_strs:?}");
|
||||
let batch = self.batches.get_mut(batch_id).unwrap();
|
||||
let dcs = std::mem::take(dcs);
|
||||
batch.push(GraphicsMethod::ReplaceDrawCalls {
|
||||
@@ -966,8 +967,8 @@ impl Stage {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
GraphicsMethod::StartBatch(batch_id) => {
|
||||
t!("Start batch {batch_id}");
|
||||
GraphicsMethod::StartBatch((batch_id, debug_str)) => {
|
||||
t!("Start batch {batch_id}: {debug_str:?}");
|
||||
if !self.batches.insert(*batch_id, vec![]).is_none() {
|
||||
panic!("Batch {batch_id} already open!")
|
||||
}
|
||||
@@ -1184,8 +1185,8 @@ impl Stage {
|
||||
GraphicsMethod::ReplaceDrawCalls { batch_id, timest, dcs } => {
|
||||
trax.put_dcs(epoch, *batch_id, *timest, dcs);
|
||||
}
|
||||
GraphicsMethod::StartBatch(batch_id) => {
|
||||
trax.put_start_batch(epoch, *batch_id);
|
||||
GraphicsMethod::StartBatch((batch_id, debug_str)) => {
|
||||
trax.put_start_batch(epoch, *batch_id, *debug_str);
|
||||
}
|
||||
GraphicsMethod::EndBatch(batch_id) => {
|
||||
trax.put_end_batch(epoch, *batch_id);
|
||||
|
||||
@@ -62,10 +62,16 @@ impl Trax {
|
||||
dcs.encode(&mut self.buf).unwrap();
|
||||
}
|
||||
|
||||
pub fn put_start_batch(&mut self, epoch: EpochIndex, batch_id: BatchGuardId) {
|
||||
pub fn put_start_batch(
|
||||
&mut self,
|
||||
epoch: EpochIndex,
|
||||
batch_id: BatchGuardId,
|
||||
debug_str: Option<&'static str>,
|
||||
) {
|
||||
d!("put_start_batch({epoch}, {batch_id})");
|
||||
1u8.encode(&mut self.buf).unwrap();
|
||||
batch_id.encode(&mut self.buf).unwrap();
|
||||
debug_str.encode(&mut self.buf).unwrap();
|
||||
}
|
||||
|
||||
pub fn put_end_batch(&mut self, epoch: EpochIndex, batch_id: BatchGuardId) {
|
||||
|
||||
@@ -24,7 +24,7 @@ use zeromq::{Socket, SocketRecv, SocketSend};
|
||||
use crate::{
|
||||
error::{Error, Result},
|
||||
expr::SExprCode,
|
||||
gfx::RenderApi,
|
||||
gfx::{gfxtag, RenderApi},
|
||||
prop::{PropertyType, Role},
|
||||
scene::{SceneNodeId, SceneNodePtr, ScenePath},
|
||||
ExecutorPtr,
|
||||
@@ -242,7 +242,8 @@ impl ZeroMQAdapter {
|
||||
let node = self.sg_root.lookup_node(node_path).ok_or(Error::NodeNotFound)?;
|
||||
let prop = node.get_property(&prop_name).ok_or(Error::PropertyNotFound)?;
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom =
|
||||
&mut self.render_api.make_guard(gfxtag!("ZeroMQAdapter::SetPropertyValue"));
|
||||
|
||||
match prop_type {
|
||||
PropertyType::Null => {
|
||||
|
||||
@@ -789,7 +789,7 @@ impl ChatEdit {
|
||||
|
||||
async fn handle_touch_move(&self, mut touch_pos: Point) -> bool {
|
||||
//t!("handle_touch_move({touch_pos:?})");
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_touch_move"));
|
||||
// We must update with non relative touch_pos bcos when doing vertical scrolling
|
||||
// we will modify the scroll, which is used by abs_to_local(), which is used
|
||||
// to then calculate the max scroll. So it ends up jumping around.
|
||||
@@ -1240,7 +1240,8 @@ impl ChatEdit {
|
||||
panic!("self destroyed before insert_text_method_task was stopped!");
|
||||
};
|
||||
|
||||
let atom = &mut self_.render_api.make_guard();
|
||||
let atom =
|
||||
&mut self_.render_api.make_guard(gfxtag!("ChatEdit::process_insert_text_method"));
|
||||
self_.insert(&text, atom).await;
|
||||
self_.redraw(atom).await;
|
||||
true
|
||||
@@ -1292,7 +1293,7 @@ impl ChatEdit {
|
||||
return
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_android_event"));
|
||||
match ev {
|
||||
AndroidSuggestEvent::Init => {
|
||||
let mut editor = self.lock_editor().await;
|
||||
@@ -1339,7 +1340,7 @@ impl ChatEdit {
|
||||
|
||||
impl Drop for ChatEdit {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatEdit::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
@@ -1460,7 +1461,7 @@ impl UIObject for ChatEdit {
|
||||
|
||||
// Invert the bool
|
||||
self_.cursor_is_visible.fetch_not(Ordering::Relaxed);
|
||||
let atom = &mut self_.render_api.make_guard();
|
||||
let atom = &mut self_.render_api.make_guard(gfxtag!("ChatEdit::start"));
|
||||
self_.redraw_cursor(atom.batch_id).await;
|
||||
}
|
||||
});
|
||||
@@ -1532,7 +1533,7 @@ impl UIObject for ChatEdit {
|
||||
repeater.key_down(PressedKey::Char(key), repeat)
|
||||
};
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_char"));
|
||||
|
||||
if mods.ctrl || mods.alt || mods.logo {
|
||||
if repeat {
|
||||
@@ -1575,7 +1576,7 @@ impl UIObject for ChatEdit {
|
||||
t!("Key {:?} has {} actions", key, actions);
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_key_down"));
|
||||
|
||||
let mut is_handled = false;
|
||||
for _ in 0..actions {
|
||||
@@ -1607,7 +1608,7 @@ impl UIObject for ChatEdit {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_mouse_btn_down"));
|
||||
|
||||
// clicking inside box will:
|
||||
// 1. make it active
|
||||
@@ -1662,7 +1663,7 @@ impl UIObject for ChatEdit {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_mouse_move"));
|
||||
|
||||
// if active and selection_active, then use x to modify the selection.
|
||||
// also implement scrolling when cursor is to the left or right
|
||||
@@ -1699,7 +1700,7 @@ impl UIObject for ChatEdit {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_mouse_wheel"));
|
||||
|
||||
let mut scroll = self.scroll.get() - wheel_pos.y * self.scroll_speed.get();
|
||||
scroll = scroll.clamp(0., self.max_scroll());
|
||||
@@ -1720,7 +1721,7 @@ impl UIObject for ChatEdit {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatEdit::handle_touch"));
|
||||
|
||||
match phase {
|
||||
TouchPhase::Started => self.handle_touch_start(touch_pos).await,
|
||||
|
||||
@@ -38,7 +38,7 @@ mod page;
|
||||
use page::MessageBuffer;
|
||||
|
||||
use crate::{
|
||||
gfx::{GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
|
||||
gfx::{gfxtag, GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
|
||||
prop::{
|
||||
BatchGuardId, BatchGuardPtr, PropertyAtomicGuard, PropertyBool, PropertyColor,
|
||||
PropertyFloat32, PropertyRect, PropertyUint32, Role,
|
||||
@@ -454,7 +454,7 @@ impl ChatView {
|
||||
}
|
||||
}
|
||||
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatView::handle_insert_line"));
|
||||
self.redraw_cached(atom.batch_id, &mut msgbuf, trace_id).await;
|
||||
self.bgload_cv.notify();
|
||||
}
|
||||
@@ -474,7 +474,7 @@ impl ChatView {
|
||||
let mut msgbuf = self.msgbuf.lock().await;
|
||||
let Some(privmsg) = msgbuf.insert_privmsg(timest, msg_id, nick, text) else { return };
|
||||
privmsg.confirmed = false;
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatView::handle_insert_unconf_line"));
|
||||
self.redraw_cached(atom.batch_id, &mut msgbuf, trace_id).await;
|
||||
self.bgload_cv.notify();
|
||||
}
|
||||
@@ -590,7 +590,7 @@ impl ChatView {
|
||||
}
|
||||
t!("do_redraw = {do_redraw} [trace_id={trace_id}]");
|
||||
if do_redraw {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatView::handle_bgload"));
|
||||
self.redraw_cached(atom.batch_id, &mut msgbuf, trace_id).await;
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ impl UIObject for ChatView {
|
||||
// Should not happen
|
||||
panic!("self destroyed before motion_task was stopped!");
|
||||
};
|
||||
let atom = &mut self_.render_api.make_guard();
|
||||
let atom = &mut self_.render_api.make_guard(gfxtag!("ChatView::motion_task"));
|
||||
self_.handle_movement(atom).await;
|
||||
cv.reset();
|
||||
}
|
||||
@@ -886,7 +886,7 @@ impl UIObject for ChatView {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatView::handle_mouse_btn_down"));
|
||||
|
||||
if ENABLE_SELECT {
|
||||
self.select_line(atom.batch_id, mouse_pos.y).await;
|
||||
@@ -922,7 +922,7 @@ impl UIObject for ChatView {
|
||||
}
|
||||
|
||||
if ENABLE_SELECT {
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatView::handle_mouse_move"));
|
||||
self.select_line(atom.batch_id, mouse_pos.y).await;
|
||||
}
|
||||
false
|
||||
@@ -951,7 +951,7 @@ impl UIObject for ChatView {
|
||||
|
||||
let rect = self.rect.get();
|
||||
t!("handle_touch({phase:?}, {id},{id}, {touch_pos:?})");
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("ChatView::handle_touch"));
|
||||
|
||||
let touch_y = touch_pos.y;
|
||||
|
||||
@@ -1048,7 +1048,7 @@ impl UIObject for ChatView {
|
||||
|
||||
impl Drop for ChatView {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("ChatView::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
|
||||
@@ -27,7 +27,7 @@ use std::sync::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
gfx::{GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
|
||||
gfx::{gfxtag, GfxDrawCall, GfxDrawInstruction, Point, Rectangle, RenderApi},
|
||||
prop::{
|
||||
BatchGuardPtr, PropertyAtomicGuard, PropertyFloat32, PropertyRect, PropertyUint32, Role,
|
||||
},
|
||||
@@ -304,7 +304,7 @@ impl UIObject for EmojiPicker {
|
||||
return false
|
||||
}
|
||||
t!("handle_mouse_wheel()");
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("EmojiPicker::handle_mouse_wheel"));
|
||||
|
||||
let mut scroll = self.scroll.get();
|
||||
scroll -= self.mouse_scroll_speed.get() * wheel_pos.y;
|
||||
@@ -334,7 +334,7 @@ impl UIObject for EmojiPicker {
|
||||
return false
|
||||
}
|
||||
|
||||
let atom = &mut self.render_api.make_guard();
|
||||
let atom = &mut self.render_api.make_guard(gfxtag!("EmojiPicker::handle_touch"));
|
||||
|
||||
let rect = self.rect.get();
|
||||
let pos = touch_pos - Point::new(rect.x, rect.y);
|
||||
@@ -395,7 +395,7 @@ impl UIObject for EmojiPicker {
|
||||
|
||||
impl Drop for EmojiPicker {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("EmojiPicker::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
|
||||
@@ -223,7 +223,7 @@ impl UIObject for Image {
|
||||
|
||||
impl Drop for Image {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("Image::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
|
||||
@@ -215,7 +215,7 @@ impl UIObject for Text {
|
||||
|
||||
impl Drop for Text {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("Text::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
|
||||
@@ -177,7 +177,7 @@ impl UIObject for VectorArt {
|
||||
|
||||
impl Drop for VectorArt {
|
||||
fn drop(&mut self) {
|
||||
let atom = self.render_api.make_guard();
|
||||
let atom = self.render_api.make_guard(gfxtag!("VectorArt::drop"));
|
||||
self.render_api.replace_draw_calls(
|
||||
atom.batch_id,
|
||||
unixtime(),
|
||||
|
||||
@@ -23,7 +23,7 @@ use std::sync::{Arc, Weak};
|
||||
use crate::{
|
||||
app::locale::read_locale_ftl,
|
||||
gfx::{
|
||||
GfxDrawCall, GfxDrawInstruction, GraphicsEventCharSub, GraphicsEventKeyDownSub,
|
||||
gfxtag, GfxDrawCall, GfxDrawInstruction, GraphicsEventCharSub, GraphicsEventKeyDownSub,
|
||||
GraphicsEventKeyUpSub, GraphicsEventMouseButtonDownSub, GraphicsEventMouseButtonUpSub,
|
||||
GraphicsEventMouseMoveSub, GraphicsEventMouseWheelSub, GraphicsEventPublisherPtr,
|
||||
GraphicsEventTouchSub, Point, Rectangle, RenderApi,
|
||||
@@ -124,7 +124,7 @@ impl Window {
|
||||
panic!("self destroyed before modify_task was stopped!");
|
||||
};
|
||||
|
||||
let atom = &mut self_.render_api.make_guard();
|
||||
let atom = &mut self_.render_api.make_guard(gfxtag!("Window::resize_task"));
|
||||
// Now update the properties
|
||||
screen_size2.set(atom, size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user