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
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
Hajime Hoshi
1e2a4cb4b1
internal/atlas: refactoring: remove unnecessary logics
...
Updates #2601
2023-08-19 04:06:43 +09:00
Hajime Hoshi
e1041ea20e
internal/atlas: replace a global map with a struct member
...
This should be a pure performance improvement.
Updates #2586
Updates #2601
2023-08-19 03:25:17 +09:00
Hajime Hoshi
77fd15145b
internal/atlas: add a test for a bug fix
...
Closes #2728
2023-08-19 01:36:05 +09:00
Hajime Hoshi
ea1f596cda
internal/atlas: bug fix: possible overflowing on 32bit machines
2023-08-19 01:19:15 +09:00
Hajime Hoshi
e270dea460
internal/graphicsdriver: use []PixelsArgs for ReadPixels
...
Closes #2592
2023-08-17 03:06:48 +09:00
Hajime Hoshi
842c3cbfcd
internal/graphicscommand: use a slice to values instead of pointers
...
This should reduce heap allocations.
2023-08-16 23:23:30 +09:00
Hajime Hoshi
377b0b8502
internal/graphicscommand: rename WritePixelsArgs -> PixelsArgs
...
Updates #2592
2023-08-16 22:34:56 +09:00
Hajime Hoshi
2de54c556b
internal/shader: bug fix: wrong for-loop should fail compilation
...
Closes #2680
2023-08-08 23:38:01 +09:00
Hajime Hoshi
98cb77d94f
internal/atlas: refactoring
2023-08-06 16:03:57 +09:00
Hajime Hoshi
32ed22f91c
internal/atlas: refactoring
2023-08-06 15:59:15 +09:00
Hajime Hoshi
0433dfac99
internal/atlas: reland: clarify the logic when to update usedAsDestination
...
This is a reland of 2c9f5d9dad
.
As the name is `usedAsDestination`, this should be updated whenever
the image is used as a rendering destination.
Confirmed that this change didn't cause a performance regression
like #2586 .
Updates #2586
Updates #2676
2023-08-06 15:59:11 +09:00
Hajime Hoshi
dcc8794883
Revert "internal/atlas: clarify the logic when to update usedAsDestination"
...
This reverts commit 2c9f5d9dad
.
Reason: test failures
2023-08-06 15:25:55 +09:00
Hajime Hoshi
2c9f5d9dad
internal/atlas: clarify the logic when to update usedAsDestination
...
As the name is `usedAsDestination`, this should be updated whenever
the image is used as a rendering destination.
Confirmed that this change didn't cause a performance regression
like #2586 .
Updates #2586
Updates #2676
2023-08-06 15:23:19 +09:00
Hajime Hoshi
a50d9e6291
internal/atlas: check overflows
2023-08-06 13:46:41 +09:00
Hajime Hoshi
1ae5e022b6
internal/atlas: change when to count up usedAsDestinationCount
...
An image has a counter to count how many times an image is used.
Before this change, the counter was updated only when an image was moved
from a source backend to a destination backend. This seemed not enough,
and an image was likely moved to a source backend more often than
necessary (#2676 ).
However, there was also an issue that the counter was updated too
aggressively and the image was unlikely moved from a destination to
a source image (#2586 ).
In order to resolve this dilemma, let's adopt an intermediate way:
count up the counter at most once per frame.
Updates #2586
Updates #2676
2023-08-06 13:27:28 +09:00
Hajime Hoshi
6fa8c02d4a
internal/shader: bug fix: div between a matrix and a flaot failed
...
Closes #2719
2023-08-05 02:12:39 +09:00
Hajime Hoshi
d9acc57997
internal/goglfw: fix copyright texts
...
This change updates the copyright comment to respect the original
GLFW source comments.
2023-08-04 01:17:23 +09:00
Hajime Hoshi
56f37ed42b
internal/cglfw: change the license to Apache-2.0
...
Closes #2695
2023-08-04 01:09:48 +09:00
Hajime Hoshi
4158e206e6
internal/graphicsdriver/metal: rename files
2023-08-03 23:54:48 +09:00
Hajime Hoshi
120366c3ac
internal/cglfw: change the license of *.go files to Apache-2.0
...
Updates #2695
2023-08-03 23:52:53 +09:00
Hajime Hoshi
3dd2f15b64
internal/cglfw: remove GLFW_C_REVISION.txt
...
The source in internal/cglfw is no longer the same as the original one.
2023-08-02 02:02:30 +09:00
Hajime Hoshi
b2be456af8
internal/goglfw: change the license to Apache-2.0
...
Updates #2695
2023-08-01 23:57:05 +09:00
Hajime Hoshi
d410d740a3
internal/graphicsdriver/opengl/gl: change the license of default_cgo* to Apache-2.0
...
Updates #2695
2023-08-01 23:45:43 +09:00
Hajime Hoshi
d8630f940d
internal/shader: bug fix: forbide comparing non-scalar values
...
Closes #2718
2023-08-01 12:32:16 +09:00
Hajime Hoshi
63df6168d9
internal/shader: use plural forms for Kage compiler directives
...
This change renames
```
//kage:unit texel
//kage:unit pixel
```
to
```
//kage:unit texels
//kage:unit pixels
```
.
Closes #2717
2023-08-01 11:41:38 +09:00
Hajime Hoshi
ae9781cd53
internal/graphicscommand: add comments
2023-08-01 00:18:12 +09:00
Hajime Hoshi
ce25583438
internal/atlas: refactoring: move temporaryBytes to internal/graphicscommand
2023-08-01 00:11:40 +09:00
Hajime Hoshi
0fb1cdcfbd
internal/atlas: bug fix: there should be multiple temporaryBytes objects for pipelining
...
Closes #2716
2023-07-31 16:18:17 +09:00
Hajime Hoshi
f81dbd9288
internal/graphicsdriver: flush commands asynchronously whenever possible
...
Closes #2664
2023-07-30 22:44:13 +09:00
Hajime Hoshi
a7e4665f71
internal/graphicscommand: use multiple command queues
...
This is a preparation for asynchronous rendering.
Updates #2664
2023-07-30 22:42:58 +09:00
Hajime Hoshi
5a64f8299e
internal/thread: refactoring: add a common interface Thread
2023-07-30 22:42:24 +09:00
Hajime Hoshi
81b7fd7641
internal/graphicscommand: refactoring
2023-07-30 18:37:18 +09:00
Hajime Hoshi
d13bea29dc
internal/ui: refactoring
2023-07-30 03:52:54 +09:00
Hajime Hoshi
3869e2e4f6
internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
...
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
246bd41695
internal/graphicscommand: fix a wrong comment
2023-07-30 01:56:58 +09:00
Hajime Hoshi
4df647a400
internal/shader: bug fix: forbid to have an initial value for uniform variables
...
Closes #2711
2023-07-29 20:51:02 +09:00
Hajime Hoshi
1b8580fab7
ebiten: panic if a non-existent uniform variable name is given
...
Closes #2710
2023-07-29 20:24:42 +09:00
Hajime Hoshi
0b1c7404d5
ebiten: use zero values for an unspecified uniform variable
...
Closes #2709
2023-07-29 19:11:49 +09:00
Hajime Hoshi
d0e4023d88
internal/ui: add a length check for uniform variables
2023-07-29 18:59:36 +09:00
Hajime Hoshi
5ddf1df423
internal/shaderir: remove ConstType
...
Closes #2550
2023-07-29 15:34:30 +09:00
Hajime Hoshi
7549f4fcd6
internal/shader: reduce ConstType usages
...
Updates #2550
2023-07-29 14:18:32 +09:00
Hajime Hoshi
e225f118fb
internal/shaderir: use ConstType just for an assetion
...
Updates #2550
2023-07-29 14:02:26 +09:00
Hajime Hoshi
900b687f40
internal/shader: add tests
...
Updates #2712
2023-07-28 01:59:31 +09:00
Hajime Hoshi
692d119818
internal/shader: refactoring: reduce ConstType usages
...
Updates #2550
2023-07-28 01:36:15 +09:00
Hajime Hoshi
88be4c5b7c
internal/shader: reland: bug fix: stricter type checks for the built-in cast-like functions
...
Closes #2712
2023-07-28 01:33:27 +09:00
Hajime Hoshi
be2123f7fd
Revert "internal/shader: bug fix: stricter type checks for the built-in functions"
...
This reverts commit 287545b02a
.
Reason: test failures
Updates #2712
2023-07-28 00:54:36 +09:00
Hajime Hoshi
287545b02a
internal/shader: bug fix: stricter type checks for the built-in functions
...
Closes #2712
2023-07-28 00:51:42 +09:00
Hajime Hoshi
ef08873f30
internal/shader: reland2: bug fix: int + ivec failed
...
Closes #2707
2023-07-26 01:23:02 +09:00
Hajime Hoshi
8aefa49510
Revert "internal/shader: reland: bug fix: int + ivec failed"
...
This reverts commit 1c4a0ac0dc
.
Reason: TestShaderUniformMatrix2 failed on Windows
Updates #2707
2023-07-26 00:30:17 +09:00
Hajime Hoshi
1c4a0ac0dc
internal/shader: reland: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 23:02:06 +09:00
Hajime Hoshi
3d8d759976
Revert "internal/shader: bug fix: int + ivec failed"
...
This reverts commit a93908503a
.
Reason: test failures at TestShaderUniformMatrix2
Updates #2070
2023-07-25 22:53:02 +09:00
Hajime Hoshi
a93908503a
internal/shader: bug fix: int + ivec failed
...
Closes #2707
2023-07-25 22:42:06 +09:00
Hajime Hoshi
ad63d0842c
internal/shader: refactoring: check dimensions at AreValidTypesForBinaryOp
2023-07-25 13:46:44 +09:00
Hajime Hoshi
6b94de4ef6
internal/shader: refactoring: integrate type checks to shaderir.AreValidTypesForBinaryOp
2023-07-25 02:51:25 +09:00
Hajime Hoshi
b743b7ab50
internal/shader: bug fix: return true
for float must fail
...
Closes #2706
2023-07-25 02:51:18 +09:00
Hajime Hoshi
29545906c0
internal/shader: refactoring
2023-07-25 01:40:47 +09:00
Hajime Hoshi
c329eab1b2
internal/shader: refactoring
2023-07-24 12:29:27 +09:00
Hajime Hoshi
20123e8420
internal/shader: bug fix: unary operators should keep the type info
...
Closes #2705
2023-07-24 02:21:42 +09:00