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
Hajime Hoshi
195b060911
internal/graphicsdriver/metal: refactoring: initialize the driver at Get
2022-06-16 23:52:55 +09:00
Hajime Hoshi
5c63c4a4aa
internal/graphicsdriver/metal: support macOS 10.12 by removing packed types
...
From the Metal shading language specification [1] Table 2.2.3, attribute
variables in Ebitengine's vertices don't have to be packed. Then, we can
remove `packed` types.
[1] https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf
Closes #2107
2022-05-28 23:57:59 +09:00
Hajime Hoshi
fef79f4d3e
internal/graphicsdriver/metal: update the minimum version of macOS
...
Updates #2095
2022-05-18 00:09:04 +09:00
Hajime Hoshi
7409f01b17
internal/graphicsdriver/metal/mtl: bug fix: specify the language version explicitly
...
Updates #2086
2022-05-05 23:50:48 +09:00
Hajime Hoshi
736d77e0d2
internal/graphicsdriver: remove Graphics.NDCYDirection
2022-04-04 03:03:44 +09:00
Hajime Hoshi
02db3bad53
internal/graphicscommand: remove the dependency on a graphics driver from compileShader
...
Updates #2035
2022-04-04 02:09:08 +09:00
Hajime Hoshi
3fafc05411
internal/graphicsdriver: remove Graphics.HasHighPrecisionFloat
...
Updates #879
2022-04-02 05:19:30 +09:00
Hajime Hoshi
6bd3c81e27
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix-array variables were passed wrongly
...
Updates #2036
2022-03-27 00:32:30 +09:00
Hajime Hoshi
eaad959472
internal/graphicsdriver/metal: remove println
2022-03-27 00:12:34 +09:00
Hajime Hoshi
f6d87f6ee8
internal/graphicsdriver/directx, internal/graphicsdriver/metal: bug fix: uniform matrix variables were passed wrongly
...
Updates #2036
2022-03-26 23:58:48 +09:00
Hajime Hoshi
79e93d3b12
internal/graphicsdriver: introduce the DirectX driver
...
Closes #1007
2022-03-26 20:09:34 +09:00
Hajime Hoshi
eeb5687b73
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to pointers
...
On second thought, returning pointers is more natural. Handling
nil is a caller's responsibility.
2022-03-24 13:20:36 +09:00
Hajime Hoshi
7bb7e45522
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: change the return type to interface
...
Converting a nil with a pointer type to an interface type is no longer
a nil-nil interface, and then comparing with nil causes an unexpected
results.
2022-03-24 03:24:58 +09:00
Hajime Hoshi
09b0a0ffaf
internal/ui: refactoring: simplify the selection of graphics libraries
2022-03-23 02:21:53 +09:00
Hajime Hoshi
a74e7b1578
Revert "internal/graphicsdriver/metal: refactoring"
...
This reverts commit 1c57393393
.
Reason: nothing is rendered on iOS.
Closes #2022
2022-03-23 01:22:39 +09:00
Hajime Hoshi
cd57bccbfc
internal/graphicsdriver: let some functions return an error
...
This is a preparation for the DirectX driver.
Updates #1007
2022-03-21 22:23:12 +09:00
Hajime Hoshi
2e6bb8c4e2
internal/graphicsdriver/metal: add comments
2022-03-14 22:02:44 +09:00
Hajime Hoshi
7d0f95e9be
internal/graphicsdriver: refactoring: replace Uniform with []float32
...
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
35a5c88901
internal/graphics: rename constants
2022-03-12 04:01:48 +09:00
Hajime Hoshi
6f00221051
internal/shaderir/msl: rename the package name
...
Updates #2010
2022-03-10 16:25:11 +09:00
Hajime Hoshi
47bfd0db9e
internal/shaderir/metal: rename to msl
...
Closes #2010
2022-03-10 00:14:06 +09:00
Hajime Hoshi
c37ffecafd
internal/graphicsdriver/metal: reorder uniform variables
...
This might improve memory allocations.
This makes the code more consistent with HLSL's packing rule [1]
[1] https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules
2022-03-05 22:12:08 +09:00
Hajime Hoshi
d4d4b9c070
internal/graphicsdriver/metal, internal/graphicsdriver/opengl: more efficient modulo
2022-03-04 03:47:55 +09:00
Hajime Hoshi
b22309a0e5
internal/graphicsdriver: replace Pixels with ReadPixels
...
Now preparing a byte slice is the caller's responsibility.
2022-02-27 20:03:13 +09:00
Hajime Hoshi
566957dc1c
internal/graphicsdriver/metal: invert Y at the vertex shader
...
Instead of using a negative height in the viewport, invert the Y direction
at the vertex shader. This is a little more readable as a negative height
is hacky.
This is a preparation for DirectX 12. DirectX 12's coodination system
is very similar to Metal, but doesn't treat a negative height in its
viewport unfortunately.
Updates #1007
2022-02-27 01:53:03 +09:00
divVerent
f2209a0b51
internal/atlas: optimization: send premultiplied alpha from vertex to fragment shader. ( #1996 )
...
Note that this applies only to the builtin shaders - interface for Kage stays
unchanged for compatibility.
Minor compatibility delta: when interpolating alpha values, previous code has
created nonsense values, such as, when interpolating from
fully-transparent-black (0,0,0,0) to opaque-white (1,1,1,1), something like
half-transparent-grey (0.25,0.25,0.25,0.5) where half-transparent-white
(0.5,0.5,0.5,0.5) is used by the new code.
I assume this is a strict improvement, however this may warrant some testing.
Possible later improvement could be moving the premultiplication from fragment
shader to CPU. Did not do this as it makes the code rather inconsistent of Kage
vs built-in shader usage.
Updates #1772
2022-02-24 02:27:50 +09:00
Hajime Hoshi
8b7273b74a
internal/graphicsdriver/metal: call PresentDrawable only when necessary
2022-02-22 01:37:13 +09:00
Hajime Hoshi
ee911fd892
internal/graphicsdriver/metal: fix an error message
2022-02-20 22:01:36 +09:00
Hajime Hoshi
1c57393393
internal/graphicsdriver/metal: refactoring
2022-02-13 01:00:20 +09:00
Hajime Hoshi
162f62f54e
internal/graphicsdriver/metal/mtl: bug fix: test compile error
2022-02-11 23:23:22 +09:00
Hajime Hoshi
176e984a58
internal/ui: refactoring: remove dependency on the package mtl
2022-02-11 23:11:49 +09:00
Hajime Hoshi
6f3c6d6c1b
internal/graphicsdriver/meta: rename function
2022-02-11 22:47:13 +09:00
Hajime Hoshi
cc4e2f08be
internal/graphicsdriver/metal: rename files
2022-02-11 21:49:05 +09:00
Hajime Hoshi
df60c4c92d
internal/driver: rename to internal/graphicsdriver
2022-02-06 20:41:32 +09:00
Hajime Hoshi
d0a6ce6567
internal/graphicsdriver/metal: disable presentsWithTransaction in the fullscreen mode
...
Updates #1745
Closes #1974
2022-01-26 03:55:14 +09:00
Hajime Hoshi
1b498a03cc
Revert "internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS"
...
This reverts commit 1dd13ae06e
.
Reason: This caused FPS drop on macOS 12.0.1
Updates #1885
Closes #1939
2022-01-09 01:02:53 +09:00
Hajime Hoshi
3b0ce21a56
Revert "internal/graphicsdriver: bug fix: render semi-transparent vectors correctly"
...
This reverts commit 202f642395
.
Reason: TestImageEvenOdd failed
Updates #1933
2022-01-06 03:19:46 +09:00
Hajime Hoshi
202f642395
internal/graphicsdriver: bug fix: render semi-transparent vectors correctly
...
Closes #1933
2022-01-06 03:00:25 +09:00
Hajime Hoshi
1dd13ae06e
internal/graphicsdriver/metal: Bug fix: Vsync didn't work on macOS
...
This fix works only for Metal. There is not a good solution for
OpenGL so far unfortunately.
Closes #1885
2021-11-27 02:52:48 +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
7be00d79e8
internal/uidriver/glfw: Fix unstable FPS on fullscreen on macOS
...
FPS was unstable on fullscreen mode i.e., when the view size is the
same as the monitor size.
By using a little different size view, FPS becomes stable.
Updates #1745
2021-09-18 19:22:09 +09:00
Hajime Hoshi
11b9a4b161
internal/graphicsdriver/metal: Refactoring
2021-09-18 17:24:03 +09:00
Hajime Hoshi
65943d4bad
internal/graphicsdriver/metal: Disable presentsWithTransaction on iOS
...
Closes #1799
2021-09-07 00:02:58 +09:00
Hajime Hoshi
58ea710a84
internal/affine: Rename UnsafeElements -> Elements as this is no longer unsafe
2021-09-04 18:08:27 +09:00
Hajime Hoshi
df710a5c63
internal/affine: Change UnsafeElements to take arguments
...
This will enable to suppress unnecessary array allocations in the
future.
Updates #1796
2021-09-04 17:38:30 +09:00
Hajime Hoshi
35deb53624
internal/graphicsdriver/metal: Rename files to remove +build comments
2021-08-23 02:06:09 +09:00
Hajime Hoshi
15ac69b8d5
internal/graphicsdriver/metal: Bug fix: Disable presentsWithTransaction on fullscreen
...
Closes #1745
2021-08-08 17:40:37 +09:00
Hajime Hoshi
ec26b1a43b
internal/graphicsdriver/metal: Refactoring: Remove vsyncInited
2021-08-08 15:30:13 +09:00
Hajime Hoshi
cc1accc32a
internal/uidriver/glfw: Bug fix: Disable vsync when resizing the window
...
Closes #1740
2021-08-06 03:08:04 +09:00
Hajime Hoshi
e4329d0349
internal/driver: Refactoring: Reduce dependencies on affine
2021-07-27 12:19:50 +09:00
Hajime Hoshi
21aa96f9f5
internal/affine: Refactoring: Make ColorM interface
2021-07-27 12:10:22 +09:00
Hajime Hoshi
7e5b259dd2
internal/affine: Use a pointer of an array for UnsafeElements
2021-07-26 21:19:53 +09:00
Hajime Hoshi
b0106e95b9
internal/restorable: Bug fix: Test failed on macOS (Metal)
2021-07-09 20:21:04 +09:00
Hajime Hoshi
4573883b03
internal/graphicsdriver/metal: Make FPS stable by 'presentsWithTransaction'
...
Closes #1196
2021-07-08 18:11:19 +09:00
Hajime Hoshi
ae0e30196b
internal/graphicsdriver/metal: Bug fix: The store action must always be 'store'
...
Closes #1700
2021-07-08 17:39:37 +09:00
Hajime Hoshi
337d8d5113
internal/graphicsdriver/metal: Separate GCing the buffers
...
Updates #1196
2021-07-08 02:10:26 +09:00
Hajime Hoshi
edc2f8b961
internal/graphicsdriver/metal: Delay to get a texture for nextDrawable
...
See https://developer.apple.com/documentation/quartzcore/cametallayer
> To avoid stalls in your app, request a new drawable only when you
> need it, and release any references to it as quickly as possible
> after you’re done with it.
Updates #1196
2021-07-08 01:56:14 +09:00
Hajime Hoshi
b314b6b9b6
Revert "internal/graphicsdriver/metal: Do not retain MTLCommandBuffer for MTLBuffer"
...
This reverts commit e0fbfc2bb0
.
Reason: Rendering issue
Closes #1699
2021-07-08 00:27:33 +09:00
Hajime Hoshi
6213c17abc
internal/driver: Add Graphics.Initialize
2021-07-07 13:58:42 +09:00
Hajime Hoshi
e0fbfc2bb0
internal/graphicsdriver/metal: Do not retain MTLCommandBuffer for MTLBuffer
...
Before this change, a command buffer is retained indirectly by
a buffer, and this might extend the life of drawable unexpectedly.
This change stops using command buffers as a key of the buffers pool,
and use a counter increated by nextDrawable calls.
Updates #1196
2021-07-07 02:52:04 +09:00
Hajime Hoshi
80ac0646d5
internal/graphicsdriver/metal: Optimize the screen writing
2021-07-07 02:07:09 +09:00
Hajime Hoshi
38ce325958
internal/graphicsdriver/metal: Skip clearing the screen on Metal
2021-07-07 01:45:51 +09:00
Hajime Hoshi
9cb1ff9cea
internal/graphicsdriver/metal: Set framebufferOnly true
...
Updates #1196
2021-07-07 00:38:55 +09:00
Hajime Hoshi
bd3f16dbba
internal/graphicsdriver/metal: Change the order of GCed buffers
...
As a big buffer is likely reused, we should remove smaller buffers
first.
Updates #1196
2021-07-06 21:56:27 +09:00
Hajime Hoshi
09bd8b6f4a
internal/graphicsdriver/metal: Remove println
...
Updates #1196
2021-07-06 21:51:57 +09:00
Hajime Hoshi
ee2f891fcc
internal/graphicsdriver/metal: Reuse MTLBuffer objects
...
In Metal, MTLBuffer objects are not 'transient' and are expensive
to create. Reuse them whenever possible.
See also: https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
Updates #1196
2021-07-06 21:48:54 +09:00
Hajime Hoshi
be1a0e90e7
internal/graphicsdriver/metal: Bug fix: TestImageEvenOdd failed
...
RenderCommandEncoder must be reset whenever the stencil mode is
'prepareStencil' in order to clear the stencil buffer.
2021-07-06 15:11:23 +09:00
Hajime Hoshi
3670b7dd62
internal/graphicsdriver/metal: Reuse DepthStencilState objects
...
In Metal, *State objects are not 'transient' and are expensive to
create. Reuse them whenever possible.
See also: https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Cmd-Submiss/Cmd-Submiss.html
2021-07-06 15:10:05 +09:00
Hajime Hoshi
ab26312108
internal/graphicsdriver/metal: Release objects appropriately
2021-07-06 14:20:19 +09:00
Hajime Hoshi
17d8cb5311
internal/graphicsdriver/metal: Bug fix: Crashed with METAL_DEVICE_WRAPPER_TYPE=1
...
Closes #1697
2021-07-06 14:06:06 +09:00
Hajime Hoshi
63a00f6171
internal/graphicsdriver/metal/mtl: Bug fix: Test failure
...
Closes #1696
2021-07-05 21:28:25 +09:00
Hajime Hoshi
674802d2f5
ebiten: Bug fix: Draw commands with EvenOdd should not be merged
...
Updates #1684
2021-07-05 18:08:55 +09:00
Hajime Hoshi
daa883d799
ebiten: Bug fix: Stencil buffers should not be cleared until all the vertices are rendered
...
Updates #1684
2021-07-05 17:41:06 +09:00
Hajime Hoshi
b466a0cbd7
ebiten: Add EvenOdd to DrawTrianglesOptions and DrawShaderTrianglesOptions
...
Updates #844
Closes #1684
2021-07-05 03:35:55 +09:00
Hajime Hoshi
b8bf277825
internal/graphicsdriver/metal/mtl: Add APIs for stencil buffers
...
Updates #1684
2021-07-05 00:11:25 +09:00
Hajime Hoshi
19f034e818
internal/graphicsdriver/metal: Refactoring
2021-07-04 20:35:56 +09:00
Hajime Hoshi
3ec02f767b
internal/graphicsdriver/metal: Refactoring
2021-07-04 18:37:14 +09:00
Hajime Hoshi
7f86761dde
internal/graphicsdriver/metal: Reuse RenderCommandEncoder when possible
2021-07-04 18:13:18 +09:00
Hajime Hoshi
7668052a6b
internal/graphicsdriver/metal: Update the view only when necessary
2021-07-04 17:24:39 +09:00
Hajime Hoshi
6b95dd0d4d
internal/graphicsdriver/metal: Refactoring: Unify two drawTriangles* functions
2021-07-02 00:25:43 +09:00
Hajime Hoshi
e9b6237f61
internal/driver: Refactoring: Merge two Draw* functions
2021-07-01 15:55:48 +09:00
Hajime Hoshi
b9d52c0267
internal/driver: Change InvalidImageID/InvalidShaderID to 0
2021-07-01 14:58:55 +09:00
Hajime Hoshi
73bf1f36e5
internal/driver: Define InvalidImageID / InvalidShaderID
2021-07-01 13:56:42 +09:00
Hajime Hoshi
b54ad73a2b
Add go:build comments with go1.17beta1 fmt
2021-06-11 01:11:46 +09:00
Hajime Hoshi
77b198211c
internal/graphicsdriver/metal: Add a comment
2021-02-27 04:04:25 +09:00
Hajime Hoshi
53352cf2b3
internal/graphicsdriver/metal: Use the smallest temporary texture
...
Updates #1517
2021-02-27 03:45:19 +09:00
Hajime Hoshi
673627c4d4
internal/graphicsdriver/metal: Optimization
2021-02-27 02:30:20 +09:00
Hajime Hoshi
6b3c51921c
internal/driver: Remove Image.Sync
...
Syncing is no longer needed for Metal, and additionally, OpenGL's sync
implementation was mock.
Updates #1508
2021-02-26 23:16:28 +09:00