Commit Graph

100 Commits

Author SHA1 Message Date
Hajime Hoshi
d2c991b774 all: refactoring: use image.Rectangle 2023-04-28 01:03:38 +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
d823e22bed internal/mipmap: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:32 +09:00
Hajime Hoshi
361a1059ee internal/buffered: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:29 +09:00
Hajime Hoshi
0ae2b1bc24 all: remove unnecessary conditions
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
f293a03ab6 internal/mipmap: reland: do not consider filter to determine mipmap level
This is a reland of 42833614fb.

Now the filter argument is not used (a4e9a05b14),
the filter value can be the nearest filter even though the shader is
for the linear filter.

As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.

Updates #2364
2022-10-02 19:14:23 +09:00
Hajime Hoshi
bcb9844395 Revert "internal/mipmap: bug fix: do not consider filter to determine mipmap level"
This reverts commit 42833614fb.

Reason: test failure: TestImageEdge
2022-10-02 18:53:28 +09:00
Hajime Hoshi
42833614fb internal/mipmap: bug fix: do not consider filter to determine mipmap level
Now the filter argument is not used (a4e9a05b14),
the filter value can be the nearest filter even though the shader is
for the linear filter.

As long as `canSkipMipmap` is set correctly, we don't have to consider
the parameter `filter`. We should ignore it.

Updates #2364
2022-10-02 18:44:06 +09:00
Hajime Hoshi
9492b4ecf5 internal/mipmap: refactoring
This change replaces the member `volatile` with `imageType` to make
the code more explicit.

In the old code, it was not obvious whether a mipmap was used for a
screen image. Actually a mipmap was not used since `canSkipMipmap` is
always true for a screen image, but this was too tricky.
2022-09-28 03:07:40 +09:00
Hajime Hoshi
6b35ad4a88 internal/mipmap: bug fix: mipmap images were unexpectedly volatile
Closes #2354
2022-09-28 01:40:38 +09:00
Hajime Hoshi
35f597e682 internal/graphicsdriver: refactoring: remove FilterScreen
Closes #2282
2022-09-06 19:04:15 +09:00
Hajime Hoshi
ae41530f1c internal/graphicscommand: move availableFilename to graphicscommand 2022-08-31 13:26:14 +09:00
Hajime Hoshi
63e3c4adea Revert "internal/graphics: remove FilterScreen and use an original Kage program instead"
This reverts these commits

* 3259ef3daf
* 7c55065490
* 5bb70f485e

Reason: iOS crash. Probably we have to prepare a special rendering
pipeline for the final screen.

Closes #2278
2022-08-30 01:56:06 +09:00
Hajime Hoshi
5bb70f485e internal/graphics: remove FilterScreen and use an original Kage program instead
Updates #2046
2022-08-26 17:41:29 +09:00
Hajime Hoshi
bd1b9cdb9b internal/mipmap: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:21 +09:00
Hajime Hoshi
7061b34222 internal/buffered: rename ReplacePixels -> WritePixels
Updates #2236
2022-08-08 03:32:11 +09:00
Hajime Hoshi
6d87be7169 internal/ui, internal/mipmap: refactoring: replace At with ReadPixels
Updates #1995
2022-08-06 00:32:42 +09:00
Hajime Hoshi
6c22f3f1a8 internal/buffered: refactoring: replace At with ReadPixels
Updates #1995
2022-08-05 23:58:01 +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
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
b53cb2acd6 internal/ui, internal/mipmap, internal/graphicscommand: fix a wrong panic message 2022-04-01 20:12:12 +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
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
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
Hajime Hoshi
54b4e87506 internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.

Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
c3e855ab02 internal/buffered: refactoring 2022-03-20 16:44:11 +09:00
Hajime Hoshi
cc574ad67e internal/atlas: rename functions: Area -> Region 2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239 internal/buffered: separate ReplacePixels with the large-area and small-area versions
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
4cbce71b2b internal/graphicscommand: move the choice of graphics drivers to internal/ui 2022-03-20 02:51:31 +09:00
Hajime Hoshi
8e3576b404 internal/mipmap: remove unused functions 2022-03-19 23:45:15 +09:00
Hajime Hoshi
7d0f95e9be internal/graphicsdriver: refactoring: replace Uniform with []float32
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
82b9f7dc56 ebiten: refactoring: remove setScreenClearedEveryFrame 2022-02-13 20:40:46 +09:00
Hajime Hoshi
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +09:00
Hajime Hoshi
e66d87e03d internal/buffered, interal/mipmap: typo 2022-01-08 23:32:58 +09:00
Hajime Hoshi
9d72d8c65a internal/buffered, interal/mipmap: typo 2022-01-08 23:31:20 +09:00
Hajime Hoshi
0680ca413d internal/atlas: bug fix: the offscreen must be an independent image
Closes #1938
2022-01-08 23:25:06 +09:00
Hajime Hoshi
06f4142ca0 internal/driver: Optimization: Replace interface{} with driver.Uniform
Converting a value from/to interface{} can create a value in heap
and this is not efficient.
2021-10-30 02:58:28 +09:00
Hajime Hoshi
4b64eadfe5 internal/mipmap, internal/atlas: Integrate for-loops for color scaling 2021-09-23 00:28:20 +09:00
Hajime Hoshi
f79acf9569 internal/mipmap: Bug fix: nil should be meaningful for a mipmap map 2021-09-21 00:46:11 +09:00
Hajime Hoshi
81fd7ab8f6 internal/mipmap: Create a mipmap map lazily 2021-09-20 23:27:14 +09:00