Installing it on Debian was enough, with the only wrinkle that
propagating -race won't work when we're cross-compiling, since
cross-compilation disables CGo by default.
For now, just skip the test in that edge case. If we want to use the
race detector on Windows in the future, we need to get a Windows CI
builder somehow.
Tested on my fork; see https://builds.sr.ht/~mvdan/job/164899.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Since Wine is heavily tied to X11, we build its end-to-end test driver
on top of X11's. We use the same mechanism to start an X server, take
screenshots, and issue clicks.
Its only quirk is that it was difficult to get the screenshots to line
up with Gio's window. The comments cover what we ended up with. The
display dimensions are now part of driverBase, so that methods other
than Start can also use them - this is necessary for the wine driver to
crop screenshots.
We also use a sleep for now; a comment explains why, and a TODO is left
for future Dan to deal with. What we have now works, and I've spent
enough hours on this patch as it is.
Adding Wine to CI, and ensuring that the test passes there, is left for
a follow-up patch.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
We were using 'go run . <args>' before, which works fine, but does mean
re-linking a new binary and throwing it away at each invocation. Given
that the end-to-end tests don't do all that much work besides building
the tiny red.go app, this amount of extra work was noticeable.
We can obtain statistics for the JS sub-test, which used 'go run', via
the perflock and benchcmd tools:
$ go test -c
$ perflock -governorp% benchcmd EndToEnd/JS ./gogio.test -test.run=EndToEnd/JS
After capturing those numbers before and after the change, we can then
compare them with benchstat. The CPU cost of the subtest is halved:
name old time/op new time/op delta
EndToEnd/JS 1.42s ± 2% 1.07s ± 3% -25.04% (p=0.008 n=5+5)
name old user-time/op new user-time/op delta
EndToEnd/JS 1.46s ± 3% 0.75s ± 5% -48.34% (p=0.008 n=5+5)
name old sys-time/op new sys-time/op delta
EndToEnd/JS 366ms ±13% 224ms ± 7% -38.79% (p=0.008 n=5+5)
An alternative here would have been to refactor main.go to allow being
called directly. However, that would have required a non-trivial
refactor, since flag parsing is done via globals. Given that the
TestMain method is asy and keeps the main function simple, we've
decided to avoid a refactor.
While at it, remove the sleep in the Android driver to wait for the app
to come up on screen. Since we retry screenshots now, we no longer need
a static sleep. On average, we still need one retry for the initial
screenshot, but that's just 100ms versus the old 500ms. The maximum wait
time is also 2s here, which should scale better for slower devices.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
First, move from debian unstable to testing, since sway was promoted to
testing as of earlier this week.
Second, use the --sync option when using xdotool to move an X11 mouse.
This makes the command block until the mouse has finished moving to the
specified location, removing a potential race with the following
'xdotool click' command.
Third, deduplicate some logic into driverBase: tempDir to create a
temporary directory within a test, and needPrograms to skip a test if
the required programs aren't available.
Lastly, split the code that starts the X11 server into a method, so that
the future Wine e2e driver can reuse it. Since Wine is tightly coupled
with X11, we can reuse a good part of the code, including the X11 server
and the xdotool mechanisms.
We also add a TODO to perhaps improve the handling of the app's output
under each of the e2e test cases.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
We're forced by compatibility to encode an integer state into a
floating point. Make the implicit conversion from floating point to
integer more robust against GPUs with low precision floats.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Direct3D 11 supports Direct3D 9.1 level hardware, but only if the shaders are
compiled for target 4_0_level_9_1.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
D3DCompile successfully compiles shaders fxc.exe doesn't. As a bonus
the DirectX SDK is no longer required (it includes fxc.exe).
Signed-off-by: Elias Naur <mail@eliasnaur.com>
In particular, the simplifying "-s" flag to gofmt ensures that the automatic
test for unformatted Go source files won't complain.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
OpenGL use the [-1; 1] range for clip depths, Direct3D [0; 1].
Use toClipSpace to encapsulate the difference.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Add fboTextureTransform shader function for cancelling the
implied transformation from fragments output by the fragment
shader and the (u, v) coordinates used to sample from it in a
later pass.
For OpenGL the transformation is the identity.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Some GPU APIs such as Direct3D can return an error after drawing
a frame indicating a transient device error. Recreate device and
retry if it happens.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
OpenGL supports casting from int to float during vertex array
reading. Direct3D doesn't. Since we're transpiling from GLSL, we can't
directly use the Direct3D builtin "asint". So that leaves using
"ivec2" instead of vec2.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Add a series of low level gpu.Backend tests to assure the correct behaviour of
Backends. The immediate use is debugging of the Direct3D port, in the future
for developing new backends.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Uniform buffers are byte slice backed by Go structs. However, if a uniform
buffer value is embedded in a larger structure with pointers, the Cgo
pointer checker will complain. Avoid the error by moving the uniform
values into separate structures.
Signed-off-by: Elias Naur <mail@eliasnaur.com>