Commit Graph

4494 Commits

Author SHA1 Message Date
Hajime Hoshi
dd2768d5f3 internal/ui: bug fix: introduce locks for monitors
Updates #1853
2023-09-15 03:59:13 +09:00
Hajime Hoshi
32bd565df9 internal/ui: bug fix: setWindowMonitor was processed even when the same monitor was specified
Updates #1835
2023-09-15 03:30:15 +09:00
Hajime Hoshi
b710ff17c8 internal/ui: bug fix: wait for a while after exiting fullscreen on macOS
Closes #2758
2023-09-15 03:19:37 +09:00
Hajime Hoshi
90accfba1e internal/ui: bug fix: do not call PollEvents on Windows and Linux
Updates #2296
2023-09-15 03:11:58 +09:00
Hajime Hoshi
568e98ef1c internal/ui: bug fix: call setOrigWindowPos on entering fullscreen
Closes #2757
2023-09-15 02:53:38 +09:00
Hajime Hoshi
f7a801d591 internal/ui: refactoring 2023-09-15 02:45:31 +09:00
Hajime Hoshi
9a5ef1b553 internal/ui: bug fix: disable window size limitation on fullscreen
Closes #2260
2023-09-15 02:19:20 +09:00
Hajime Hoshi
0e19cd10be internal/shader: add type checks for a bitwise operator + assignment
Closes #2754
2023-09-13 04:17:46 +09:00
Hajime Hoshi
1f67518319 internal/shader: clean up tests 2023-09-13 03:57:20 +09:00
Hajime Hoshi
320cec8869 internal/shaderir: refactoring 2023-09-13 03:25:42 +09:00
Hajime Hoshi
19413c2805 internal/shader: refactoring: move type deduction to shaderir package
Updates #2754
2023-09-13 00:18:47 +09:00
Hajime Hoshi
5e30e1ee1d internal/shader: refactoring 2023-09-12 03:27:30 +09:00
Hajime Hoshi
73e4423fe7 internal/shader: bug fix: bitwise operators with assignment didn't work
Closes #2752
Updates #2754
2023-09-12 03:15:28 +09:00
Hajime Hoshi
c13980158f internal/shader: add type checks for bitwise operators
Updates #2754
2023-09-12 02:40:42 +09:00
Hajime Hoshi
41c7852c7d internal/ui: sort selectors in alphabetical order 2023-09-11 02:15:42 +09:00
TotallyGamerJet
5dc293fe4f
internal/ui: use new OBJC API (#2750)
Updates #1162
2023-09-11 02:05:42 +09:00
Hajime Hoshi
55bfc02509 internal/processtest: use (*testing.T).TempDir 2023-09-06 11:37:27 +09:00
Hajime Hoshi
20ddfba983 internal/shader: bug fix: error in assinments to multiple variables
Closes #2747
2023-09-04 02:21:45 +09:00
Hajime Hoshi
1bbded8653 internal/shader: bug fix: wrong local variable index was used for assignments
Closes #2655
2023-09-04 01:23:03 +09:00
Hajime Hoshi
f82114e8eb internal/shader: add parseFor
Updates #1897
2023-09-03 17:15:39 +09:00
Hajime Hoshi
f30a58a393 internal/ui: bug fix: disable global functions after the game termination
Closes #2743
2023-09-02 15:38:41 +09:00
Hajime Hoshi
6e968558b1 internal/ui: bug fix: setRunning(true) must be called after the main thread is set
Some functions like ebiten.SetCursorMode use `running` to detect
whether the game starts or not. If the game starts, the main thread
must exist, but there was a timing when `running` was true but the
main thread didn't exist.

This change fixes this issue by changing the timing to call
`setRunning(true)` after the main thread initialization and before
`initOnMainThread`. `initOnMainThread` assumes that `running` is
true.

Closes #2742
2023-09-02 04:24:51 +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
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
98ead195c6 audio: bug fix: deadlock between a player and a context
Closes #2737
2023-08-29 14:52:48 +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
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
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
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
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
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