Commit Graph

124 Commits

Author SHA1 Message Date
Hajime Hoshi
55702a7c28 internal/atlas: refactoring: ensure ReadPixels to be processed in a frame
This enables to call (*Image).At from HandleInput, which might be
called outside of a frame.

Updates #1704
2023-10-25 00:48:09 +09:00
Hajime Hoshi
b94c3fa9bb internal/atlas: split EndFrame into EndFrame and SwapBuffers
This enables to do something asynchronously while executing SwapBuffers
in a different goroutine.

This is a preparation for HandleInput.

Updates #1704
2023-10-24 00:22:04 +09:00
Hajime Hoshi
e80e981bf5 internal/atlas: let callers retry ReadPixels instead of blocking
This is a preparation to implement HandleInput, which might call
(*Image).At in its callback.

Updates #1704
2023-10-20 02:30:32 +09:00
Hajime Hoshi
ad51e22252 internal/atlas: bug fix: ReadPixels crashed when inFrame was false
This change fixes the issue by letting ReadPixels return a channel
and executing this asynchronously when needed.

Closes #2815
2023-10-19 03:56:54 +09:00
Hajime Hoshi
7d517bfb63 internal/buffered: move buffering to internal/atlas
Closes #2814
2023-10-19 01:56:18 +09:00
Hajime Hoshi
da979a3ab2 internal/buffer, internal/mipmap: remove Shader 2023-10-19 00:52:32 +09:00
Hajime Hoshi
19ee79e2cb internal/buffered: remove unnecessary deferred functions for shaders 2023-10-18 23:36:41 +09:00
Hajime Hoshi
3f1b7e78b8 internal/buffered: remove unnecessary deferred functions 2023-10-18 23:20:02 +09:00
Hajime Hoshi
58847e023d internal/buffered: refactoring 2023-10-18 23:03:05 +09:00
Hajime Hoshi
b0f88bce7d internal/buffered: remove unnecessary deferred functions 2023-10-18 22:30:01 +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
3869e2e4f6 internal/ui: refactoring: integrate the render thread usages into internal/graphicscommand
Updates #2664
2023-07-30 03:50:49 +09:00
Hajime Hoshi
d2c991b774 all: refactoring: use image.Rectangle 2023-04-28 01:03:38 +09:00
Hajime Hoshi
c48d0fbb7a internal/buffer: refactoring 2023-02-26 02:20:07 +09:00
Hajime Hoshi
110ba5403d internal/buffered: remove redundant pixel data if possible 2023-02-26 01:55:43 +09:00
Hajime Hoshi
b08b740914 internal/buffered: bug fix: functions were not concurrent-safe
Before this change, `delayedCommandsFlushed` was set as 1 BEFORE
buffered commands were flushed. This meant that a function call and
a command being flushed were not concurrent-safe.

This change fixes this issue by changing the timing of setting
`delayedCommandsFlushed` as 1 to the later time after flushing the
buffered commands.

Closes #2580
2023-02-21 20:38:06 +09:00
Hajime Hoshi
89c64f83e3 ebiten: performance improvement by reducing allocations of []float32 2022-12-03 21:53:56 +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
61f1d8b69f internal/graphics: remove the common vertices backend
It was actually impossible to use the common vertices backend in a
thread-safe manner, and actually this caused race conditions.

This changes fixes the issue by giving up a central backend, and
letting images have their own vertices buffer.

Closes #2473
2022-12-03 01:02:23 +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
09a7d39874 internal/graphicsdriver: add Blend struct
This is a preparation to specify blend factors and blend operators.

Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
72983d966b all: remove unused conditions
Now Kage shaders are always used.

The situtation is different from when we fixed for #1355, so we removed
the fast path for #1335. We have to re-check the current performance.

Updates #1355
2022-10-02 23:50:48 +09:00
Hajime Hoshi
361a1059ee internal/buffered: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:29 +09:00
Hajime Hoshi
3da30b3b78 internal/atlas: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:27 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
ae41530f1c internal/graphicscommand: move availableFilename to graphicscommand 2022-08-31 13:26:14 +09:00
Hajime Hoshi
7061b34222 internal/buffered: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:11 +09:00
Hajime Hoshi
8ce84c6596 internal/atlas: rename ReplacePixels -> WritePixels 2022-08-08 03:24:46 +09:00
Hajime Hoshi
6c22f3f1a8 internal/buffered: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:58:01 +09:00
Hajime Hoshi
764ec8c794 internal/atlas: refactoring 2022-08-02 01:13:46 +09:00
Hajime Hoshi
afed6a83c6 internal/graphics: change the naming convention: Num -> Count
This change also renames ebiten.MaxIndicesNum -> ebiten.MaxIndicesCount.
2022-07-13 02:02:44 +09:00
Hajime Hoshi
8522bfd0bf internal/graphicscommand: bug fix: replacePixelsCommand should not read pixels
Reading pixels, writing pixels, and using the image as a source might
cause a flaky behavior with Metal. Stop reading pixels if possible.

Closes #2180
2022-07-05 23:30:26 +09:00
Hajime Hoshi
0eb2f76422 internal/buffered: refactoring 2022-06-25 01:42:40 +09:00
Hajime Hoshi
c490347cef internal/buffer: bug fix: shader manipulations must be buffered
Closes #2162
2022-06-25 01:31:20 +09:00
Hajime Hoshi
81f91658ff internal/atlas: refactoring: remove SetVolatile and SetIsolate
Pass an image type to NewImage instead.
2022-06-08 01:08:00 +09:00
Hajime Hoshi
86a0a4154d internal/atlas: rename SetIsolate -> SetIsolated 2022-06-06 07:17:45 +09:00
Hajime Hoshi
b9012fc6ed internal/atlas: unify the term 'isolate' and 'independent' to 'isolate' 2022-06-06 00:28:23 +09:00
Hajime Hoshi
6710808cd1 ebiten: compile shaders at NewShader
Closes #2035
2022-04-04 02:52:57 +09:00
Hajime Hoshi
f75a70dc40 internal/graphicscommand: treat []float32 instead of interface{} for uniform variables 2022-04-03 03:51:52 +09:00
Hajime Hoshi
81b9f91f86 internal/graphicscommand: compile shaders lazily
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.

This change delays compiling shaders until the graphics commands
are actually executed in the main loop.

Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
870a18e8f5 internal/buffered: remove unnecessary conditions from resolvePendingPixels 2022-03-21 15:27:21 +09:00
Hajime Hoshi
4b31983b6d internal/buffered: English 2022-03-21 15:20:52 +09:00
Hajime Hoshi
c316aaae72 internal/buffered: simplify the API 2022-03-21 15:19:06 +09:00
Hajime Hoshi
29f7a45ccc internal/buffer: remove the graphics-driver argument from ReplacePartialRegionPixels
This is necessary to remove the graphics driver usage from
(*ebiten.Image).At. And this is necessary to determine the graphics
driver after the window becomes transparent or not.

Unfortunately, it is not obvious to make a transparent window with
DirectX. Then, the determination of a graphics driver should be delayed.

Updates #1007
2022-03-21 05:59:43 +09:00
Hajime Hoshi
fbcbd2a001 internal/buffered: refactoring 2022-03-21 04:36:32 +09:00
Hajime Hoshi
b3f4d6c522 internal/atlas: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:56:04 +09:00
Hajime Hoshi
ea81d4abf4 internal/buffered: refactoring 2022-03-20 19:03:41 +09:00
Hajime Hoshi
14c327c89b internal/atlas: replace Pixels with At to reduce unnecessary slice allocations 2022-03-20 18:39:17 +09:00
Hajime Hoshi
11ff0ab48c internal/atlas: refactoring: remove arguments from Pixels 2022-03-20 18:28:57 +09:00