Commit Graph

261 Commits

Author SHA1 Message Date
Hajime Hoshi
f269b61903 internal/atlas: introduce a managed byte slice pool
A managed byte slice from the new byte slice pool has a function
to release and put it back to the pool explicitly, and this doesn't
rely on GCs.

Updates #1681
Closes #2804
2023-10-09 20:32:32 +09:00
Hajime Hoshi
e768e8ad40 internal/graphicscommand: refactoring: add commandqueue.go 2023-10-08 19:54:28 +09:00
Hajime Hoshi
810b62f83e internal/graphicscommand: introduce commandQueuePool and commandQueueManager
This removes the restriction of the number of command queues.

Updates #1704
2023-10-08 19:23:57 +09:00
Hajime Hoshi
d2dd62b6db internal/graphicscommand: remove unnecessary references to drawTrianglesCommand 2023-10-08 17:18:16 +09:00
Hajime Hoshi
fd1083808c internal/graphicscommand: switch the queue before flushing
This is a preparation to do something (e.g. handling inputs) during
being blocked by Flush.

Updates #1704
2023-10-08 16:10:07 +09:00
Hajime Hoshi
53525342b1 internal/graphicscommand: bug fix: Flush didn't return error when sync=false 2023-10-08 04:30:14 +09:00
Hajime Hoshi
4ca3fa5e57
internal/graphicsdriver: replace Region with image.Rectangle (#2791)
Closes #2790
2023-09-28 14:29:55 +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
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
fd5e2d39c0 internal/graphics: add uniform variables for source image sizes
Updates #1870
2023-08-25 07:30:52 +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
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
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
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
ce25583438 internal/atlas: refactoring: move temporaryBytes to internal/graphicscommand 2023-08-01 00:11:40 +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
81b7fd7641 internal/graphicscommand: refactoring 2023-07-30 18:37:18 +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
guangwu
54e1263565
all: unnecessary use of fmt.Sprintf (#2691)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-07-05 16:36:29 +09:00
Hajime Hoshi
ecf07ad09e internal/graphicscommand: speed optimization: reduce boundary checks
Co-authored-by: Egon Elbre <egonelbre@gmail.com>
2023-05-04 12:55:53 +09:00
Hajime Hoshi
e98acd3dc7 internal/graphicsdriver: refactoring: use image.Rectangle 2023-04-29 01:12:05 +09:00
Hajime Hoshi
56b4cdc3c4 internal/graphics: use pixels for offsets 2023-04-26 00:38:23 +09:00
Hajime Hoshi
49582519c1 all: add a compiler directive kage:unit
This change adds a new compiler directive 'kage:unit' to Kage. This
takes one of these two values: 'pixel' and 'texel'. The default value
is 'texel'.

With the pixel-unit mode, all the built-in functions treats pixels
instead of texels, and the texCoord argument of Fragment is in pixels.
This simplifies shader programs as programs no longer have the notion
of texels.

With the texel-unit mode, the behavior is the same as the current
behavior.

Closes #1431
2023-04-23 22:11:57 +09:00
Hajime Hoshi
2f55bb1b3d internal/atlas, internal/graphicscommand: refactoring 2023-04-19 21:43:08 +09:00
Hajime Hoshi
eb6a773d3f internal/graphicscommand: remove unnecessary space chars 2023-04-18 01:19:28 +09:00
Hajime Hoshi
c7ca9cb321 ebiten: omit the exceeding part of vertices at Draw* 2023-03-23 21:23:33 +09:00
Hajime Hoshi
31273c875f internal/graphics: rename constants 2023-03-23 20:48:39 +09:00
Hajime Hoshi
81581df2b9 internal/graphicscommand: reland: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
This change is reland of 54e2790a06
but with a fix for WebGL. Also, this changes the logic when len(vertices)
exceeds the maximum: just remove the last part.

Updates #2460
2023-03-23 18:01:09 +09:00
Hajime Hoshi
c59bcbdb5b Revert "internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount"
This reverts commit 54e2790a06.

Reason: test failures on browsers:

`GOOS=js GOARCH=wasm go test . -shuffle=1679547510163000000` failed
https://github.com/hajimehoshi/ebiten/actions/runs/4497182906/jobs/7912544699
2023-03-23 14:15:04 +09:00
Hajime Hoshi
54e2790a06 internal/graphicscommand: add graphics.MaxVertexFloatCount and use it instead of IndicesCount
Updates #2460
2023-03-23 13:49:05 +09:00
Hajime Hoshi
3f2ac129d2 internal/graphicscommand: refactoring: remove unnecessary restrictions for indices
Updates #2460
2023-03-23 13:28:11 +09:00
Hajime Hoshi
61ee811579 internal/graphicsdriver: define Resetter 2023-03-22 18:35:46 +09:00
Hajime Hoshi
39aaf7fe37 ebiten: update comments
Updates #2601
2023-03-14 13:07:40 +09:00
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
e1992347b7 internal/graphicscommand: rename SetRenderingThread -> SetRenderThread 2022-12-30 13:51:32 +09:00
Hajime Hoshi
c321d069a8 internal/graphicscommand: remove unnecessary type parameters 2022-12-10 00:43:41 +09:00
Hajime Hoshi
0d173834a6 all: speed optimization 2022-12-03 23:09:41 +09:00
Hajime Hoshi
0a6813c17f internal/graphics: use flatten []float32 slice instead of [][]float32
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
4ff9a12930 internal/graphicscommand: refactoring 2022-11-12 22:26:28 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
50021ef3e4 internal/graphicscommand: use buffers for []float32 to reduce allocations 2022-11-04 21:55:44 +09:00
Hajime Hoshi
d73e8f785d internal/graphicsdriver: render various destination regions as one command
Closes #2232
2022-11-04 20:49:44 +09:00
Hajime Hoshi
1839dd0b9b internal/graphicscommand: bug fix: test failures on Linux 2022-11-04 03:55:05 +09:00
Hajime Hoshi
80e3baae9f internal/graphicscommand: reduce allocations of float32 slices 2022-11-04 02:34:44 +09:00
Hajime Hoshi
c4e4e55d75 internal/shaderir: cache reachable uniform variables
Updates #2232
2022-11-04 01:28:24 +09:00