mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
wgpu backend: --screenshot capability for visual verification
Pulls the capture half of task #10 forward so we stop flying blind from stage 3 onward. WgpuViewportWindow gains captureNextFrameToPng(path); the minimal driver wires it to a --screenshot PATH flag that renders one frame, copies the surface texture back to host memory, writes a PNG via QImage, and quits. CopySrc is added to the surface configuration usage so the surface texture can be the copy source. The texel-to-buffer copy honours WebGPU's 256-byte bytes-per-row alignment by padding rows and stripping the padding when assembling the QImage. Surface format 28 (BGRA8Unorm) is byte-swapped to RGBA on the way into QImage::Format_RGBA8888; RGBA8 surface formats are memcpy'd straight through. Verified end-to-end on /tmp/basic.ifcview: 3 cube meshes/instances render with depth, back-face cull, and the hemisphere-ambient + key+fill lighting model — top face reads sky (bright), front faces read mid-tone, exactly as the WGSL shading intended. The pixel-diff half of task #10 (comparing against a GL baseline) lands later when the GL minimal binary gets an equivalent flag. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,13 @@ public:
|
||||
// can re-invoke to re-frame.
|
||||
void viewAll();
|
||||
|
||||
// Queue a one-shot framebuffer capture: the next rendered frame is
|
||||
// copied back to host memory and saved to `path` as PNG. If
|
||||
// `quit_after` is true, QCoreApplication::quit() is called once the
|
||||
// PNG is written. Use this for headless verification and pixel-diff
|
||||
// parity testing against the GL backend.
|
||||
void captureNextFrameToPng(const QString& path, bool quit_after = true);
|
||||
|
||||
protected:
|
||||
void exposeEvent(QExposeEvent* event) override;
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
@@ -147,6 +154,10 @@ private:
|
||||
// subsequent loads from snapping the camera away from where the
|
||||
// user pointed it.
|
||||
bool initial_view_applied_ = false;
|
||||
|
||||
// Pending one-shot screenshot, captured at the end of the next render().
|
||||
QString pending_screenshot_path_;
|
||||
bool pending_screenshot_quit_ = false;
|
||||
};
|
||||
|
||||
#endif // WGPUVIEWPORTWINDOW_H
|
||||
|
||||
Reference in New Issue
Block a user