Commit Graph

6916 Commits

Author SHA1 Message Date
Hajime Hoshi
81b9f91f86 internal/graphicscommand: compile shaders lazily
With DirectX, the graphics driver cannot be determined until the
main loop starts, as a transparent window cannot be treated with
DirectX so far. On the other hand, compiling shaders requires a
graphics driver as it requires information about Y directions of
NDCs and framebuffers.

This change delays compiling shaders until the graphics commands
are actually executed in the main loop.

Updates #1007
Updates #2019
2022-03-21 21:09:02 +09:00
Hajime Hoshi
e21636fbb9 internal/graphicscommand: clear the queue regardless of an error
There was a potential issue that commands in the queue are never
reset when an error happens and the queue continues to send errors.
This is problematic especially for testings.

This change fixes the issue by Go's defer.
2022-03-21 20:10:03 +09:00
Hajime Hoshi
ad0e0e3e66 internal/graphicscommand: remove an unused member 2022-03-21 19:50:05 +09:00
Hajime Hoshi
9b1adf799d internal/shader: move syntax tests to internal/shader 2022-03-21 19:31:06 +09:00
Hajime Hoshi
b5bb576a58 internal/ui: refactoring: unexport ConvertUniforms 2022-03-21 17:05:50 +09:00
Hajime Hoshi
f4ad12987d internal/ui: bug fix: compile error with the cbackend tag 2022-03-21 16:59:53 +09:00
Hajime Hoshi
12ce5ae83a internal/ui: remove the call of graphicsDriver() from the context 2022-03-21 16:48:33 +09:00
Hajime Hoshi
fc96eb30a1 internal/atlas: simplify the logic by adding paddings to the mask 2022-03-21 16:13:21 +09:00
Hajime Hoshi
870a18e8f5 internal/buffered: remove unnecessary conditions from resolvePendingPixels 2022-03-21 15:27:21 +09:00
Hajime Hoshi
4b31983b6d internal/buffered: English 2022-03-21 15:20:52 +09:00
Hajime Hoshi
c316aaae72 internal/buffered: simplify the API 2022-03-21 15:19:06 +09:00
Hajime Hoshi
5c3f8915d1 internal/atlas: add an argument check 2022-03-21 15:11:38 +09:00
Hajime Hoshi
29f7a45ccc internal/buffer: remove the graphics-driver argument from ReplacePartialRegionPixels
This is necessary to remove the graphics driver usage from
(*ebiten.Image).At. And this is necessary to determine the graphics
driver after the window becomes transparent or not.

Unfortunately, it is not obvious to make a transparent window with
DirectX. Then, the determination of a graphics driver should be delayed.

Updates #1007
2022-03-21 05:59:43 +09:00
Hajime Hoshi
4f070915b2 internal/atlas: bug fix: do not use the padding when a mask is specified
With paddings, a mask size was not appropriate.

As a simple solution, let's not use paddings when a mask is specified.
2022-03-21 05:50:31 +09:00
Hajime Hoshi
dfc9eeaaec internal/restorable: bug fix: the parameter mask was not passed correctly 2022-03-21 05:40:13 +09:00
Hajime Hoshi
fbcbd2a001 internal/buffered: refactoring 2022-03-21 04:36:32 +09:00
Hajime Hoshi
b3f4d6c522 internal/atlas: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:56:04 +09:00
Hajime Hoshi
5c79b86412 internal/restorable: add a new parameter specifying a mask for ReplacePixels 2022-03-21 03:08:58 +09:00
Hajime Hoshi
e55dbbf3cd internal/restorable: add more tests 2022-03-21 03:04:52 +09:00
Hajime Hoshi
72a6ab8da4 internal/restorable: add more tests 2022-03-21 02:44:48 +09:00
Hajime Hoshi
924f7ea932 internal/restorable: refactoring 2022-03-21 01:26:48 +09:00
Hajime Hoshi
5fe6791b5d internal/graphicscommand: add a new paramter 'mask' to ReplacePixels 2022-03-21 01:11:01 +09:00
Hajime Hoshi
c1a0d83f8d internal/restorable: simplify the implementation of rect
Allow overlapped regions at pixelsRecords.

This removes the members `last*` for caching. These were introduced
at 7e7751bd43, and apparently these
are no longer needed.
2022-03-21 00:06:30 +09:00
Hajime Hoshi
ea81d4abf4 internal/buffered: refactoring 2022-03-20 19:03:41 +09:00
Hajime Hoshi
14c327c89b internal/atlas: replace Pixels with At to reduce unnecessary slice allocations 2022-03-20 18:39:17 +09:00
Hajime Hoshi
11ff0ab48c internal/atlas: refactoring: remove arguments from Pixels 2022-03-20 18:28:57 +09:00
Hajime Hoshi
367a9ec5bf internal/atlas: refactoring 2022-03-20 18:07:29 +09:00
Hajime Hoshi
54b4e87506 internal/restorable: bug fix: ReplacePixels on a sub-image might panic on Android
If regions by ReplacePixel are overlapped, this can panics. This can
happen only on Android, where a context lost can happen.

Thus, a sub-image cannot call a direct ReplacePixels. internal/buffer
has to care this.
2022-03-20 18:01:37 +09:00
Hajime Hoshi
696bbc088f internal/ui: rename variables 2022-03-20 16:51:23 +09:00
Hajime Hoshi
c3e855ab02 internal/buffered: refactoring 2022-03-20 16:44:11 +09:00
Hajime Hoshi
673556d03f internal/ui: move the error handlings to the ui package 2022-03-20 16:26:26 +09:00
Hajime Hoshi
bd07f6246f internal/buffered: remove mysterious comments 2022-03-20 05:17:43 +09:00
Hajime Hoshi
cc574ad67e internal/atlas: rename functions: Area -> Region 2022-03-20 04:20:23 +09:00
Hajime Hoshi
b59dd45239 internal/buffered: separate ReplacePixels with the large-area and small-area versions
For the large-area version, this doesn't require a graphics driver.
This is necessary to ensure that ReplacePixels never needs a graphics
driver.
2022-03-20 04:13:31 +09:00
Hajime Hoshi
4cbce71b2b internal/graphicscommand: move the choice of graphics drivers to internal/ui 2022-03-20 02:51:31 +09:00
Hajime Hoshi
1d9982ee6d internal/ui: move the dependency on graphicscommand from ebiten to ui 2022-03-20 02:00:44 +09:00
Hajime Hoshi
e78f34aa26 internal/ui: add Image
This is a preparation for a refactoring. Image will be a proxy to
pass a graphics driver to the lower layer.
2022-03-20 01:39:05 +09:00
Hajime Hoshi
3e44a20b22 internal/graphicscommand: swap arguments 2022-03-20 00:09:17 +09:00
Hajime Hoshi
8e3576b404 internal/mipmap: remove unused functions 2022-03-19 23:45:15 +09:00
Hajime Hoshi
7c2300b352 internal/graphicscommand: reduce the usages of the graphicsDriver function 2022-03-19 23:03:34 +09:00
Hajime Hoshi
839e442412 .github/workflow: add a test for internal/shader on Windows
This also required to configure Git for Windows.
2022-03-18 21:43:09 +09:00
Hajime Hoshi
58366ce64d internal/glfw: make the file operation atomic
If multiple Ebiten processes start at the same time, the file operation
can cause a race condition. Add a file lock to avoid this.
2022-03-18 20:32:25 +09:00
Hajime Hoshi
f60134bf6a .github/workflow: bug fix 2022-03-18 19:46:03 +09:00
Hajime Hoshi
cdd46912dc .github/workflow: clean up the YAML 2022-03-18 19:45:14 +09:00
Hajime Hoshi
c3b712a54e add Go 1.18 for testing 2022-03-16 03:00:22 +09:00
Hajime Hoshi
2e6bb8c4e2 internal/graphicsdriver/metal: add comments 2022-03-14 22:02:44 +09:00
Hajime Hoshi
82fcff9549 update Oto to v2.1.0-alpha.8 2022-03-14 13:03:50 +09:00
Hajime Hoshi
a617576879 internal/shaderir: replace Mul with ComponentWiseMul and MatrixMul
This is a preparation for DirectX / HLSL.

Updates #1007
2022-03-13 19:17:46 +09:00
Hajime Hoshi
044d41dd2d internal/shaderir: change Op from string to int
This is a preparation to distinguish Hadamard product and matrix
product for HLSL.

Updates #1007
2022-03-13 16:20:04 +09:00
Hajime Hoshi
7d0f95e9be internal/graphicsdriver: refactoring: replace Uniform with []float32
Closes #2016
2022-03-13 03:42:13 +09:00