Commit Graph

87 Commits

Author SHA1 Message Date
Hajime Hoshi
34e23f5256 internal/restorable: treat texels instead of pixels
Updates #1820
2022-04-02 04:25:27 +09:00
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
5fe6791b5d internal/graphicscommand: add a new paramter 'mask' to ReplacePixels 2022-03-21 01:11:01 +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
7c2300b352 internal/graphicscommand: reduce the usages of the graphicsDriver function 2022-03-19 23:03:34 +09:00
Hajime Hoshi
7d0f95e9be internal/graphicsdriver: refactoring: replace Uniform with []float32
Closes #2016
2022-03-13 03:42:13 +09:00
Hajime Hoshi
4ca1220671 internal/graphicscommand: bug fix: compile error, test failures 2022-02-27 20:13:21 +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
df60c4c92d internal/driver: rename to internal/graphicsdriver 2022-02-06 20:41:32 +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
60b8f82bfd graphicscommand: Dump internal image info on the debug mode
Closes #1714
2021-08-05 01:16:42 +09:00
Hajime Hoshi
18903db1c6 internal/atlas: Bug fix: Unexpected padding in screenshots
Closes #1736
2021-07-29 16:09:29 +09:00
Hajime Hoshi
21aa96f9f5 internal/affine: Refactoring: Make ColorM interface 2021-07-27 12:10:22 +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
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
Hajime Hoshi
ed494dbf59 restorable: Reland: Do not record pixels if restoring is not requried
This change also remove the restrictions of operations on
graphicscommand.Image. For example, now DrawTriangles and
ReplacePixels can be mixed on the same image.

Fixes #1022
2020-11-14 15:00:16 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
a8f96ee9af graphicsdriver/metal: Add Sync to sync CPU and GPU asynchronously
Fixes #1414
2020-11-07 04:09:47 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
f3ef2e2af5 Performance optimization for the path without a shader
Fixes #1355
2020-09-21 05:43:24 +09:00
Hajime Hoshi
64a6b39240 Revert "restorable: Do not record pixels if restoring is not requried"
This reverts commit 5e1f263d6d.

Reason: Issue #1304
2020-08-17 00:00:12 +09:00
Hajime Hoshi
5e1f263d6d restorable: Do not record pixels if restoring is not requried
Fixes #1022
2020-08-16 20:07:17 +09:00
Hajime Hoshi
b4046a795e graphics: Reduce the usage of InternalImageSize 2020-08-08 16:01:33 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
b83f0acc4d Remove source-region information from vertices
Fixes #1210
2020-07-02 23:38:39 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
dea3785750 shareable, restorable, graphicscommand: Remove making arrays at DrawTriangles
Updates #1220
2020-06-29 13:37:37 +09:00
Hajime Hoshi
2f843c49a6 shader: Fix the case when the source image is nil for shaders 2020-06-04 01:35:35 +09:00
Hajime Hoshi
f80719ef9a driver: Use slices for uniform variables instead of maps
Fixes #1172
2020-05-26 23:50:11 +09:00
Hajime Hoshi
85730b433e graphicsdriver: Bug fix: Pass texture natives as uniform variables correctly 2020-05-25 02:31:54 +09:00
Hajime Hoshi
c5aba02723 graphicscommand: Update comments 2020-05-24 16:54:28 +09:00
Hajime Hoshi
6506c20f4e graphicscommand: Use an image in the uniform variables 2020-05-24 16:43:08 +09:00
Hajime Hoshi
968c0a9b9a graphicscommand: Bug fix: test failures 2020-05-24 03:04:52 +09:00
Hajime Hoshi
a4d419bab1 graphicscommand: Merge DrawTriangles and DrawShader 2020-05-24 02:36:09 +09:00
Hajime Hoshi
1a0d92267b driver: Add shader API and implement it on OpenGL
Updates #482
2020-05-23 22:09:12 +09:00
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
46601bb516 graphics: Fill the screenshot in black when the screen is not transparent
Fixes #997
2020-02-06 03:08:16 +09:00
Hajime Hoshi
b3bdf51905
graphicscommand: Return the error immediately (#1060)
Now grpahicscommand saves the error and shows the error after a
while. This was good to simplify the API but was the cause to hide
some issues.

This change fixes all the errors to be returned immediately, and
buffer this in the ebiten package instead.

Fixes #971
2020-01-19 01:18:56 +09:00
Hajime Hoshi
65fdf48cbf graphicsdriver: Refactoring: ReplacePixels takes multiple arguments
This reduces the number of graphics commands, and this works more
efficiently if the driver has an efficient way.
2019-11-21 23:52:12 +09:00
Hajime Hoshi
e42cff071c restorable: Merge two 'copy' into one
Fixes #983
2019-11-16 02:10:53 +09:00
Hajime Hoshi
aa6fc67736 Revert "graphics: Avoid all copying pixels"
This reverts commit c60a32a479.

Reason: This breaks backward comptibility and it was not obvious how to fix examples.
2019-11-16 02:04:46 +09:00
Hajime Hoshi
c60a32a479 graphics: Avoid all copying pixels
This is a breaking change: ReplacePixels now takes the ownership
of the given pixels.

Fixes #983
2019-11-16 01:51:36 +09:00
Hajime Hoshi
f1091910bd Revert "graphicscommand: Remove copying pixels"
This reverts commit 339a96b7e6.

Reason: this causes panic on extending textures
2019-11-16 00:43:22 +09:00
Hajime Hoshi
339a96b7e6 graphicscommand: Remove copying pixels
Now ReplacePixels takes the ownership.

Updates #983
2019-11-16 00:29:37 +09:00
Hajime Hoshi
f873b66267 graphicscommand: Reduce calling InternalWidth/InternalHeight 2019-09-28 23:03:11 +09:00
Hajime Hoshi
70a38dc09a graphicscommand: Move pixel->texel conversion to graphicscommand 2019-09-20 23:59:04 +09:00
Hajime Hoshi
915ed91f25 restorable: Remove (*Image).PutVertices 2019-09-20 23:44:09 +09:00