render3d: a renderer that cannot draw says so and stops - LUDIC_HOME's leading ~ expanded (an unexpanded one left a run without shaders, logging 27 missing variants and drawing on), the SPIR-V manifest ends with E <count> and a cut or miscounted one is refused, and every such failure is a fault: r3d_open / r3d_load_step fail on it, r3d_fault() / r3d_fault_exit(code) for the game; tests/manifest_test
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
aac58ec6fa
commit
c3fc896dea
13 changed files with 227 additions and 54 deletions
|
|
@ -14,28 +14,6 @@
|
|||
|
||||
function r3d_set_paths(render3d_st: mut Render3dState, root: string, assets: string) -> void { render3d_st.r3d_root = root; render3d_st.r3d_assets = assets }
|
||||
|
||||
# The install root, as the compiler computes it: $LUDIC_HOME, else the directory of the
|
||||
# `ludic` on PATH. A game running from its own tree finds this package there.
|
||||
@alloc_ok("once a run: the install root, asked only when the shaders are not beside the program")
|
||||
function r3d_home() -> string {
|
||||
let env = Os.env("LUDIC_HOME")
|
||||
if env != null and env != "" { return env }
|
||||
return `{Os.env("HOME")}/.ludic`
|
||||
}
|
||||
|
||||
# Settle r3d_root on first use: the package as checked out beside the project, else the
|
||||
# copy that ships with the toolchain.
|
||||
@alloc_ok("start-up: the device, its tables, the programs, the passes and the world's first textures are made once, before play")
|
||||
function r3d_find_root(render3d_st: mut Render3dState) -> void {
|
||||
if render3d_st.r3d_root_found { return }
|
||||
render3d_st.r3d_root_found = true
|
||||
if Fs.exists(`{render3d_st.r3d_root}/shaders/lighting.glsl`) { return }
|
||||
let home = r3d_home()
|
||||
let alt = `{home}/packages/ludic.render3d`
|
||||
if Fs.exists(`{alt}/shaders/lighting.glsl`) { render3d_st.r3d_root = alt; return }
|
||||
print(`r3d: cannot find the renderer's shaders (looked in {render3d_st.r3d_root}/shaders and {alt}/shaders)`)
|
||||
}
|
||||
|
||||
# Build a program from a vertex + fragment file pair (defines apply to both).
|
||||
# R3D_PROGRAMS_LOG=<file>: append every program built (vertex, fragment, defines) - the list a
|
||||
# backend that cannot compile shaders at run time (Vulkan: SPIR-V is built ahead) must cover
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue