(bytes: Uint8Array)
| 156 | * - _pad0: u32 (bytes 52-55) |
| 157 | */ |
| 158 | export function parseFrameRecord(bytes: Uint8Array): DebugParseResult<FrameRecord> { |
| 159 | if (bytes.byteLength < DEBUG_FRAME_RECORD_SIZE) { |
| 160 | return fail( |
| 161 | "ZR_TRUNCATED", |
| 162 | 0, |
| 163 | `need ${DEBUG_FRAME_RECORD_SIZE} bytes for frame record but only ${bytes.byteLength} available`, |
| 164 | ); |
| 165 | } |
| 166 | |
| 167 | const r = new BinaryReader(bytes); |
| 168 | |
| 169 | const frameId = readU64(r); |
| 170 | const cols = r.readU32(); |
| 171 | const rows = r.readU32(); |
| 172 | const drawlistBytes = r.readU32(); |
| 173 | const drawlistCmds = r.readU32(); |
| 174 | const diffBytesEmitted = r.readU32(); |
| 175 | const dirtyLines = r.readU32(); |
| 176 | const dirtyCells = r.readU32(); |
| 177 | const damageRects = r.readU32(); |
| 178 | const usDrawlist = r.readU32(); |
| 179 | const usDiff = r.readU32(); |
| 180 | const usWrite = r.readU32(); |
| 181 | // Skip _pad0 |
| 182 | |
| 183 | return { |
| 184 | ok: true, |
| 185 | value: { |
| 186 | frameId, |
| 187 | cols, |
| 188 | rows, |
| 189 | drawlistBytes, |
| 190 | drawlistCmds, |
| 191 | diffBytesEmitted, |
| 192 | dirtyLines, |
| 193 | dirtyCells, |
| 194 | damageRects, |
| 195 | usDrawlist, |
| 196 | usDiff, |
| 197 | usWrite, |
| 198 | }, |
| 199 | }; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Parse an event record payload. |
no test coverage detected