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.
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package interp_test
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"github.com/egoist/mygo/internal/gpu/d3d11"
|
|
"github.com/egoist/mygo/internal/gpu/gputest"
|
|
"github.com/egoist/mygo/internal/scene"
|
|
"github.com/egoist/mygo/internal/shaderir/hlsl"
|
|
"github.com/egoist/mygo/internal/shaderir/interp"
|
|
)
|
|
|
|
// TestDirect3D draws a shader with Direct3D 11, its HLSL function wrapped
|
|
// in an effect, and checks that the interpreter computes the same pixels.
|
|
func TestDirect3D(t *testing.T) {
|
|
p, prog := compile(t, noiseSource)
|
|
words := noiseUniforms(p)
|
|
// The uniforms' constants in place of the cbuffer's members.
|
|
code := hlsl.Fragment(p, "shaderFragment", 2, 6, "")
|
|
code = regexp.MustCompile(`(?s)cbuffer Uniforms : register\(b\d+\) \{\n(.*?)\n\}`).ReplaceAllString(code, "$1")
|
|
code = constUniforms(code, regexp.MustCompile(`(?m)^\t((?:\w+) (U\d+)(?:\[\d+\])?) : packoffset\(\w+(?:\.\w)?\);$`), p, words, true)
|
|
src := code + `
|
|
float4 effect(float2 p, Effect e) {
|
|
return shaderFragment(float4(p, 0, 1), p - e.rect.xy);
|
|
}`
|
|
if _, err := d3d11.CompileEffect(src); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
fx := &scene.Effect{
|
|
Name: "shader",
|
|
HLSL: scene.EffectCode{Source: src},
|
|
Pixels: func() scene.EffectPixels { return &shaderPixels{prog: prog, in: &interp.Inputs{Uniforms: words}} },
|
|
}
|
|
s := effectScene(fx)
|
|
pix, stride, err := d3d11.RenderOffscreen(s)
|
|
if err != nil {
|
|
t.Skip("no Direct3D:", err)
|
|
}
|
|
gputest.Compare(t, "shader-d3d11", pix, stride, s)
|
|
}
|