We're about to cache the transformed materials. It's easier to do when
quads can be constructed before determining their atlas position.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The CPU fallback of the compute renderer needs ReadPixels data in OpenGL
format (origin at bottom left). Unfortunately, the OpenGL driver
automatically mirrors images in the Y-axis to match the top left origin
image.RGBA.
Remove the mirroring from the driver and introduce a DownloadImage to
restore the old behaviour.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Package wm (for "window manager") is a better fit for the package, and
distinguishes it from the low-level package windows for the Windows API.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It is no longer necessary for outside users of package gpu to explicitly
initialize a specific driver. The Direct3D driver is already internal,
this moves the OpenGL driver internally as well. The rename to opengl is
to avoid the name clash with the low-level "gioui.org/internal/glimpl"
package that we're about to rename.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
There are no longer any importers of package backend outside of
gioui.org/gpu. Move it internally, and rename it to the slightly more
specific "driver" while we're at it.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The convert program is only used by the shaders from package gpu, and
we're about to make the backend package imported by the program internal
to package gpu. Move the converter below package gpu.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The package app/internal/d3d11 now contains only the GPU backend on
Direct3D. Move it below package gpu to reflect that.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We're about the merge the Direct3D backend into package gpu. Extract the
raw Direct3D API to its own package, just like package glimpl.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
NewDevice creates a Device given an API, which is the necessary GPU
resources for a backend.
Convert gpu.New to take an API instead of a backend.Device directly.
In turn, this frees us to later unexport the backend package along with
the backend implementations (for now just gioui.org/gpu/gl for OpenGL).
It also allows programs that embed Gio (such as gioui.org/example/glfw)
to freely choose a backend, not just OpenGL.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Completing the goal of allowing foreign Direct3D contexts for our
D3D backend, slim down the constructor to take only the device handle.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We're about to enable drawing into foreign Direct3D contexts. In
preparation, NewBackend should only need a device handle.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Continuing the previous change to minimize Device, in preparation
for supporting foreign Direct3D contexts.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
We'd like to allow Gio to share a Direct3D context with an embedding
program like the GLFW example does for OpenGL. To do that, d3d11.Device
needs to carry only the minimal information needed (ID3D11Device).
This change moves the caches of ID3D11DepthStencilState and
ID3D11BlendState from from d3d11.Device to d3d11.Backend. It also adds a
Release method for freeing them.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
BeginFrame returns the output framebuffer, and need not be as general
as the newly unexported currentFramebuffer methods.
No functional change.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Bind the framebuffer as late as possible to lessen the risk of
confusing global state (current framebuffer). Commit
25a19481e3 removed the assumption
that the framebuffer current at gpu.New would always be the output
framebuffer
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Before this change, a radio button with the empty key ("") would be
displayed as hovering if no other button were.
It's still not possible to have no radio buttons selected when one of
them is the empty key. If that's becomes necessary, Enum.Value can be
converted to a *string.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
checkable.layout forces the label to take up at least constraints.min
space. However, for min == max, the total checkbox plus label would then
overflow. The minimum constraint doesn't seem necessary anymore, so drop
it.
Remove a superfluous layout.W layout as well.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The Windows tests on builds.sr.ht are still flaky:
TestEndToEnd/Windows: e2e_test.go:130: retrying after 400ms
TestEndToEnd/Windows: e2e_test.go:130: retrying after 800ms
TestEndToEnd/Windows: e2e_test.go:130: retrying after 1.6s
TestEndToEnd/Windows: e2e_test.go:130: retrying after 2s
TestEndToEnd/Windows: e2e_test.go:130: last error: encountered 6 color mismatches:
5,5 got 0xffffffffffff, want 0xffff00000000
395,5 got 0xffffffffffff, want 0xffff00000000
5,305 got 0xffff00000000, want 0x000000000000
395,305 got 0xffff00000000, want 0x000000000000
405,305 got 0xffffffffffff, want 0xffff00000000
795,305 got 0xffffffffffff, want 0xffff00000000
TestEndToEnd/Windows: e2e_test.go:130: hit timeout of 4s after 6 tries
Bump the window movement delay in the hope that it helps.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For example, ButtonLeft may be the right-most button for a left-handed user.
Rename the button names to match their intended use.
This is an API change. Use the following commands to update your
projects:
$ gofmt -r 'pointer.ButtonLeft -> pointer.ButtonPrimary' -w .
$ gofmt -r 'pointer.ButtonRight -> pointer.ButtonSecondary' -w .
$ gofmt -r 'pointer.ButtonMiddle -> pointer.ButtonTertiary' -w .
Signed-off-by: Elias Naur <mail@eliasnaur.com>
A previous commit removed the assumption that the output framebuffer
is constant across frames. Thus it is no longer necessary to track
and update a backend's current framebuffer when the window is resized.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Return the output framebuffer from BeginFrame, to make it clear that
it may change between frames. Delete CurrentFramebuffer which is no
longer needed.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
d3d11Context.Present would return a nil error if the underlying error
d3d11.ErrorCode.
While here, use defer for a resource cleanup.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Currently every user needs to manually adjust for system insets.
This is rather verbose and most don't need to deviate from this behavior.
To disable the automatic adjustment, use:
e.Insets = system.Insets{}
ctx := layout.NewContext(ops, e)
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
Commit 94d242d broke the widget.Image's Scale field so
that it no longer had any effect on the actual size of
the displayed image. This commit fixes that, as well as
adding tests to confirm that the widget.Image type
scales appropriately with DPI changes and its own Scale
field.
Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
Use dxc (DirectXShaderCompiler) for compiling, which is newer than fxc
and doesn't not fail compilation with dynamically uniform flows with
barriers.
Currently requires -directcompute to enable generating the shaders.
Signed-off-by: Egon Elbre <egonelbre@gmail.com>