Hajime Hoshi
1799ed0b28
add a build tag 'ebitencbackend' and internal/cbackend
...
This enables to create a C archive with Ebiten without an actual driver
implementation. This enables Ebiten work on a platform Go doesn't support.
See also Hitsumabushi project: github.com/hajimehoshi/hitsumabushi.
The backend C API is not stable and might change later. Then, the build
tag 'ebitencbackend' is not documented on purpose.
Closes #1900
2021-12-22 21:12:48 +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
00e2b15e2a
shaderir: Bug fix: A wrong argument for fmt.Sprintf
...
This change also improves the result of espcae analysis.
Closes #1863
2021-11-02 00:05:07 +09:00
Hajime Hoshi
7661147e31
internal/graphicsdriver/opengl: Avoid allocations by escaping to heap
2021-10-31 22:34:14 +09:00
Hajime Hoshi
15f62bfeb5
internal/graphicsdriver/opengl: Optimization: Cache texture variable names
2021-10-31 05:40:44 +09:00
Hajime Hoshi
9d51356eef
internal/graphicsdriver/opengl: Optimization
2021-10-31 05:17:23 +09:00
Hajime Hoshi
b74a4a0275
internal/graphicsdriver/opengl: Optimization: Avoid heap allocations
2021-10-31 02:10:44 +09:00
Hajime Hoshi
7b7791156c
internal/graphicsdriver/opengl: Remove unreached return
2021-10-31 01:38:01 +09:00
Hajime Hoshi
98083ccd0a
internal/graphicsdriver/opengl: Avoid heap allocation of a local variable
...
If a variable is passed to an argument interface{}, the variable might be
allocated on the heap unexpectedly.
2021-10-31 01:11:12 +09:00
Hajime Hoshi
a082db04fd
internal/jsutil: Optimization: Avoid using empty interface{} conversions
2021-10-30 18:53:21 +09:00
Hajime Hoshi
a826ecb29b
internal/jsutil: Move a function to internal/graphicsdriver/opengl
2021-10-30 18:33:43 +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
1f82bb297c
internal/graphicsdriver/opengl: Optimization: Avoid the empty interface
2021-10-30 02:28:57 +09:00
Hajime Hoshi
60f2c7ace6
internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame (uniform variables)
2021-10-30 00:22:31 +09:00
Hajime Hoshi
b4f45edff8
internal/graphicsdriver/opengl: Optimization: Avoid creating slices for every frame
2021-10-30 00:13:57 +09:00
Hajime Hoshi
76324254c1
internal/graphicsdriver/opengl: Avoid creating objects for debugging
2021-10-30 00:04:03 +09:00
Hajime Hoshi
d3ac199aa9
internal/graphicsdriver/opengl: Optimization: Avoid fmt.Sprintf
2021-10-29 21:43:40 +09:00
Hajime Hoshi
3c1f8da7f8
internal/graphicsdriver/opengl: Optimization: Avoid interface conversion
2021-10-29 21:35:40 +09:00
Hajime Hoshi
99bfdef416
internal/graphicsdriver/opengl/gl: Support OpenBSD
2021-10-24 15:09:16 +09:00
Hajime Hoshi
ef62f407d1
Clean up build tags
2021-10-24 15:05:36 +09:00
Hajime Hoshi
878831b842
internal/graphicsdriver/opengl: Bug fix: compile error
2021-10-24 14:55:50 +09:00
Hajime Hoshi
a5198275fa
internal/graphicsdriver/opengl/gl: Remove an unused file
2021-10-24 14:46:38 +09:00
Hajime Hoshi
3f5d1762bb
internal/graphicsdriver/opengl: Return an error when initializing OpenGL fails
...
Updates #1838
2021-10-06 00:38:47 +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
d1c764640d
internal/glfw, internal/graphicsdriver/opengl/gl: Use the last byte to detect a bool
...
When a C function returns a bool value, only the first byte of a
uintptr value matters. When we want to get a bool value from a C
function, filter this for sefety.
2021-08-25 02:09:55 +09:00
Hajime Hoshi
35deb53624
internal/graphicsdriver/metal: Rename files to remove +build comments
2021-08-23 02:06:09 +09:00
Hajime Hoshi
6c8a7d1079
internal/graphicsdriver/opengl: Bug fix: A location cache map must be reset when a program is deleted
...
Closes #1753
2021-08-15 04:54:20 +09:00
Hajime Hoshi
da08577095
internal/graphicsdriver/opengl: Refactoring
2021-08-14 04:05:18 +09:00
Hajime Hoshi
ce8fc39451
internal/graphicsdriver/opengl: Bug fix: the current program must be reset
...
Updates #1751
2021-08-13 23:44:30 +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
8967384dac
internal/graphicsdriver: Bug fix: getting a WebGL2 context might fail even though WebGL2RenderingContext exists
...
Closes #1738
2021-08-01 22:00:47 +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
50d2d7ed61
internal/graphicsdriver/opengl: Remove unused code using PBO
...
Updates #1678
2021-07-14 21:51:27 +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