Skip to content

armgit / BUI

Public Imported from GitHub
0

Blender's GPU Accelerated UI, Decoupled from it's original codebase. Supports Rust, Python, JS, React, C & C++. Twice as good as GPUI

runtime variants

Preetham Pemmasani7f4595468477
diff --git a/bindings/node/.gitignore b/bindings/node/.gitignore
index 6fe5c3a..04db832 100644
--- a/bindings/node/.gitignore
+++ b/bindings/node/.gitignore
@@ -2,3 +2,5 @@
node_modules/
LICENSE
bui-runtime.*
+bui-runtime-*
+features.json
diff --git a/bindings/node/bench/size/hello.jsx b/bindings/node/bench/size/hello.jsx
new file mode 100644
index 0000000..2b17733
--- /dev/null
+++ b/bindings/node/bench/size/hello.jsx
@@ -0,0 +1,4 @@
+/** @jsxImportSource @blender-ui/react */
+// bui build size: no images, no video (the base runtime)
+import { render } from '@blender-ui/react'
+render(<main><h1>Hello</h1><button>OK</button></main>, { width: 320, height: 200 })
diff --git a/bindings/node/bench/size/images.jsx b/bindings/node/bench/size/images.jsx
new file mode 100644
index 0000000..1046725
--- /dev/null
+++ b/bindings/node/bench/size/images.jsx
@@ -0,0 +1,4 @@
+/** @jsxImportSource @blender-ui/react */
+// bui build size: images (the media runtime)
+import { render } from '@blender-ui/react'
+render(<main><img src="logo.png" /><img src="photo.jpg" /><img src="anim.webp" /></main>, { width: 320, height: 200 })
diff --git a/bindings/node/bench/size/video.jsx b/bindings/node/bench/size/video.jsx
new file mode 100644
index 0000000..d0c6b01
--- /dev/null
+++ b/bindings/node/bench/size/video.jsx
@@ -0,0 +1,4 @@
+/** @jsxImportSource @blender-ui/react */
+// bui build size: a video (the media runtime)
+import { render } from '@blender-ui/react'
+render(<main><video src="intro.mp4" loop style={{ width: 640, height: 360 }} /></main>, { width: 640, height: 360 })
diff --git a/bindings/node/cli.js b/bindings/node/cli.js
index ed0b0b3..5687962 100644
--- a/bindings/node/cli.js
+++ b/bindings/node/cli.js
@@ -10,6 +10,9 @@
// --bun compile with `bun build --compile` instead of QuickJS
// --console keep a console window (Windows; default: none, for apps)
// --dev React's development build (default: production)
+// --features a,b the kit features the app uses (default: package.json
+// "bui": {"features": [...]}, else detected in the bundle);
+// the smallest runtime with them is linked (features.js)
//
// Bundling uses Bun (https://bun.sh), which must be installed.
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -18,6 +21,7 @@ const fs = require('node:fs')
const os = require('node:os')
const path = require('node:path')
const { spawnSync } = require('node:child_process')
+const features = require('./features.js')
const MAGIC = Buffer.from('BUIAPP01')
const TAG = `${process.platform}-${process.arch}`
@@ -29,7 +33,7 @@ function fail (msg) {
}
function parse (argv) {
- const o = { cmd: argv[0], entry: null, out: null, bun: false, console: false, dev: false, rest: [] }
+ const o = { cmd: argv[0], entry: null, out: null, bun: false, console: false, dev: false, features: null, rest: [] }
for (let i = 1; i < argv.length; i++) {
const a = argv[i]
if (o.cmd === 'run' && o.entry !== null) o.rest.push(a)
@@ -37,23 +41,40 @@ function parse (argv) {
else if (a === '--bun') o.bun = true
else if (a === '--console') o.console = true
else if (a === '--dev') o.dev = true
+ else if (a === '--features') o.features = argv[++i].split(',').map((s) => s.trim()).filter(Boolean)
else if (a.startsWith('-')) fail(`unknown option ${a}`)
else o.entry = a
}
return o
}
-/** The QuickJS runtime shipped in this package (or the workspace build). */
-function runtimePath () {
- const shipped = path.join(__dirname, `bui-runtime.${TAG}${EXE}`)
+/** The QuickJS runtime `name` (features.json runtimes; "full" is bui-runtime
+ * itself) shipped in this package, or the workspace build's full one. */
+function runtimePath (name = 'full') {
+ const file = name === 'full' ? `bui-runtime.${TAG}${EXE}` : `bui-runtime-${name}.${TAG}${EXE}`
+ const shipped = path.join(__dirname, file)
if (fs.existsSync(shipped)) return shipped
for (const profile of ['dist', 'release']) { // npm run build, or a plain cargo build
const built = path.join(__dirname, '../rust/target', profile, `bui-runtime${EXE}`)
- if (fs.existsSync(built)) return built
+ if (name === 'full' && fs.existsSync(built)) return built
}
+ if (name !== 'full') return runtimePath('full') // a smaller one wasn't built: the full one works
fail(`no bui-runtime for ${TAG}: prebuilt for Windows x64; run \`npm run build\` in bindings/node to build it`)
}
+/** The runtime an app needs: explicit features, else detected ones. */
+function chooseRuntime (o, js) {
+ try {
+ const explicit = o.features ?? features.configured(o.entry)
+ const needed = explicit ? new Set(explicit) : new Set(features.detect(js.toString('latin1')).keys())
+ const rt = features.pickRuntime(needed)
+ console.log(`bui: runtime "${rt.name}" for ${needed.size ? [...needed].join(', ') : 'no optional features'}${explicit ? '' : ' (detected)'}`)
+ return rt.name
+ } catch (e) {
+ fail(e.message)
+ }
+}
+
/** Bun's executable: this process when running on Bun; otherwise asked once
* (npm installs it behind a shell shim on Windows), then run without a shell
* so arguments keep their quotes. */
@@ -109,7 +130,7 @@ function build (o) {
bun(args)
} else {
const js = bundle(o.entry, o.dev)
- const runtime = fs.readFileSync(runtimePath())
+ const runtime = fs.readFileSync(runtimePath(chooseRuntime(o, js)))
if (process.platform === 'win32' && !o.console) setGuiSubsystem(runtime)
const trailer = Buffer.alloc(16)
MAGIC.copy(trailer, 0)
@@ -132,7 +153,7 @@ function run (o) {
const o = parse(process.argv.slice(2))
if (!['build', 'run'].includes(o.cmd) || !o.entry) {
- console.log(fs.readFileSync(__filename, 'utf8').split('\n').slice(1, 14).map((l) => l.replace(/^\/\/ ?/, '')).join('\n'))
+ console.log(fs.readFileSync(__filename, 'utf8').split('\n').slice(1, 17).map((l) => l.replace(/^\/\/ ?/, '')).join('\n'))
process.exit(o.cmd ? 1 : 0)
}
if (!fs.existsSync(o.entry)) fail(`no such file: ${o.entry}`)
diff --git a/bindings/node/features.js b/bindings/node/features.js
new file mode 100644
index 0000000..a4c36bc
--- /dev/null
+++ b/bindings/node/features.js
@@ -0,0 +1,79 @@
+// What an app needs from the kit, for `bui build`: the feature table
+// (features.json at the repository root, copied next to this file when the
+// package is packed) and the prebuilt runtimes it lists (base, media, full).
+//
+// An app pays only for what it uses: `bui build` links the smallest runtime
+// that has every feature the app needs. Explicit beats detected:
+// 1. `--features png,video` on the command line, or
+// 2. `"bui": { "features": ["png", "video"] }` in the app's package.json, else
+// 3. detection in the bundle: <video> elements, media file extensions in
+// string literals ("intro.mp4", 'logo.webp') and file dialogs. Paths built
+// at run time ("img." + ext) can't be seen, and the GPU renderer is
+// never detected (every bundle's library code names its option): list
+// those features explicitly.
+// SPDX-License-Identifier: GPL-2.0-or-later
+'use strict'
+const fs = require('node:fs')
+const path = require('node:path')
+
+/** The table: next to this file in the package, else the repository's. */
+function table () {
+ for (const p of [path.join(__dirname, 'features.json'), path.join(__dirname, '../../features.json')]) {
+ if (fs.existsSync(p)) return JSON.parse(fs.readFileSync(p, 'utf8'))
+ }
+ throw new Error('features.json not found')
+}
+
+const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+
+/** Features the bundled `js` uses, with the reason for each. */
+function detect (js, t = table()) {
+ const found = new Map()
+ for (const f of t.features) {
+ if (f.always) found.set(f.name, 'always')
+ for (const ext of f.ext || []) {
+ // a string literal ending in the extension (optionally ?query / #hash)
+ const re = new RegExp(`\\.${escape(ext)}(?:[?#][^"'\`]*)?["'\`)]`, 'i')
+ if (re.test(js)) { found.set(f.name, `.${ext} file`); break }
+ }
+ for (const tag of f.tags || []) {
+ if (new RegExp(`["'\`]${escape(tag)}["'\`]`).test(js)) found.set(f.name, `<${tag}>`)
+ }
+ for (const m of f.markers || []) {
+ if (new RegExp(`\\b${escape(m)}\\b\\s*[:(=]`).test(js)) found.set(f.name, `${m}`)
+ }
+ }
+ // what a feature needs comes with it
+ for (const f of t.features) {
+ if (found.has(f.name)) for (const r of f.requires || []) if (!found.has(r)) found.set(r, `needed by ${f.name}`)
+ }
+ return found
+}
+
+/** The package.json `bui.features` of the app at `entry` (nearest one up), or null. */
+function configured (entry) {
+ for (let dir = path.dirname(path.resolve(entry)); ; dir = path.dirname(dir)) {
+ const p = path.join(dir, 'package.json')
+ if (fs.existsSync(p)) {
+ const feats = JSON.parse(fs.readFileSync(p, 'utf8')).bui?.features
+ return Array.isArray(feats) ? feats : null
+ }
+ if (path.dirname(dir) === dir) return null
+ }
+}
+
+/** The smallest runtime with every needed feature (runtimes are listed smallest first). */
+function pickRuntime (needed, t = table()) {
+ const known = new Set(t.features.map((f) => f.name))
+ needed = new Set(needed instanceof Map ? needed.keys() : needed)
+ for (const n of needed) if (!known.has(n)) throw new Error(`unknown feature "${n}" (features.json: ${[...known].join(', ')})`)
+ const rt = t.runtimes.find((r) => [...needed].every((n) => r.features.includes(n)))
+ if (!rt) {
+ const full = t.runtimes[t.runtimes.length - 1]
+ const missing = [...needed].filter((n) => !full.features.includes(n))
+ throw new Error(`no prebuilt runtime has ${missing.join(', ')}: build one with cargo (see docs: binary size)`)
+ }
+ return rt
+}
+
+module.exports = { table, detect, configured, pickRuntime }
diff --git a/bindings/node/package.json b/bindings/node/package.json
index 594f60f..4fc6640 100644
--- a/bindings/node/package.json
+++ b/bindings/node/package.json
@@ -20,6 +20,8 @@
"signals.js",
"index.d.ts",
"cli.js",
+ "features.js",
+ "features.json",
"blenderui.*.node",
"bui-runtime.*",
"README.md",
@@ -29,8 +31,8 @@
"build": "node scripts/build.js",
"test": "node --test",
"prepublishOnly": "node scripts/build.js && node --test",
- "prepack": "node -e \"require('fs').copyFileSync('../../LICENSE', 'LICENSE')\"",
- "postpack": "node -e \"require('fs').rmSync('LICENSE', { force: true })\""
+ "prepack": "node -e \"const fs=require('fs');fs.copyFileSync('../../LICENSE','LICENSE');fs.copyFileSync('../../features.json','features.json')\"",
+ "postpack": "node -e \"const fs=require('fs');fs.rmSync('LICENSE',{force:true});fs.rmSync('features.json',{force:true})\""
},
"engines": {
"node": ">=18"
diff --git a/bindings/node/scripts/build.js b/bindings/node/scripts/build.js
index 46c9623..fc2b51a 100644
--- a/bindings/node/scripts/build.js
+++ b/bindings/node/scripts/build.js
@@ -1,24 +1,45 @@
// Builds the native addon (bindings/rust/blenderui-node) and the QuickJS
-// runtime (bindings/rust/blenderui-qjs, `bui-runtime`) and copies them here
-// as blenderui.<platform>-<arch>.node and bui-runtime.<platform>-<arch>[.exe].
-// `--debug` for a debug build.
+// runtimes (bindings/rust/blenderui-qjs, `bui-runtime`) and copies them here
+// as blenderui.<platform>-<arch>.node, bui-runtime.<platform>-<arch>[.exe]
+// (the full runtime) and bui-runtime-<name>.<platform>-<arch>[.exe] for each
+// smaller runtime features.json lists (`bui build` links the smallest one an
+// app needs). `--debug` for a debug build; `--only full` for one runtime.
'use strict'
const { execFileSync } = require('node:child_process')
const fs = require('node:fs')
const path = require('node:path')
+const { table } = require('../features.js')
const debug = process.argv.includes('--debug')
+const only = process.argv.includes('--only') ? process.argv[process.argv.indexOf('--only') + 1] : null
const rust = path.resolve(__dirname, '../../rust')
// shipped binaries: the `dist` profile (release + fat LTO, one codegen unit:
// smaller and faster; see bindings/rust/Cargo.toml)
-const args = ['build', '-p', 'blenderui-node', '-p', 'blenderui-qjs', ...(debug ? [] : ['--profile', 'dist'])]
-execFileSync('cargo', args, { cwd: rust, stdio: 'inherit' })
+const profile = debug ? [] : ['--profile', 'dist']
const target = path.join(rust, 'target', debug ? 'debug' : 'dist')
const tag = `${process.platform}-${process.arch}`
const exe = process.platform === 'win32' ? '.exe' : ''
-const lib = { win32: 'blenderui_node.dll', darwin: 'libblenderui_node.dylib' }[process.platform] ?? 'libblenderui_node.so'
-for (const [from, to] of [[lib, `blenderui.${tag}.node`], [`bui-runtime${exe}`, `bui-runtime.${tag}${exe}`]]) {
+
+function cargo (args) {
+ execFileSync('cargo', ['build', ...args, ...profile], { cwd: rust, stdio: 'inherit' })
+}
+
+function copy (from, to) {
const dest = path.join(__dirname, '..', to)
fs.copyFileSync(path.join(target, from), dest)
- console.log(`wrote ${path.relative(process.cwd(), dest)}`)
+ console.log(`wrote ${path.relative(process.cwd(), dest)} (${(fs.statSync(dest).size / 1048576).toFixed(2)} MB)`)
+}
+
+if (!only) {
+ // the addon alone: built with the runtimes, cargo would unify their features
+ cargo(['-p', 'blenderui-node'])
+ const lib = { win32: 'blenderui_node.dll', darwin: 'libblenderui_node.dylib' }[process.platform] ?? 'libblenderui_node.so'
+ copy(lib, `blenderui.${tag}.node`)
+}
+for (const rt of table().runtimes) {
+ if (only && rt.name !== only) continue
+ // the kit features of this runtime only (blenderui forwards them to the C kit)
+ const feats = ['blenderui/slug', ...rt.features.map((f) => `blenderui/${f}`)]
+ cargo(['-p', 'blenderui-qjs', '--no-default-features', '--features', feats.join(',')])
+ copy(`bui-runtime${exe}`, rt.name === 'full' ? `bui-runtime.${tag}${exe}` : `bui-runtime-${rt.name}.${tag}${exe}`)
}
diff --git a/bindings/node/test/features.test.js b/bindings/node/test/features.test.js
new file mode 100644
index 0000000..7c69467
--- /dev/null
+++ b/bindings/node/test/features.test.js
@@ -0,0 +1,30 @@
+'use strict'
+// `bui build`'s feature detection and runtime choice (features.js, features.json).
+const test = require('node:test')
+const assert = require('node:assert')
+const { detect, pickRuntime } = require('../features.js')
+
+const names = (js) => [...detect(js).keys()].filter((n) => n !== 'freetype').sort()
+
+test('a bundle without media needs no optional feature: the base runtime', () => {
+ const js = 'jsx("div",{className:"p-4",children:jsx("button",{onClick:f,children:"Hi"})})'
+ assert.deepStrictEqual(names(js), [])
+ assert.strictEqual(pickRuntime(detect(js)).name, 'base')
+})
+
+test('media files in string literals and <video> are detected', () => {
+ const js = 'jsx("img",{src:"logo.webp"});jsx("img",{src:`photos/a.JPG`});x("bg.png?v=2")' +
+ ';jsx("video",{src:p})'
+ assert.deepStrictEqual(names(js), ['jpeg', 'png', 'video', 'webp'])
+ assert.strictEqual(pickRuntime(detect(js)).name, 'media')
+})
+
+test('the GPU and the file browser need the full runtime', () => {
+ assert.strictEqual(pickRuntime(new Set(['gpu'])).name, 'full') // explicit: a gpu option is in every bundle's library code
+ assert.strictEqual(pickRuntime(new Set(['filebrowser'])).name, 'full')
+})
+
+test('explicit features are checked against the table', () => {
+ assert.throws(() => pickRuntime(new Set(['avif'])), /unknown feature "avif"/)
+ assert.strictEqual(pickRuntime(new Set(['png', 'video'])).name, 'media')
+})
diff --git a/bindings/node/test/runtime.test.js b/bindings/node/test/runtime.test.js
index c501fda..985fc7a 100644
--- a/bindings/node/test/runtime.test.js
+++ b/bindings/node/test/runtime.test.js
@@ -26,10 +26,13 @@ function check (stdout, runtime) {
return r
}
-/** The runtime `bui build` copies (as cli.js finds it). */
-function runtimeFile () {
+/** The runtime `bui build` copies (as cli.js finds it): `name` from features.json. */
+function runtimeFile (name = 'full') {
const exe = process.platform === 'win32' ? '.exe' : ''
- const shipped = path.join(__dirname, '..', `bui-runtime.${process.platform}-${process.arch}${exe}`)
+ const tag = `${process.platform}-${process.arch}`
+ const small = path.join(__dirname, '..', `bui-runtime-${name}.${tag}${exe}`)
+ if (name !== 'full' && fs.existsSync(small)) return small
+ const shipped = path.join(__dirname, '..', `bui-runtime.${tag}${exe}`)
if (fs.existsSync(shipped)) return shipped
for (const profile of ['dist', 'release']) {
const built = path.join(__dirname, '../../rust/target', profile, `bui-runtime${exe}`)
@@ -59,10 +62,13 @@ test('bui build: a QuickJS executable of a few MB runs the React app', { skip: !
const trailer = exe.subarray(exe.length - 16)
assert.strictEqual(trailer.subarray(0, 8).toString(), 'BUIAPP01')
const bundle = Number(trailer.readBigUInt64LE(8))
- const runtime = fs.statSync(runtimeFile()).size
+ // an app without images or video gets the smallest runtime (features.json)
+ const chosen = /runtime "(\w+)"/.exec(b.stdout)[1]
+ assert.strictEqual(chosen, 'base', b.stdout)
+ const runtime = fs.statSync(runtimeFile(chosen)).size
assert.strictEqual(exe.length, runtime + bundle + 16)
const budget = RUNTIME_BUDGET[`${process.platform}-${process.arch}`]
- if (budget && runtimeFile().endsWith(`bui-runtime.${process.platform}-${process.arch}.exe`)) {
+ if (budget && runtimeFile(chosen).includes(`.${process.platform}-${process.arch}.exe`)) {
assert.ok(runtime <= budget, `runtime ${runtime} bytes, budget ${budget}`)
}
check(exec(out), 'quickjs')
diff --git a/bindings/rust/blenderui-jsview/Cargo.toml b/bindings/rust/blenderui-jsview/Cargo.toml
index d4f5fd7..d1db7c8 100644
--- a/bindings/rust/blenderui-jsview/Cargo.toml
+++ b/bindings/rust/blenderui-jsview/Cargo.toml
@@ -11,4 +11,5 @@ rust-version.workspace = true
publish = false
[dependencies]
-blenderui = { path = "../blenderui" }
+# the kit features are the app's choice (blenderui-node: all; bui-runtime: per runtime)
+blenderui = { path = "../blenderui", default-features = false }
diff --git a/bindings/rust/blenderui-qjs/Cargo.toml b/bindings/rust/blenderui-qjs/Cargo.toml
index 7d7c5c2..5e9d7fc 100644
--- a/bindings/rust/blenderui-qjs/Cargo.toml
+++ b/bindings/rust/blenderui-qjs/Cargo.toml
@@ -15,6 +15,11 @@ name = "bui-runtime"
path = "src/main.rs"
[dependencies]
-blenderui = { path = "../blenderui" }
+# the kit features: blenderui's defaults, or a runtime's list from features.json
+# (bindings/node/scripts/build.js: --no-default-features --features blenderui/...)
+blenderui = { path = "../blenderui", default-features = false }
blenderui-jsview = { path = "../blenderui-jsview" }
rquickjs = { version = "0.14", features = ["classes", "properties", "array-buffer"] }
+
+[features]
+default = ["blenderui/default"]
diff --git a/bindings/rust/blenderui-sys/Cargo.toml b/bindings/rust/blenderui-sys/Cargo.toml
index 1113633..e86f03e 100644
--- a/bindings/rust/blenderui-sys/Cargo.toml
+++ b/bindings/rust/blenderui-sys/Cargo.toml
@@ -38,8 +38,6 @@ hdr = [] # Radiance HDR images
pnm = [] # PNM (PGM, PPM) images
svg = [] # SVG images
video = [] # <video> through the OS decoders
-video-dav1d = ["video"] # AV1 video with dav1d
-video-ffmpeg = ["video"] # Every format FFmpeg reads (LGPL or GPL, by its build)
gpu = [] # GPU renderers: Direct3D 11 (Windows), OpenGL 3.3 (Linux)
freetype = [] # Text through the vendored FreeType like Blender's BLF
filebrowser = [] # Blender's File Browser
diff --git a/bindings/rust/blenderui/Cargo.toml b/bindings/rust/blenderui/Cargo.toml
index 514b82b..ed1ecec 100644
--- a/bindings/rust/blenderui/Cargo.toml
+++ b/bindings/rust/blenderui/Cargo.toml
@@ -46,8 +46,6 @@ hdr = ["blenderui-sys/hdr"]
pnm = ["blenderui-sys/pnm"]
svg = ["blenderui-sys/svg"]
video = ["blenderui-sys/video"]
-video-dav1d = ["blenderui-sys/video-dav1d"]
-video-ffmpeg = ["blenderui-sys/video-ffmpeg"]
gpu = ["blenderui-sys/gpu"]
freetype = ["blenderui-sys/freetype"]
filebrowser = ["blenderui-sys/filebrowser"]
diff --git a/bindings/rust/blenderui/src/layout.rs b/bindings/rust/blenderui/src/layout.rs
index 84c52d3..29a3bf9 100644
--- a/bindings/rust/blenderui/src/layout.rs
+++ b/bindings/rust/blenderui/src/layout.rs
@@ -804,11 +804,12 @@ impl<'a> Builder<'a> {
&self.styles[self.nodes[i].style]
}
- /// `<video src>`'s player: muted autoplay unless `autoplay="false"`;
+ /// `<video src>`'s player: muted autoplay unless `autoplay="false"` (React's
+ /// `autoPlay={false}`);
/// `loop`, `poster` (the HTML attributes).
fn video_src(&mut self, i: usize) -> Option<std::rc::Rc<crate::video::Video>> {
let attrs = crate::video::VideoAttrs {
- autoplay: self.attr(i, "autoplay") != Some("false"),
+ autoplay: self.attr(i, "autoplay").or_else(|| self.attr(i, "autoPlay")) != Some("false"), // React: autoPlay
looped: self.attr(i, "loop").is_some_and(|v| v != "false"),
poster: self.attr(i, "poster").map(str::to_owned),
};
diff --git a/features.cmake b/features.cmake
index 3015179..0eb4874 100644
--- a/features.cmake
+++ b/features.cmake
@@ -24,7 +24,7 @@ foreach(_i RANGE ${_bui_last})
set(_bui_option_of_${_name} ${_opt})
endforeach()
-# a part that needs another (video-dav1d needs video): checked here, at the boundary
+# a part that needs another ("requires"): checked here, at the boundary
foreach(_i RANGE ${_bui_last})
string(JSON _opt GET "${_bui_features_json}" features ${_i} option)
string(JSON _nreq ERROR_VARIABLE _noreq LENGTH "${_bui_features_json}" features ${_i} requires)
diff --git a/features.json b/features.json
index 373e2a6..9681acb 100644
--- a/features.json
+++ b/features.json
@@ -12,9 +12,7 @@
{"name": "pnm", "option": "BUI_IMAGE_PNM", "default": true, "group": "images", "ext": ["pnm", "ppm", "pgm"], "doc": "PNM (PGM, PPM) images"},
{"name": "svg", "option": "BUI_IMAGE_SVG", "default": true, "group": "images", "ext": ["svg"], "doc": "SVG images (nanosvg, which the icons use anyway: no extra code)"},
{"name": "video", "option": "BUI_VIDEO", "default": true, "group": "video", "ext": ["mp4", "m4v", "mov", "webm", "mkv", "avi", "wmv", "ogv"], "tags": ["video"], "doc": "<video> through the OS decoders (Media Foundation, AVFoundation, GStreamer), loaded at run time"},
- {"name": "video-dav1d", "option": "BUI_VIDEO_DAV1D", "default": false, "group": "video", "requires": ["video"], "doc": "AV1 video with dav1d (BSD-2) and a small MP4/WebM demuxer, where the OS has no AV1 decoder"},
- {"name": "video-ffmpeg", "option": "BUI_VIDEO_FFMPEG", "default": false, "group": "video", "requires": ["video"], "doc": "Every format FFmpeg reads (libavformat/libavcodec, LGPL or GPL by its build; patent-encumbered codecs)"},
- {"name": "gpu", "option": "BUI_GPU", "default": true, "group": "rendering", "markers": ["gpu"], "doc": "GPU renderers: Direct3D 11 (Windows), OpenGL 3.3 (Linux); without it, the software raster only"},
+ {"name": "gpu", "option": "BUI_GPU", "default": true, "group": "rendering", "doc": "GPU renderers: Direct3D 11 (Windows), OpenGL 3.3 (Linux); without it, the software raster only"},
{"name": "freetype", "option": "BUI_TEXT_FREETYPE", "default": true, "group": "rendering", "always": true, "doc": "Text through the vendored FreeType like Blender's BLF (else stb_truetype); every bui build runtime has it, so text looks the same"},
{"name": "filebrowser", "option": "BUI_FILEBROWSER", "default": true, "group": "ui", "tags": ["filebrowser"], "markers": ["fileDialog", "file_dialog", "filebrowser"], "doc": "Blender's File Browser (the filebrowser node and BK_file_dialog)"},
{"name": "imgui", "option": "BUI_BUILD_IMGUI", "default": true, "cargo_default": false, "group": "ui", "doc": "Dear ImGui on BUI (C++; the blenderui-imgui crate and Python's blenderui.imgui turn it on)"}
diff --git a/kit/include/BUI_kit.h b/kit/include/BUI_kit.h
index 9b3437b..d7a95a4 100644
--- a/kit/include/BUI_kit.h
+++ b/kit/include/BUI_kit.h
@@ -306,7 +306,7 @@ void BK_anim_free(BKAnim *anim);
/* -- video (kit/intern/image: one player for GIF, WebP and video) ---------------------
* A <video>: decoded by the OS (Media Foundation, AVFoundation, GStreamer) or
- * an optional built-in decoder (dav1d, FFmpeg), streamed from the file at
+ * streamed from the file at
* the size it is drawn, frames in one GPU texture updated in place (NV12:
* YCbCr converted in the shader; the CPU raster converts what it draws).
* It loads when first drawn and plays only while it shows: off screen,
@@ -342,8 +342,8 @@ int BK_video_texture(BKVideo *v, int tex, int max_w, int max_h);
/* Shown on a "video" node (fitted, with its controls) or an "image" node; the
* node borrows it (free the video after the node lets go: set NULL). */
void BK_node_set_video(BKNode *node, BKVideo *v, int fit);
-/* The backends this build reads video with ("mf", "avfoundation", "gstreamer",
- * "dav1d", "ffmpeg"), comma-separated; "" when built without video. */
+/* The backends this build reads video with ("mf", "avfoundation", "gstreamer"),
+ * comma-separated; "" when built without video. */
const char *BK_video_backends(void);
/* The shared cache and loader. Sources (file paths) decode on a few worker
diff --git a/kit/intern/image/anim.c b/kit/intern/image/anim.c
index c4fb1b2..0105308 100644
--- a/kit/intern/image/anim.c
+++ b/kit/intern/image/anim.c
@@ -3,7 +3,7 @@
* MovieReader shape, open / next / seek / close). In-memory codecs composite
* frames (GIF disposal and blending, WebP's canvas) into a full-size
* premultiplied canvas, fitted here with the plan of stills (imb_plan /
- * imb_finish); streamed codecs (movie.c: the OS decoders, dav1d, FFmpeg)
+ * imb_finish); streamed codecs (movie.c: the OS decoders)
* read the file as they go and decode NV12 at about the size drawn into a
* recycled frame (no allocation per frame).
*
diff --git a/kit/intern/image/image.h b/kit/intern/image/image.h
index 57502e4..1f98cda 100644
--- a/kit/intern/image/image.h
+++ b/kit/intern/image/image.h
@@ -175,8 +175,7 @@ typedef struct BKImAnimCodec {
} BKImAnimCodec;
extern const BKImAnimCodec imb_gif_codec, imb_webp_codec;
/* Video backends (movie_*.c), each compiled when the build has it. */
-extern const BKImAnimCodec imb_movie_mf, imb_movie_avf, imb_movie_gst, imb_movie_dav1d,
- imb_movie_ffmpeg;
+extern const BKImAnimCodec imb_movie_mf, imb_movie_avf, imb_movie_gst;
/* Those compiled in (movie.c: the build's choice), tried in order; NULL-ended. */
extern const BKImAnimCodec *const imb_movie_codecs[];
/* The first bytes look like a movie container (MP4/MOV, WebM/MKV, AVI, ASF,
diff --git a/kit/intern/image/movie.c b/kit/intern/image/movie.c
index 4054edc..05bb47e 100644
--- a/kit/intern/image/movie.c
+++ b/kit/intern/image/movie.c
@@ -5,8 +5,6 @@
* movie_mf.c Windows Media Foundation (the OS decoders, DXVA)
* movie_avf.m macOS AVFoundation / VideoToolbox
* movie_gst.c Linux GStreamer (VA-API through its plugins)
- * movie_dav1d.c AV1 with dav1d and a small MP4 / WebM demuxer (optional)
- * movie_ffmpeg.c FFmpeg (optional)
*
* Every backend loads its system libraries at run time (LoadLibrary /
* dlopen / weak frameworks): a machine without them starts normally and
@@ -34,9 +32,6 @@ bool imb_is_a_movie(const uint8_t *m, size_t n)
}
const BKImAnimCodec *const imb_movie_codecs[] = {
-#ifdef BUI_VIDEO_DAV1D
- &imb_movie_dav1d, /* AV1 in software, before the OS (which may lack AV1) */
-#endif
#ifdef BUI_VIDEO_MF
&imb_movie_mf,
#endif
@@ -45,9 +40,6 @@ const BKImAnimCodec *const imb_movie_codecs[] = {
#endif
#ifdef BUI_VIDEO_GST
&imb_movie_gst,
-#endif
-#ifdef BUI_VIDEO_FFMPEG
- &imb_movie_ffmpeg,
#endif
NULL,
};