fix the failures that were failing quietly
This commit is contained in:
+7
-6
@@ -8,9 +8,9 @@ fn main() {
|
||||
|
||||
/// Compile the HDR tonemap HLSL to bytecode at build time so we can embed it
|
||||
/// via `include_bytes`! and avoid a runtime dependency on `d3dcompiler_47.dll`.
|
||||
/// Looks for fxc.exe in the installed Windows SDK. If fxc is unavailable the
|
||||
/// .cso files are emitted empty and capture.rs falls back to runtime
|
||||
/// `D3DCompile` (so a clean checkout without the SDK still builds).
|
||||
/// Looks for fxc.exe in the installed Windows SDK. Without the SDK the .cso
|
||||
/// files are emitted empty so the build still succeeds, and there is no runtime
|
||||
/// compile path: capture.rs refuses to start on empty bytecode and says why.
|
||||
fn compile_shaders() {
|
||||
// Cargo always sets OUT_DIR for a build script; if it is missing the build
|
||||
// is broken in a way we cannot paper over, so say so plainly.
|
||||
@@ -56,15 +56,16 @@ fn compile_shaders() {
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// No SDK on the build machine - emit an empty .cso; capture.rs
|
||||
// detects the zero size and compiles the HLSL at runtime.
|
||||
// No SDK on the build machine - emit an empty .cso so the build
|
||||
// still succeeds; capture.rs rejects it at startup and points at
|
||||
// the SDK rather than failing opaquely on the first frame.
|
||||
drop(std::fs::write(&dst, []));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if fxc.is_none() {
|
||||
println!("cargo:warning=fxc.exe not found - shaders will be compiled at runtime");
|
||||
println!("cargo:warning=fxc.exe not found - shaders cannot be compiled, capture will refuse to start");
|
||||
}
|
||||
println!("cargo:rerun-if-changed=shaders/tonemap.hlsl");
|
||||
}
|
||||
|
||||
+39
-16
@@ -41,20 +41,31 @@ struct Source {
|
||||
release_api_url: &'static str,
|
||||
asset_name_suffix: &'static str,
|
||||
kind: ArchiveKind,
|
||||
/// Release download directory, used to fetch the sibling `.sha256`. None
|
||||
/// when the project publishes no checksums at all.
|
||||
download_base: Option<&'static str>,
|
||||
}
|
||||
|
||||
// `releases/latest` rather than `releases/tags/latest` for both: the latter
|
||||
// only resolves for a repo that happens to have a tag literally named "latest",
|
||||
// which GyanD does not - its tag is the version, so that URL 404s.
|
||||
//
|
||||
// BtbN is first because its zip is the path that actually installs today; the
|
||||
// 7z branch below is the fallback.
|
||||
const SOURCES: &[Source] = &[
|
||||
Source {
|
||||
name: "GyanD",
|
||||
release_api_url: "https://api.github.com/repos/GyanD/codexffmpeg/releases/tags/latest",
|
||||
asset_name_suffix: "full_build.7z",
|
||||
kind: ArchiveKind::SevenZ,
|
||||
},
|
||||
Source {
|
||||
name: "BtbN",
|
||||
release_api_url: "https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/tags/latest",
|
||||
release_api_url: "https://api.github.com/repos/BtbN/FFmpeg-Builds/releases/latest",
|
||||
asset_name_suffix: "win64-gpl.zip",
|
||||
kind: ArchiveKind::Zip,
|
||||
download_base: None,
|
||||
},
|
||||
Source {
|
||||
name: "GyanD",
|
||||
release_api_url: "https://api.github.com/repos/GyanD/codexffmpeg/releases/latest",
|
||||
asset_name_suffix: "full_build.7z",
|
||||
kind: ArchiveKind::SevenZ,
|
||||
download_base: Some("https://github.com/GyanD/codexffmpeg/releases/download"),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -104,17 +115,29 @@ where
|
||||
|
||||
let (asset, version) = pick_asset(&client, source).await?;
|
||||
|
||||
// GyanD publishes a .sha256 file alongside each release.
|
||||
// BtbN does not, so we skip verification for BtbN.
|
||||
let expected = if source.name == "GyanD" {
|
||||
let checksum_url = format!(
|
||||
"https://github.com/GyanD/codexffmpeg/releases/download/{}/{}.sha256",
|
||||
version,
|
||||
// Verify against the published checksum when there is one. GyanD used to
|
||||
// ship a .sha256 next to each asset and no longer does, so a missing
|
||||
// checksum downgrades to a logged warning rather than failing the source -
|
||||
// aborting on it would just push the user onto the unverified build anyway.
|
||||
let expected = if let Some(base) = source.download_base {
|
||||
let checksum_url = format!("{base}/{version}/{}.sha256", asset.name);
|
||||
match fetch_sha256(&client, &checksum_url).await {
|
||||
Ok(hash) => Some(hash),
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
"{} publishes no usable checksum for {} ({e:#}), continuing unverified",
|
||||
source.name,
|
||||
asset.name
|
||||
);
|
||||
None
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tracing::warn!(
|
||||
"{} publishes no checksums, downloading {} unverified",
|
||||
source.name,
|
||||
asset.name
|
||||
);
|
||||
Some(fetch_sha256(&client, &checksum_url).await?)
|
||||
} else {
|
||||
tracing::warn!("BtbN build: skipping SHA-256 verification (no checksum file)");
|
||||
None
|
||||
};
|
||||
|
||||
|
||||
@@ -213,6 +213,15 @@ fn new_vertex_buffer() -> (D3D11_BUFFER_DESC, D3D11_SUBRESOURCE_DATA) {
|
||||
|
||||
impl TonemapPipeline {
|
||||
fn new(device: &ID3D11Device, width: u32, height: u32) -> Result<Self> {
|
||||
// build.rs emits empty .cso files when fxc was missing at build time.
|
||||
// Without this the only symptom is an opaque CreateVertexShader failure
|
||||
// on the first frame of every recording.
|
||||
if FULLSCREEN_VS.is_empty() || TONEMAP_PS.is_empty() {
|
||||
bail!(
|
||||
"shader bytecode is empty - rebuild with the Windows SDK installed so build.rs can run fxc"
|
||||
);
|
||||
}
|
||||
|
||||
// Vertex shader: fullscreen-triangle pass-through (no vertex buffer).
|
||||
let mut vs = None;
|
||||
unsafe {
|
||||
|
||||
+26
-5
@@ -1045,11 +1045,29 @@ const GIF_ESTIMATE_GRID: &[u64] = &[
|
||||
104_857_600, 209_715_200,
|
||||
];
|
||||
|
||||
/// The size-table scan sweeps target sizes itself, so it needs only the inputs
|
||||
/// that shape a GIF budget - not the single requested target that
|
||||
/// `PreviewRequest` requires.
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct GifTableRequest {
|
||||
pub fps: u32,
|
||||
#[serde(default)]
|
||||
pub gif_budget_mode: GifBudgetMode,
|
||||
#[serde(default)]
|
||||
pub gif_colors: Option<u16>,
|
||||
#[serde(default)]
|
||||
pub clip_width: u32,
|
||||
#[serde(default)]
|
||||
pub clip_height: u32,
|
||||
#[serde(default)]
|
||||
pub duration_secs: Option<f64>,
|
||||
}
|
||||
|
||||
/// Return estimates for a grid of `target_bytes` values so the frontend can
|
||||
/// interpolate on slider drag without an IPC per debounce tick. The grid is
|
||||
/// geometric from 100KB to 200MB.
|
||||
#[tauri::command]
|
||||
fn estimate_gif_params_table(request: PreviewRequest) -> GifEstimateTable {
|
||||
fn estimate_gif_params_table(request: GifTableRequest) -> GifEstimateTable {
|
||||
let colors = request.gif_colors.unwrap_or(256);
|
||||
let dur = request.duration_secs.unwrap_or(0.0).max(0.1);
|
||||
let fps = request.fps;
|
||||
@@ -2214,13 +2232,16 @@ pub fn run() {
|
||||
Ok(Some(info)) => {
|
||||
tracing::info!(version = info.version, "update available");
|
||||
drop(handle.emit("update-available", &info));
|
||||
updates::stamp_check(&app_dir);
|
||||
}
|
||||
Ok(None) => tracing::debug!("no update available"),
|
||||
Ok(None) => {
|
||||
tracing::debug!("no update available");
|
||||
updates::stamp_check(&app_dir);
|
||||
}
|
||||
// No stamp on failure, so a transient network error does
|
||||
// not silence the check for the whole TTL.
|
||||
Err(e) => tracing::warn!("update check failed: {e:#}"),
|
||||
}
|
||||
// Stamp success on Ok results so a future launch won't
|
||||
// re-check until the TTL elapses. Errors don't stamp.
|
||||
updates::stamp_check(&app_dir);
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
|
||||
+13
-4
@@ -202,6 +202,12 @@
|
||||
|
||||
// ---- Actions ----
|
||||
|
||||
// Several template handlers fire a command without awaiting it; an unhandled
|
||||
// rejection there would disappear without a trace.
|
||||
function toastOnFail(p: Promise<unknown>) {
|
||||
void p.catch((e) => { errMsg = String(e) })
|
||||
}
|
||||
|
||||
async function toggleFrame() {
|
||||
useFrame = !useFrame
|
||||
try {
|
||||
@@ -418,6 +424,7 @@
|
||||
const f = format
|
||||
if (phase !== "editing" || pathOverridden || !f) return
|
||||
void api.defaultOutputPath(f).then(p => { if (!pathOverridden) outputPath = p })
|
||||
.catch(e => console.warn("could not resolve the default output path:", e))
|
||||
})
|
||||
|
||||
// Auto-dismiss error toast
|
||||
@@ -528,15 +535,15 @@
|
||||
{#each PRESETS as [w, h, label]}
|
||||
<button class="chip" onclick={() => {
|
||||
aspectLock = w / h
|
||||
api.setOverlayAspect(aspectLock)
|
||||
toastOnFail(api.setOverlayAspect(aspectLock))
|
||||
emit("overlay-set-ratio", { ratio: aspectLock })
|
||||
api.setOverlaySize(w, h)
|
||||
toastOnFail(api.setOverlaySize(w, h))
|
||||
}}>{label}</button>
|
||||
{/each}
|
||||
{#if aspectLock !== null}
|
||||
<button class="chip unlock" onclick={() => {
|
||||
aspectLock = null
|
||||
api.setOverlayAspect(null)
|
||||
toastOnFail(api.setOverlayAspect(null))
|
||||
emit("overlay-set-ratio", { ratio: null })
|
||||
}}>Unlock</button>
|
||||
{/if}
|
||||
@@ -712,7 +719,9 @@
|
||||
<p class="done-path mono">{exportResult.output_path}</p>
|
||||
<div class="done-actions">
|
||||
<button class="btn-primary" onclick={startOver}>Record another</button>
|
||||
<button class="btn-ghost" onclick={() => exportResult && api.revealInExplorer(exportResult.output_path)}>
|
||||
<button class="btn-ghost" onclick={() => {
|
||||
if (exportResult) toastOnFail(api.revealInExplorer(exportResult.output_path))
|
||||
}}>
|
||||
Show in explorer
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
void (async () => {
|
||||
await refresh()
|
||||
win.onMoved(refresh).then(fn => { if (mounted) unlisten.push(fn) })
|
||||
.catch(e => console.warn("could not watch the picker window position:", e))
|
||||
let hoverDebounce = 0
|
||||
listen<Rect>("picker-hover", (e) => {
|
||||
clearTimeout(hoverDebounce)
|
||||
|
||||
+11
-3
@@ -62,6 +62,10 @@
|
||||
try { diagnostics = await api.diagnosticsInfo() } catch { diagnostics = null }
|
||||
}
|
||||
|
||||
function openLogFolder() {
|
||||
void api.openLogDir().catch(e => console.warn("could not open the log folder:", e))
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!cfg) return
|
||||
|
||||
@@ -94,8 +98,12 @@
|
||||
|
||||
async function pickOutputDir() {
|
||||
if (!cfg) return
|
||||
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
||||
if (typeof picked === "string") cfg.output_dir = picked
|
||||
try {
|
||||
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
||||
if (typeof picked === "string") cfg.output_dir = picked
|
||||
} catch (e) {
|
||||
console.warn("directory picker failed:", e)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -288,7 +296,7 @@
|
||||
<div class="diag-row">
|
||||
<span class="field-label">Log folder</span>
|
||||
<span class="diag-val mono">{diagnostics ? diagnostics.log_dir : "..."}</span>
|
||||
<button class="btn-ghost compact" onclick={() => api.openLogDir()} disabled={!diagnostics}>Open</button>
|
||||
<button class="btn-ghost compact" onclick={openLogFolder} disabled={!diagnostics}>Open</button>
|
||||
</div>
|
||||
<div class="diag-tail-wrap">
|
||||
<div class="diag-tail-head">
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
})
|
||||
|
||||
function dismiss() { info = null; errMsg = null; phase = "info" }
|
||||
function viewRelease() { if (info) void api.openUrl(info.release_url) }
|
||||
function viewRelease() {
|
||||
if (!info) return
|
||||
void api.openUrl(info.release_url).catch(e => { errMsg = String(e); phase = "error" })
|
||||
}
|
||||
|
||||
async function download() {
|
||||
if (!info?.download_url) { errMsg = "no downloadable exe in this release"; phase = "error"; return }
|
||||
|
||||
Reference in New Issue
Block a user