Commit Graph

262 Commits

Author SHA1 Message Date
Hajime Hoshi
d73e8f785d internal/graphicsdriver: render various destination regions as one command
Closes #2232
2022-11-04 20:49:44 +09:00
Hajime Hoshi
0afb6fd22a internal/graphicsdriver/metal: reduce rendering paths for even-odd rendering 2022-11-04 16:17:51 +09:00
Hajime Hoshi
384dee7160 internal/graphicscommand: remove unused uniform variables
This improves possibility of merging graphics commands by reducing
uniform variables.

Updates #2232
2022-11-03 22:45:17 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
a5993f09a2 internal/graphicscommand: refactoring: add preserved uniform variables at the graphicscommand package
This is a preparation to skip setting unnecessary uniform variables
like dstRegion.

Updates #2232
2022-10-30 22:30:52 +09:00
Hajime Hoshi
690e73c11b all: replace reflect.SliceHeader with unsafe.Slice
Closes #2420
2022-10-30 12:25:30 +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
da5f5ea327 ebiten: add blend factors
Updates #2382
2022-10-18 00:21:13 +09:00
Hajime Hoshi
46a218c278 internal/graphicsdriver/metal/mtl: bug fix: wrong renaming
Updates #2382
2022-10-17 01:11:54 +09:00
Hajime Hoshi
871a8869db ebiten: bug fix: wrong renaming
Updates #2382
2022-10-17 01:00:23 +09:00
Hajime Hoshi
180e456a8e ebiten: rename members of Blend
Updates #2382
2022-10-17 00:51:55 +09:00
Hajime Hoshi
e03825bf08 ebiten: add BlendOperationSubtract and BlendOperationReverseSubtract
Updates #2382
2022-10-17 00:30:24 +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
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
08e6f5af86 internal/graphicsdriver: remove FramebufferYDirection 2022-10-14 00:05:59 +09:00
Hajime Hoshi
69cdd2b178 internal/graphicsdriver/metal: refactoring 2022-10-04 00:29:18 +09:00
Hajime Hoshi
080d936d42 internal/graphics: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:13:31 +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
5e459bbe42 internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
eb3c45c8af Revert "internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used"
This reverts commit b457dc3307.

Reason: a color scale might be used with ColorM (DrawTriangles)
2022-10-02 00:19:41 +09:00
Hajime Hoshi
b457dc3307 internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used 2022-10-01 18:14:22 +09:00
Hajime Hoshi
4203a3b68a internal/graphicsdriver/opengl, metal, directx: add comments
Updates #1212
2022-10-01 15:21:02 +09:00
Hajime Hoshi
a10f3d1dad internal/graphicsdriver/opengl, metal, directx: refactoring: clean up the built-in shaders 2022-10-01 14:35:26 +09:00
Hajime Hoshi
cff64894cc internal/affine: refactoring: use slices instead of array pointers
This doesn't change the performance at the test using ColorM:

```
name           old time/op  new time/op  delta
ColorMScale-8  1.11µs ±43%  1.23µs ±70%   ~     (p=1.000 n=5+5)
```
2022-09-30 22:20:32 +09:00
Hajime Hoshi
45b2bd7b2b internal/graphicsdriver/metal/mtl: remove a TODO comment 2022-09-16 11:48:59 +09:00
Hajime Hoshi
963eb2756a all: fix TODO comments 2022-09-16 02:02:02 +09:00
Hajime Hoshi
2cbc5e7b60 internal/cocoa: remove IsIOS
Use `runtime.GOOS == "ios"` instead.

Closes #1415
2022-09-15 01:04:37 +09:00
Hajime Hoshi
655cd4bf68 all: remove the build tag
Updates #1415
2022-09-15 00:23:40 +09:00
Terra Brown
a1cc44833d
add errcheck static analysis (#2293)
Closes #2287
2022-09-10 01:52:46 +09:00
Hajime Hoshi
bb406c9b8f internal/graphicsdriver/metal: bug fix: go vet failed
view must not be copied.

Updates #2282
2022-09-06 19:09:21 +09:00
Hajime Hoshi
35f597e682 internal/graphicsdriver: refactoring: remove FilterScreen
Closes #2282
2022-09-06 19:04:15 +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
b2f874a244 image/rectangle: read pixels only for necessary parts
Closes #2274
2022-08-27 23:23:33 +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
TotallyGamerJet
05470f7706
internal/graphicsdriver/metal: remove C for macOS (#2243)
Updates #1162
2022-08-18 01:39:34 +09:00
Hajime Hoshi
70f5e84098 internal/graphicsdriver: rename ReplacePixels to WritePixels
Updates #2236
2022-08-08 03:05:04 +09:00
mattn
2bacecca24
fix typos (#2227) 2022-08-03 22:40:39 +09:00
Herczog Zoltán
fabf3fb374
internal/graphicsdriver/metal: remove supportsMetal check (#2223)
Closes #2211
2022-07-31 21:20:53 +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
7d725f3e58 Revert "internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal"
This reverts commit c31cc4ecff.

Reason: This didn't fix the issue.

Updates #2154
2022-07-04 11:50:06 +09:00
Hajime Hoshi
c31cc4ecff internal/graphicscommand: bug fix: using an image just after ReplacePixels might fail on Metal
Inserting a dummy rendering command after ReplacePixels and before
DrawTriangles solved the issue. This is a very dirty hack, but
there seems no other better way.

Closes #2154
2022-07-03 15:59:18 +09:00
Hajime Hoshi
afe1a93648 internal/graphicscommand, internal/graphicsdriver/metal: remove unused code 2022-07-03 15:23:52 +09:00
Hajime Hoshi
12533c2cce Revert "internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles"
This reverts commit ac802cf0d0.

Reason: This caused flickerings, and didn't solve #2154

Updates #2154
Closes #2174
2022-07-03 12:17:58 +09:00
Hajime Hoshi
ac802cf0d0 internal/graphicsdriver/metal: bug fix: need to commit replace-pixels commands at DrawTriangles
Closes #2154
2022-06-19 15:38:12 +09:00
Hajime Hoshi
07a558b38d internal/graphicsdriver/metal: bug fix: the default driver must be initialized on the main thread
Closes #2147
2022-06-17 14:58:26 +09:00
Hajime Hoshi
138463e219 internal/ui: rename chooseGraphicsDriver -> newGraphicsDriver 2022-06-17 02:40:39 +09:00
Hajime Hoshi
7484df0c5e internal/graphicsdriver/metal: replace Get with NewGraphics
This is a prepartion to return an error when a graphics driver, especially
DirectX, fails to initialize.

Updates #2142
2022-06-17 02:40:35 +09:00