Repository navigation
gui_toolkit 0.25.0
Added
- Application shaders (
render/app_shader.odin,app.wgsl,wgpu_app.odin,draw/app_shader.odin, docs/shaders.md):render.create_app_shader(r, {name, wgsl, dxbc, hash})registers a fragment function the application wrote in WGSL (fn app_shade(a: AppIn) -> vec4<f32>, linear light, straight alpha; it readsapp_param(k)andapp_tex0..3), anddraw.app_shader(dc, shader, rect, params, textures, blend, radii, tint)fills a rounded rectangle with it, in order with everything else, under the transform stack, clips, alpha stack, layers and planes (the vertex stage, corner shape and clip coverage are the renderer's). Up to 64 vec4 parameters and 4 textures per draw; blend modesNormal,Add,Screen,Multiply. Refuses (returns false, draws nothing) for shader 0, while a picture is recorded, and over the limits. Both backends: WebGPU compiles the modulerect.wgsl+app.wgsl+ the application's WGSL; Direct3D 11 embeds the pixel shader precompiled byodin run tools/shaders -- app <name> <file.wgsl> <dir>(naga + D3DCompile,<name>.dxbcand<name>.sha256; the hash of the module is checked when the shader is created, a stale blob is refused with a message). - Data textures:
render.create_texture_data(r, w, h, format = .RGBA8 | .R8, mips = true)andupdate_texture_datamake textures of raw 8-bit values (a normal map, a height map, a mask): no sRGB decoding, no premultiplication, in either blend space; mip chain byGenerateMips/mip.wgsl; recreated (empty) after a device loss like images. render.renderer_id(r): a number no other renderer of the process has had (a renderer destroyed and made again at the same address is another one), for caches of GPU objects keyed by renderer (withdevice_generation).tests/appshaders(both backends), added totools\test_backends.ps1and CI.
0.24.0 is reserved for another branch; 0.25.0 follows 0.23.0 on purpose.