Commit Graph

3861 Commits

Author SHA1 Message Date
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
2f146d5e4f internal/graphicsdriver/opengl: bug fix: build failure for browsers 2022-10-15 23:29:22 +09:00
Hajime Hoshi
257f05883c internal/graphicsdriver/opengl: enable to compiile for browsers with the 'opengles' tag
The 'opengles' tag is just ignored for browsers.
2022-10-15 22:22:28 +09:00
Hajime Hoshi
37c5f53890 internal/graphicsdriver/opengl: refactoring 2022-10-15 22:14:21 +09:00
Hajime Hoshi
1d9f1474e9 internal/graphicsdriver: rename constants 2022-10-15 21:14:59 +09:00
Hajime Hoshi
272d0c6a3f internal/graphicsdriver: rename Operator -> BlendFactor
Updates #2382
2022-10-15 17:34:03 +09:00
Hajime Hoshi
e42ee8c506 internal/graphicscommand: bug fix: call End even if an error causes
Without calling End, the graphics driver (especially Metal) state
might be stale and might cause another error.

Closes #2388
2022-10-15 15:23:04 +09:00
Hajime Hoshi
35e9f26681 internal/graphicsdriver/directx: refactoring 2022-10-15 12:16:41 +09:00
Hajime Hoshi
e796646abd internal/graphicscommand: rename arguments 2022-10-15 03:36:25 +09:00
Hajime Hoshi
bf6a5415cf internal/graphicscommand: bug fix: test failures on Windows 2022-10-15 02:56:40 +09:00
Hajime Hoshi
32a2a705c0 internal/ui: flush the cache of the final screen after DrawScreen
The screen image might have a cache in the future.

Updates #2385
2022-10-15 01:59:53 +09:00
Hajime Hoshi
daf349ab72 internal/graphicscommand: bug fix: present at the end of the frame explicitly
Before this change, presenting happened when the rendering destination
was the final screen. Now this assumption is wrong as the final screen
might be used in the middle of the commands due to DrawFinalScreen.

Instead, this change adds a new argument `present` to FlushCommands to
present the screen explicitly at the end of the frame.

Closes #2386
2022-10-15 01:54:46 +09:00
Hajime Hoshi
f15536e8de ebiten: refactoring: remove imageDumperGame
This enables passing the user's Game to internal/ui without wrapping.

This is necessary to check whether the user's Game implements an
optional function or not.

Updates #2046
2022-10-14 02:58:31 +09:00
Hajime Hoshi
25ae96db89 internal/ui: move screenScaleAndOffsets to the ebiten package
Updates #2046
2022-10-14 01:58:07 +09:00
Hajime Hoshi
03621e22c6 internal/ui: remove unnecessary mutex
Now (*context).updateFrame and (*context).adjustPosition are not called
in parallel even though the goroutines might be different.
2022-10-14 01:47:52 +09:00
Hajime Hoshi
4bd3a9ef8f internal/ui: refactoring: move the screen rendering logic to ebiten package
Updates #2046
2022-10-14 00:34:40 +09:00
Hajime Hoshi
08e6f5af86 internal/graphicsdriver: remove FramebufferYDirection 2022-10-14 00:05:59 +09:00
Hajime Hoshi
c23af8fa3a internal/ui: remove unnecessary comments 2022-10-13 12:28:32 +09:00
Hajime Hoshi
30088cf602 internal/ui: refactoring: reduce uniform variable
This might degrade performance, but can demonstrate how to get the
scale of the screen.

Updates #2046
2022-10-13 00:59:51 +09:00
Hajime Hoshi
91275e8fc2 internal/ui: add comments
Updates #1431
2022-10-12 02:46:08 +09:00
Hajime Hoshi
99e777b0c5 internal/atlas: do not adjust pixels for DrawTriangles(Shader)
Adjusting pixels is needed to avoid strainge rendering to avoid unexpected
rendering (#1171). However, this adjustment caused unexpected holes
especially in a thick stroke.

This change moves the logic of adjusting pixels from atlas to
graphics.QuadVertices so that adjusting works only for DrawImage and
DrawRectShader.

Updates #1171
Updates #1843
2022-10-11 02:09:20 +09:00
Hajime Hoshi
a310b7c5bb internal/builtinshader: fix comments 2022-10-10 13:14:37 +09:00
Hajime Hoshi
cb79e4eabe internal/restorable: improve pixelsForRestore usages
Updates #2375
2022-10-06 15:54:54 +09:00
Hajime Hoshi
c6b37e9809 internal/restorable: use pixelsForRestore only when restoring is needed
Updates #2375
2022-10-06 15:09:21 +09:00
Hajime Hoshi
34562c3337 internal/restorable: clear pixelsForRestore at Dispose
Updates #2375
2022-10-06 15:04:12 +09:00
Hajime Hoshi
e66bac5c3f internal/restorable: reuse byte slices for restoring
Updates #2375
2022-10-06 14:52:20 +09:00
Hajime Hoshi
85d8a5889a Revert "internal/restorable: reuse bytes instead of allocations"
This reverts commit 8cf3c31cf6.

Reason: This didn't improve the situation.

Updates #2375
2022-10-06 14:11:09 +09:00
Hajime Hoshi
8cf3c31cf6 internal/restorable: reuse bytes instead of allocations
Updates #2375
2022-10-06 12:41:47 +09:00
Hajime Hoshi
69cdd2b178 internal/graphicsdriver/metal: refactoring 2022-10-04 00:29:18 +09:00
Hajime Hoshi
b489548963 internal/builtinshader: fix comments 2022-10-03 01:09:28 +09:00
Hajime Hoshi
61cabbf2e7 internal/atlas: optimization 2022-10-03 00:06:50 +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
534d82c17d internal/builtinshader: move Filter and Address from internal/graphicsdriver 2022-10-02 23:24:15 +09:00
Hajime Hoshi
9c07b20f2b internal/ui: remove an odd cast 2022-10-02 23:20:16 +09:00
Hajime Hoshi
efd91c8b86 internal/ui: remove unused arguments from DrawTriangles
Closes #2369
2022-10-02 23:10:27 +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
3da30b3b78 internal/atlas: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:27 +09:00
Hajime Hoshi
de8f85651d internal/restorable: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:51:34 +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
6fca8edc1b internal/graphicscommand: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:21:11 +09:00
Hajime Hoshi
080d936d42 internal/graphics: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:13:31 +09:00
Hajime Hoshi
6fc9d9316d internal/graphicscommand: remove unnecessary conditions
Now a Kage shader is always used.
2022-10-02 22:11:20 +09:00
Hajime Hoshi
a9574627e8 internal/graphicsdriver/directx: remove the built-in shaders
Updates #2369
2022-10-02 21:35:23 +09:00
Hajime Hoshi
033997d928 internal/graphicsdriver/opengl: remove the built-in shaders
Updates #2369
2022-10-02 21:26:13 +09:00
Hajime Hoshi
5f7db485f2 internal/graphicsdriver/metal: remove the built-in shaders
Updates #2369
2022-10-02 20:34:38 +09:00
Hajime Hoshi
0b45ca7057 ebiten: reduce duplicated shader compilations 2022-10-02 20:33:50 +09:00
Hajime Hoshi
ff72898b85 internal/builtinshader: use a struct instead of a map
With a map, we might miss typos.
2022-10-02 20:17:47 +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