Commit Graph

70 Commits

Author SHA1 Message Date
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
0d6b42fedd internal/ui: refactoring: keep screen/offscreen sizes as float64
Updates #2285
2022-11-09 01:18:41 +09:00
Hajime Hoshi
066029539e internal/ui: clean-up code
A callback is preferred to a dirty flag.

Updates #2341
2022-10-28 19:07:37 +09:00
Hajime Hoshi
b019a3723a internal/ui: optimize GPU usages when the screen doesn't have to be updated
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).

Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
3b7bc2fc57 internal/ui: remove unnecessary comments 2022-10-23 00:39:37 +09:00
Hajime Hoshi
fc2f999ebf internal/ui: refactoring: separate globalState into a new file 2022-10-23 00:11:35 +09:00
Hajime Hoshi
9ec23ddeb4 ebiten: add DrawTrianglesOptions.AntiAlias and DrawTrianglesShaderOptions.AntiAlias
Closes #2385
2022-10-21 02:07:41 +09:00
Hajime Hoshi
2855095ac9 all: unify terms for buffers and flushing 2022-10-16 19:47:00 +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
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
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
0b45ca7057 ebiten: reduce duplicated shader compilations 2022-10-02 20:33:50 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
eea11ba6cb internal/ui: use a Kage shader for Fill
Updates #2364
2022-10-02 16:08:33 +09:00
Hajime Hoshi
7b6f726729 internal/ui: skip uniform variables when possible
Updates #2364
2022-10-02 16:02:44 +09:00
Hajime Hoshi
239f9de2ca internal/ui: use Kage shaders
Updates #2364
2022-10-02 15:54:48 +09:00
Hajime Hoshi
3a0f28ce6b internal/ui: refactoring: reduce global-variable usages 2022-09-26 00:46:03 +09:00
Hajime Hoshi
12f42544dd internal/ui: refactoring: simplify logic by removing setSizeCallbackEnabled
Closes #1816
2022-09-25 23:48:40 +09:00
Hajime Hoshi
c5867c3357 internal/ui: bug fix: avoid 0 as arguments for Layout
Updates #2340
2022-09-20 22:50:39 +09:00
Hajime Hoshi
bd43b42ee5 internal/ui: reland the screen shader in Kage
This change relads a part of the change to use the screen shader
instead of FilterScreen, but with the issue on iOS fixed.

Let's remove FilterScreen later.

Updates #2282
2022-09-06 18:48:19 +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
3259ef3daf internal/ui: fix comments 2022-08-26 22:55:22 +09:00
Hajime Hoshi
7c55065490 internal/ui: simplify the screen shader 2022-08-26 22:49:17 +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
Vseslav Kochenov
3ac37e250f
ebiten: add ReadDebugInfo for getting debug info (only graphics libray so far) (#2222)
Closes #2177
2022-07-31 02:56:16 +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
55adc2113e internal/clock: Update -> UpdateFrame 2022-07-12 13:18:49 +09:00
Hajime Hoshi
e05df6a778 internal/ui: refactoring 2022-07-12 12:47:34 +09:00
Hajime Hoshi
c5e952d196 internal/ui: refactoring: reduce members from globalState 2022-07-12 12:35:07 +09:00
Hajime Hoshi
08e54ae1a6 internal/ui: rename the TPS functions
Updates #2071
2022-07-12 12:25:57 +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
d3e3df812a internal/ui: recreate an offscreen image when isScreenClearedEveryFrame is toggled
This is a preparation to remove SetVolatile and SetIsolated in
the atlas package.
2022-06-07 23:16:42 +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
38a2aa11fd internal/ui: bug fix: deadlock at Layout with Ebiten's image functions called
Closes #2079
2022-04-26 01:12:57 +09:00
Hajime Hoshi
5c7917897c internal/ui: refactoring: move the logic in gameForUI to context 2022-04-01 22:33:31 +09:00
Hajime Hoshi
9c448d207a internal/ui: remove an unnecessary alias 2022-04-01 21:17:26 +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
8e40b2562e internal/ui: remove an error returning value from Game.Draw 2022-04-01 19:10:10 +09:00
Hajime Hoshi
ea1c18d124 internal/ui: rename contextImpl -> context 2022-04-01 17:59:44 +09:00
Hajime Hoshi
79e93d3b12 internal/graphicsdriver: introduce the DirectX driver
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
12ce5ae83a internal/ui: remove the call of graphicsDriver() from the context 2022-03-21 16:48:33 +09:00