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
|
/// 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`.
|
/// 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
|
/// Looks for fxc.exe in the installed Windows SDK. Without the SDK the .cso
|
||||||
/// .cso files are emitted empty and capture.rs falls back to runtime
|
/// files are emitted empty so the build still succeeds, and there is no runtime
|
||||||
/// `D3DCompile` (so a clean checkout without the SDK still builds).
|
/// compile path: capture.rs refuses to start on empty bytecode and says why.
|
||||||
fn compile_shaders() {
|
fn compile_shaders() {
|
||||||
// Cargo always sets OUT_DIR for a build script; if it is missing the build
|
// 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.
|
// is broken in a way we cannot paper over, so say so plainly.
|
||||||
@@ -56,15 +56,16 @@ fn compile_shaders() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// No SDK on the build machine - emit an empty .cso; capture.rs
|
// No SDK on the build machine - emit an empty .cso so the build
|
||||||
// detects the zero size and compiles the HLSL at runtime.
|
// 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, []));
|
drop(std::fs::write(&dst, []));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fxc.is_none() {
|
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");
|
println!("cargo:rerun-if-changed=shaders/tonemap.hlsl");
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-15
@@ -41,20 +41,31 @@ struct Source {
|
|||||||
release_api_url: &'static str,
|
release_api_url: &'static str,
|
||||||
asset_name_suffix: &'static str,
|
asset_name_suffix: &'static str,
|
||||||
kind: ArchiveKind,
|
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] = &[
|
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 {
|
Source {
|
||||||
name: "BtbN",
|
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",
|
asset_name_suffix: "win64-gpl.zip",
|
||||||
kind: ArchiveKind::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?;
|
let (asset, version) = pick_asset(&client, source).await?;
|
||||||
|
|
||||||
// GyanD publishes a .sha256 file alongside each release.
|
// Verify against the published checksum when there is one. GyanD used to
|
||||||
// BtbN does not, so we skip verification for BtbN.
|
// ship a .sha256 next to each asset and no longer does, so a missing
|
||||||
let expected = if source.name == "GyanD" {
|
// checksum downgrades to a logged warning rather than failing the source -
|
||||||
let checksum_url = format!(
|
// aborting on it would just push the user onto the unverified build anyway.
|
||||||
"https://github.com/GyanD/codexffmpeg/releases/download/{}/{}.sha256",
|
let expected = if let Some(base) = source.download_base {
|
||||||
version,
|
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
|
asset.name
|
||||||
);
|
);
|
||||||
Some(fetch_sha256(&client, &checksum_url).await?)
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
tracing::warn!("BtbN build: skipping SHA-256 verification (no checksum file)");
|
tracing::warn!(
|
||||||
|
"{} publishes no checksums, downloading {} unverified",
|
||||||
|
source.name,
|
||||||
|
asset.name
|
||||||
|
);
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,15 @@ fn new_vertex_buffer() -> (D3D11_BUFFER_DESC, D3D11_SUBRESOURCE_DATA) {
|
|||||||
|
|
||||||
impl TonemapPipeline {
|
impl TonemapPipeline {
|
||||||
fn new(device: &ID3D11Device, width: u32, height: u32) -> Result<Self> {
|
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).
|
// Vertex shader: fullscreen-triangle pass-through (no vertex buffer).
|
||||||
let mut vs = None;
|
let mut vs = None;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|||||||
+26
-5
@@ -1045,11 +1045,29 @@ const GIF_ESTIMATE_GRID: &[u64] = &[
|
|||||||
104_857_600, 209_715_200,
|
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
|
/// 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
|
/// interpolate on slider drag without an IPC per debounce tick. The grid is
|
||||||
/// geometric from 100KB to 200MB.
|
/// geometric from 100KB to 200MB.
|
||||||
#[tauri::command]
|
#[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 colors = request.gif_colors.unwrap_or(256);
|
||||||
let dur = request.duration_secs.unwrap_or(0.0).max(0.1);
|
let dur = request.duration_secs.unwrap_or(0.0).max(0.1);
|
||||||
let fps = request.fps;
|
let fps = request.fps;
|
||||||
@@ -2214,13 +2232,16 @@ pub fn run() {
|
|||||||
Ok(Some(info)) => {
|
Ok(Some(info)) => {
|
||||||
tracing::info!(version = info.version, "update available");
|
tracing::info!(version = info.version, "update available");
|
||||||
drop(handle.emit("update-available", &info));
|
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:#}"),
|
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(())
|
Ok(())
|
||||||
|
|||||||
+13
-4
@@ -202,6 +202,12 @@
|
|||||||
|
|
||||||
// ---- Actions ----
|
// ---- 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() {
|
async function toggleFrame() {
|
||||||
useFrame = !useFrame
|
useFrame = !useFrame
|
||||||
try {
|
try {
|
||||||
@@ -418,6 +424,7 @@
|
|||||||
const f = format
|
const f = format
|
||||||
if (phase !== "editing" || pathOverridden || !f) return
|
if (phase !== "editing" || pathOverridden || !f) return
|
||||||
void api.defaultOutputPath(f).then(p => { if (!pathOverridden) outputPath = p })
|
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
|
// Auto-dismiss error toast
|
||||||
@@ -528,15 +535,15 @@
|
|||||||
{#each PRESETS as [w, h, label]}
|
{#each PRESETS as [w, h, label]}
|
||||||
<button class="chip" onclick={() => {
|
<button class="chip" onclick={() => {
|
||||||
aspectLock = w / h
|
aspectLock = w / h
|
||||||
api.setOverlayAspect(aspectLock)
|
toastOnFail(api.setOverlayAspect(aspectLock))
|
||||||
emit("overlay-set-ratio", { ratio: aspectLock })
|
emit("overlay-set-ratio", { ratio: aspectLock })
|
||||||
api.setOverlaySize(w, h)
|
toastOnFail(api.setOverlaySize(w, h))
|
||||||
}}>{label}</button>
|
}}>{label}</button>
|
||||||
{/each}
|
{/each}
|
||||||
{#if aspectLock !== null}
|
{#if aspectLock !== null}
|
||||||
<button class="chip unlock" onclick={() => {
|
<button class="chip unlock" onclick={() => {
|
||||||
aspectLock = null
|
aspectLock = null
|
||||||
api.setOverlayAspect(null)
|
toastOnFail(api.setOverlayAspect(null))
|
||||||
emit("overlay-set-ratio", { ratio: null })
|
emit("overlay-set-ratio", { ratio: null })
|
||||||
}}>Unlock</button>
|
}}>Unlock</button>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -712,7 +719,9 @@
|
|||||||
<p class="done-path mono">{exportResult.output_path}</p>
|
<p class="done-path mono">{exportResult.output_path}</p>
|
||||||
<div class="done-actions">
|
<div class="done-actions">
|
||||||
<button class="btn-primary" onclick={startOver}>Record another</button>
|
<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
|
Show in explorer
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
void (async () => {
|
void (async () => {
|
||||||
await refresh()
|
await refresh()
|
||||||
win.onMoved(refresh).then(fn => { if (mounted) unlisten.push(fn) })
|
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
|
let hoverDebounce = 0
|
||||||
listen<Rect>("picker-hover", (e) => {
|
listen<Rect>("picker-hover", (e) => {
|
||||||
clearTimeout(hoverDebounce)
|
clearTimeout(hoverDebounce)
|
||||||
|
|||||||
@@ -62,6 +62,10 @@
|
|||||||
try { diagnostics = await api.diagnosticsInfo() } catch { diagnostics = null }
|
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() {
|
async function save() {
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
|
|
||||||
@@ -94,8 +98,12 @@
|
|||||||
|
|
||||||
async function pickOutputDir() {
|
async function pickOutputDir() {
|
||||||
if (!cfg) return
|
if (!cfg) return
|
||||||
|
try {
|
||||||
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
const picked = await open({ directory: true, defaultPath: cfg.output_dir ?? undefined })
|
||||||
if (typeof picked === "string") cfg.output_dir = picked
|
if (typeof picked === "string") cfg.output_dir = picked
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("directory picker failed:", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -288,7 +296,7 @@
|
|||||||
<div class="diag-row">
|
<div class="diag-row">
|
||||||
<span class="field-label">Log folder</span>
|
<span class="field-label">Log folder</span>
|
||||||
<span class="diag-val mono">{diagnostics ? diagnostics.log_dir : "..."}</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>
|
||||||
<div class="diag-tail-wrap">
|
<div class="diag-tail-wrap">
|
||||||
<div class="diag-tail-head">
|
<div class="diag-tail-head">
|
||||||
|
|||||||
@@ -20,7 +20,10 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
function dismiss() { info = null; errMsg = null; phase = "info" }
|
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() {
|
async function download() {
|
||||||
if (!info?.download_url) { errMsg = "no downloadable exe in this release"; phase = "error"; return }
|
if (!info?.download_url) { errMsg = "no downloadable exe in this release"; phase = "error"; return }
|
||||||
|
|||||||
Reference in New Issue
Block a user