feat: port the client to MyGo native UI (0.3.0)
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.
This commit is contained in:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
@@ -0,0 +1,59 @@
|
||||
//go:build !ios
|
||||
|
||||
package interp_test
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/egoist/mygo/internal/gpu/gputest"
|
||||
"github.com/egoist/mygo/internal/gpu/metal"
|
||||
"github.com/egoist/mygo/internal/scene"
|
||||
"github.com/egoist/mygo/internal/shaderir"
|
||||
"github.com/egoist/mygo/internal/shaderir/interp"
|
||||
"github.com/egoist/mygo/internal/shaderir/msl"
|
||||
)
|
||||
|
||||
// TestMetal draws a shader with the Metal renderer, its Metal function
|
||||
// wrapped in an effect, and checks that the interpreter computes the same
|
||||
// pixels.
|
||||
func TestMetal(t *testing.T) {
|
||||
p, prog := compile(t, noiseSource)
|
||||
words := noiseUniforms(p)
|
||||
fx := &scene.Effect{
|
||||
Name: "shader",
|
||||
Metal: scene.EffectCode{Source: metalEffect(p, words)},
|
||||
Pixels: func() scene.EffectPixels { return &shaderPixels{prog: prog, in: &interp.Inputs{Uniforms: words}} },
|
||||
}
|
||||
s := effectScene(fx)
|
||||
pix, err := metal.RenderOffscreen(s)
|
||||
if err != nil {
|
||||
t.Skip("no Metal:", err)
|
||||
}
|
||||
gputest.Compare(t, "shader-metal", pix, s.Width*4, s)
|
||||
}
|
||||
|
||||
// metalEffect returns an effect's Metal source calling p's fragment
|
||||
// function, with the uniform values words laid out as Metal lays out its
|
||||
// struct of uniforms, in the source.
|
||||
func metalEffect(p *shaderir.Program, words []uint32) string {
|
||||
at, size := msl.UniformLanes(p)
|
||||
buf := make([]byte, (size+15)/16*16)
|
||||
for k, w := range words {
|
||||
binary.LittleEndian.PutUint32(buf[at[k]:], w)
|
||||
}
|
||||
var lanes []string
|
||||
for i := 0; i < len(buf); i += 4 {
|
||||
lanes = append(lanes, fmt.Sprintf("%du", binary.LittleEndian.Uint32(buf[i:])))
|
||||
}
|
||||
return msl.Fragment(p, "shaderFragment", "") + fmt.Sprintf(`
|
||||
constant uint shaderUniforms[%d] = {%s};
|
||||
|
||||
float4 effect(float2 p, Effect e, texture2d<float> backdrop) {
|
||||
constant Uniforms& u = *(constant Uniforms*)shaderUniforms;
|
||||
return shaderFragment(u, backdrop, backdrop, backdrop, backdrop, float4(p, 0.0f, 1.0f), p - e.rect.xy);
|
||||
}
|
||||
`, len(lanes), strings.Join(lanes, ", "))
|
||||
}
|
||||
Reference in new issue
Block a user