Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
39 lines
1.6 KiB
Go
39 lines
1.6 KiB
Go
package shader
|
|
|
|
import (
|
|
"github.com/egoist/mygo/internal/gpu/d3d11"
|
|
"github.com/egoist/mygo/internal/scene"
|
|
"github.com/egoist/mygo/internal/shader"
|
|
"github.com/egoist/mygo/internal/shaderir"
|
|
"github.com/egoist/mygo/internal/shaderir/hlsl"
|
|
)
|
|
|
|
// code gives fx p's code for the Direct3D renderer, as an effect's, with
|
|
// the uniforms in the cbuffer of register b2 and the images in registers
|
|
// t6 to t9, after the renderer's own, and returns where the uniforms'
|
|
// lanes lie in the cbuffer and its size. It starts compiling the code,
|
|
// which takes Direct3D's compiler from a tenth of a second to more than
|
|
// one, on a goroutine of its own, which the renderers of all windows then
|
|
// share, with a cache on disk for the next launches. What the shader
|
|
// reads of a quad of those one draw draws (DrawInstances) comes from the
|
|
// instance drawing it, in the slots of an effect's parameters
|
|
// (gpu.Builder).
|
|
func code(p *shaderir.Program, fx *scene.Effect) ([]int, int) {
|
|
fx.HLSL.Source = hlsl.Fragment(p, "shaderFragment", 2, 6, shader.InstanceUniform) + `
|
|
float4 effect(float2 p, Effect e) {
|
|
// p4.z is 1 for a mask glyph, its positions from the box's corner in
|
|
// p4.xy, and 2 for a quad of those one draw draws.
|
|
bool many = e.p4.z > 1.5;
|
|
float4 none = float4(0, 0, 0, 0);
|
|
shaderInstance[0] = many ? e.p0 : none;
|
|
shaderInstance[1] = many ? e.p1 : none;
|
|
shaderInstance[2] = many ? e.p2 : none;
|
|
shaderInstance[3] = many ? e.p3 : none;
|
|
shaderInstance[4] = many ? float4(e.p4.w, e.p4.xy, 1) : none;
|
|
return shaderFragment(float4(p, 0, 1), (p - (e.p4.z > 0.5 && !many ? e.p4.xy : e.rect.xy)) / U2);
|
|
}
|
|
`
|
|
d3d11.PrecompileEffect(fx.HLSL.Source)
|
|
return hlsl.UniformLanes(p)
|
|
}
|