Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-3d

Source of release 0.9.2

0.9.2 / tests / splat_pixels / main.lucb

## Offscreen checks of Gaussian splats (GaussianSplats): pixels against the
## formulas they come from, depth order and occlusion both ways, SH colors
## against luce-geocore's display_color, dots, one upload per cloud, the GPU
## radix sort against a CPU sort, interleaved clouds sorted together
## (SplatScene), selection tints, level of detail and antialiased captures. The run ends with GPU times per step at
## 1M, 3M and 6M synthetic splats in a 2800×1800 view (report only; set
## SPLAT_TIMINGS=0 to skip them), and with SPLAT_LARGE=<count> near and far
## frame times of that many splats with level of detail off and on.
from luce_gpu import gpu
import os
import strings
from luce_std import process
from luce_3d.graphics import release_splat_pipelines, release_line_pipelines
import pixels
import sorting
import timings
import scenes

pub func main(arguments: str[]) -> i32!:
    _ = arguments
    try os.set_env("MTL_DEBUG_LAYER", "1")
    var device = gpu.Device.open() catch failure:
        if failure.code == gpu.unavailable:
            print("skip: no GPU device")
            return 0
        error(failure.code, failure.message)
    defer device.destroy()
    defer release_splat_pipelines()
    defer release_line_pipelines()
    try sorting.checks(device)
    try pixels.falloff(device)
    try pixels.depth_order(device)
    try pixels.occlusion(device)
    try pixels.grid_lines(device)
    try pixels.harmonics(device)
    try pixels.dots(device)
    try pixels.uploads(device)
    try scenes.interleaved(device)
    try scenes.marks(device)
    try scenes.level_of_detail(device)
    try scenes.antialiased(device)
    print("PASS gaussian splats: analytic falloff, depth order both ways, occlusion both ways, grid lines under splats, display_color, dots, one upload, GPU sort, interleaved clouds, selection tint, level of detail, antialiased captures")
    let wanted = process.variable("SPLAT_TIMINGS") else "1"
    if wanted != "0":
        for count in [(usize)1000000, 3000000, 6000000]:
            try timings.report(device, count)
    if let large = process.variable("SPLAT_LARGE"):
        let count = strings.parse_u64(large) else error(gpu.invalid_geometry, "SPLAT_LARGE is a splat count")
        try timings.report_lod(device, (usize)count)
    return 0