Commit Graph

9026 Commits

Author SHA1 Message Date
Hajime Hoshi
7f0a86f32c .gitub/workflows: add -compat=1.17 to go-mod-tidy
This is due to a new dependency on golang.org/x/exp/shiny from
gomobile.
2023-09-02 01:22:36 +09:00
Hajime Hoshi
b615aaf673 update gomobile 2023-09-02 01:16:06 +09:00
Hajime Hoshi
fedfceff32 update Oto to v3.1.0-alpha.2 2023-09-01 00:13:05 +09:00
Hajime Hoshi
d9757138a7 internal/restorable: use clearImage to clear a region
This is an improvement for https://github.com/hajimehoshi/ebiten/issues/2676#issuecomment-1650325027

Updates #2676
2023-08-31 23:32:54 +09:00
Hajime Hoshi
e082ea73dc internal/restorable: reuse empty byte slices for ClearPixels
This is an improvement for https://github.com/hajimehoshi/ebiten/issues/2676#issuecomment-1650325027

Updates #2676
2023-08-31 23:02:40 +09:00
Hajime Hoshi
7ed2d73406 internal/builtinshader: bug fix: wrong blending rate
The blending rate of colors in a square vertices should be calculated
by the lower-right point, not the upper-left point.

mix(a, b, rate) function calculates (1-rate)*a + rate*b, so a should
be weighted if rate is close to 0, and b should be weighted if rate
is close to 1. The current implementation was opposite.

Rendering results don't seem to be changed so much actually, but the
current implementation doesn't make sense.
2023-08-31 15:11:37 +09:00
Hajime Hoshi
9ad9bc9ed9 ebiten: bug fix: wrong interpolation in the screen shader 2023-08-31 13:28:01 +09:00
Hajime Hoshi
0e1b73f94f ebiten: simplify the screen shader 2023-08-31 12:56:45 +09:00
Hajime Hoshi
ad2d8977b6 ebiten: update a comment 2023-08-31 11:50:15 +09:00
Hajime Hoshi
009fb504ed internal/builtinshader: remove adjustments for tie-breaking
This seems no longer needed with the pixel mode.

This was confirmed by this test:

```
go run . -run=TestImageLinearFilterGlitch2
```

The same change didn't work at b5ca404c42
but worked at 49582519c1, which
introduced the pixel mode.

Updates #1212
2023-08-30 23:55:44 +09:00
Ketchetwahmeegwun T. Southall
60b7de6a3c
ebiten: add APIs to treat monitors (#2597)
This change adds these APIs:

* `type MonitorType`
* `func (*MonitorType) Bounds() image.Rectangle`
* `func (*MonitorType) Name() string`
* `func Monitor() *MonitorType`
* `func SetMonitor(*MonitorType)`
* `func AppendMonitors([]*MonitorType) []*MonitorType`

Closes #1835
2023-08-30 21:02:04 +09:00
Hajime Hoshi
b1b4335423 update Oto 2023-08-29 15:13:40 +09:00
Hajime Hoshi
98ead195c6 audio: bug fix: deadlock between a player and a context
Closes #2737
2023-08-29 14:52:48 +09:00
Hajime Hoshi
69c01ee7ef update README
Ebitengine now supports keyboards for iOS.

Updates #1090
2023-08-29 01:42:20 +09:00
Hajime Hoshi
1269315f75 internal/shader: bug fix: forbid duplicated uniform variables
Closes #2648
2023-08-29 00:43:10 +09:00
Hajime Hoshi
446a6dc952 internal/graphics: deprecated some built-in functions
Updates #1870
2023-08-29 00:06:54 +09:00
Hajime Hoshi
db34930ae8 internal/graphics: add built-in Kage functions
This change adds these Kage functions:

* imageDstOrigin
* imageDstSrc
* imageSrcNOrigin
* imageSrcNSrc

and deprecates these functions:

* imageDstRegionOnTexture
* imageSrcRegionOnTexture

Closes #1870
2023-08-28 15:06:45 +09:00
Hajime Hoshi
101c9cbf5c examples/flappy: use the pixels mode 2023-08-28 03:52:52 +09:00
Hajime Hoshi
101372a8c3 ebiten: allow different-size source images at DrawTrianglesShader (pixel mode)
Updates #1870
2023-08-28 01:39:43 +09:00
Hajime Hoshi
e1b77fefae ebiten: update comments
Updates #1870
2023-08-27 23:57:07 +09:00
Hajime Hoshi
a4f8c1c1dc ebiten: remove old comments 2023-08-27 22:02:39 +09:00
Hajime Hoshi
ead3f32df0 ebiten: refactoring 2023-08-27 21:38:54 +09:00
Hajime Hoshi
c4b8378b71 ebiten: fix typo 2023-08-27 21:21:14 +09:00
Hajime Hoshi
534370f7b1 internal/graphics: enable to specify regions for each source image
This is a preparation to specify different sizes of source images.

Updates #1870
2023-08-27 21:15:01 +09:00
Hajime Hoshi
4b9875295c ebiten: refactoring: reduce local variables 2023-08-27 18:14:50 +09:00
Hajime Hoshi
3678b20c5d ebiten: bug fix: DrawImage/DrawRectShader unexpectedly modified the given options
Closes #2733
2023-08-27 01:40:37 +09:00
Hajime Hoshi
dec08b9e4e all: bug fix: relative paths for dlopen didn't work on macOS Sonoma
Closes #2732
2023-08-26 14:52:52 +09:00
Hajime Hoshi
592d6c57b7 internal/graphicsdriver/metal: improve an error message for Metal initialization
Updates #2732
2023-08-26 12:43:16 +09:00
Hajime Hoshi
4116fd3eb4 internal/debug: bug fix: add SwitchLogger to dump logs for each frame correctly
Closes #2731
2023-08-26 03:38:37 +09:00
Hajime Hoshi
b29fc5672c internal/graphicscommand: use bufio to make dumping images faster 2023-08-26 00:50:45 +09:00
Hajime Hoshi
fd5e2d39c0 internal/graphics: add uniform variables for source image sizes
Updates #1870
2023-08-25 07:30:52 +09:00
David Poirier
7fe89b173b
examples/gamepad: bug fix: correct iteration start button in gamepad example (#2730)
Start iterating at zero instead of gamepad id (which is usually 0).
2023-08-24 16:27:35 +09:00
Hajime Hoshi
a9b2f5f9ca Revert "ebiten: panic if a non-existent uniform variable name is given"
This reverts commit 1b8580fab7.

Reason: some existing applications don't work with this fix.

Updates #2710
2023-08-24 14:15:19 +09:00
Hajime Hoshi
3493358fd2 internal/graphics: use the terms 'image' and 'texture' appropriately 2023-08-24 02:36:51 +09:00
Hajime Hoshi
7ea3cd4738 internal/atlas: bug fix: copy the image slice before iterating it
Closes #2729
2023-08-23 16:41:34 +09:00
Hajime Hoshi
269fc2bd4d update dependencies 2023-08-23 13:50:44 +09:00
Hajime Hoshi
2de64088dc internal/graphicscommand: reduce boundary checks
This can be confirmed by this command:

```
go build -gcflags="-d=ssa/check_bce" ./internal/graphicscommand/
```

Updates #2601
2023-08-21 03:15:31 +09:00
Hajime Hoshi
bcc2ead670 ebiten: add a faster way for common blends
Updates #2601
2023-08-20 16:31:56 +09:00
Hajime Hoshi
c00795416a internal/graphicscommand: remove a redundant boundary check
The boundary is already checked the above 'copy' call. This can be
confirmed by the result of this command.

```
go build -gcflags="-d=ssa/check_bce" ./internal/graphicscommand/
```
2023-08-20 15:45:19 +09:00
Hajime Hoshi
407d7bd43f internal/graphics: optimization: remove boundary checks
Before:

```
$ go build -gcflags="-d=ssa/check_bce" ./internal/graphics
internal/graphics/vertex.go:83:9: Found IsSliceInBounds
internal/graphics/vertex.go:85:5: Found IsInBounds
internal/graphics/vertex.go:86:5: Found IsInBounds
...
```

After:

```
$ go build -gcflags="-d=ssa/check_bce" ./internal/graphics
internal/graphics/vertex.go:83:11: Found IsSliceInBounds
internal/graphics/shader.go:134:37: Found IsSliceInBounds
```

Updates #2601
2023-08-20 15:38:07 +09:00
Hajime Hoshi
d9797423e5 ebiten, internal/builtinshader: use an array instead of a map
runtime.mapaccess2 is one of heavy function calls.

Updates #2601
2023-08-20 05:20:52 +09:00
Hajime Hoshi
10c9f489ce internal/devicescale: use a slice instead of a map
runtime.mapaccess2 is one of heavy function calls.

Updates #2601
2023-08-20 05:00:46 +09:00
Hajime Hoshi
4f2327536c internal/shaderir: improve FilterUniformVariables
```
name      old time/op  new time/op  delta
Filter-8  31.7ns ± 1%  29.9ns ± 1%  -5.60%  (p=0.000 n=9+10)
```

Updates #2601
2023-08-20 03:21:46 +09:00
Hajime Hoshi
3b67b91bb2 internal/graphicscommand: remove redundant buffers
Now there are two command queues, uint32sBuffer doesn't have to have
two buffers.
2023-08-19 17:15:48 +09:00
Hajime Hoshi
fcec771f34 internal/graphicscommand: clear uniform variables explicitly
This change is a performance optimization.

(*uint32sBuffer).alloc doesn't clear the uniform values. Without
clearing the values explicitly, CanMergeWithDrawTrianglesCommand
might return false even though two commands can be merged.
2023-08-19 16:19:14 +09:00
Hajime Hoshi
a9d9143d90 internal/atlas: replace a map with a set with a slice
Updates #2601
2023-08-19 15:08:49 +09:00
Hajime Hoshi
3b2251a858 internal/atlas: refactoring: improve a comment 2023-08-19 05:24:20 +09:00
Hajime Hoshi
be68f50f96 internal/atlas: refactoring: rename a variable 2023-08-19 05:20:39 +09:00
Hajime Hoshi
3c49f81b5c internal/atlas: replace a global map with a member
This should be a pure performance improvement.

Updates #2601
2023-08-19 05:02:35 +09:00
Hajime Hoshi
32f1436576 internal/atlas: refactoring: remove (probably) unnecessary logics 2023-08-19 04:36:40 +09:00