Commit Graph

108 Commits

Author SHA1 Message Date
Hajime Hoshi
7e32075abd jsutil: Avoid creating Uint8Array when copying bytes from Go to JS
Updates #1435
2020-12-16 01:50:05 +09:00
Hajime Hoshi
49b86843c3 jsutil: Avoid creating Uint8Array at TemporaryUint8Array
Updates #1435
2020-12-16 01:21:13 +09:00
Hajime Hoshi
146357c298 jsutil: Enable to specify length at Uint8ArrayToSlice 2020-12-15 01:13:15 +09:00
Hajime Hoshi
e5c1151cc5 jsutil: Avoid creating Float32Array at TemporaryFloat32Array
Updates #1435
2020-12-15 00:40:43 +09:00
Hajime Hoshi
f440e368b3 graphicsdriver/opengl: Use WebGL2 API on go2cpp 2020-12-14 02:02:45 +09:00
Hajime Hoshi
66d12722ae graphicsdriver/opengl: Remove comments 2020-12-06 03:24:08 +09:00
Hajime Hoshi
2c31156a34 graphicsdriver/opengl: Reduce allocations of Float32Array on go2cpp
Updates #1426
2020-12-06 03:23:09 +09:00
Hajime Hoshi
d4a2433643 Revert "graphicsdriver/opengl: Reduce creation of Float32Array"
This reverts commit 3c28bcf3c4.

Reason: Tests failed: https://github.com/hajimehoshi/ebiten/runs/1496602911
2020-12-04 12:10:15 +09:00
Hajime Hoshi
3c28bcf3c4 graphicsdriver/opengl: Reduce creation of Float32Array
Updates #1426
2020-12-02 22:58:36 +09:00
Hajime Hoshi
44e2455c65 graphicsdriver/opengl: Avoid unnecessary creation of Uint16Array/Float32Array
Updates #1426
2020-12-02 20:40:28 +09:00
Hajime Hoshi
5897e1ab7c Implement some preparation code for go2cpp
Updates #744
2020-11-30 23:18:42 +09:00
Hajime Hoshi
912e13071f graphicsdriver/opengl: Refactoring 2020-11-29 23:04:00 +09:00
Hajime Hoshi
526a92256b graphicsdriver/opengl: Refactoring: Remove shaderType 2020-11-21 23:33:25 +09:00
Hajime Hoshi
8dba7b7722 graphicsdriver/opengl: Refactoring: Remove dataType 2020-11-21 23:14:43 +09:00
Hajime Hoshi
9c014a281a graphicsdriver/opengl: Refactoring 2020-11-21 23:00:57 +09:00
Hajime Hoshi
859d247093 graphicsdriver/opengl: Refactoring 2020-11-21 22:49:49 +09:00
Hajime Hoshi
ddc8115b51 graphicsdriver/opengl: Refactoring: remove ensureGL 2020-11-21 22:09:58 +09:00
Hajime Hoshi
b1d7a5f595 shaderir/glsl: Enable dFdx for WebGL
With WebGL1, an extension is required for dFdx. On the other hand,
with WebGL2, GLSL ES 300 is required and the extension is forbidden.
This change fixes shaderir/glsl to switch the output depends on the
WebGL version.

This change also adds a new build tag 'ebitenwebgl1' forcing WebGL 1.

Updates #1404
2020-11-21 19:07:54 +09:00
Hajime Hoshi
2097312a8b graphicsdriver/opengl: Refactoring 2020-11-21 16:44:49 +09:00
Hajime Hoshi
4df958c9fd Avoid comparing to js.Undefined() for consistency 2020-11-21 14:25:17 +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
86a0c7aa82 graphicsdriver/opengl: Use PBO when retrieving pixels 2020-11-13 09:10:56 +09:00
Hajime Hoshi
99b4a3096a graphicsdriver/opengl: Use Go const values instead of getting them dynamically 2020-11-08 19:23:32 +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
eed619ad0f graphicsdriver/metal, graphicsdriver/opengl: Reland: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 02:46:31 +09:00
Hajime Hoshi
713eee1117 Revert "graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance"
This reverts commit 2942f10d9d.

Reason: Compile error on mobiles and runtime error on browsers
2020-10-13 02:12:02 +09:00
Hajime Hoshi
2942f10d9d graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 01:50:54 +09:00
Hajime Hoshi
7a0e31a23a Clean up the 'js' build tags
Updates #1129
2020-10-07 01:33:10 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
38dcadb233 graphicsdriver/opengl: Add program error info to the error 2020-08-01 18:58:05 +09:00
Hajime Hoshi
073fd329f2 graphicsdriver/opengl: Enable to pass any type of uniform variables
Updates #1274
2020-08-01 05:11:24 +09:00
nanoslayer
72babcd420
ebiten: Add CompositeModeMultiply (#1251)
This change adds a new composite mode called `CompositeModeMultiply`,
which multiplies the source color with the destination color.

This is tested on Linux and Windows only.

Fixes #410
2020-07-18 21:37:17 +09:00
Hajime Hoshi
2bdef2e8c4 restorable: Add an explicit way to detect context-lost
isTexture was used to detect context-lost and called every frame.
This was not good for performance.

This change adds a way to notify context-lost from the WebGL
handlers directly, and the package restorable uses it instead of
calling (*Image).isInvalaidated.

Fixes #1175
2020-05-30 20:29:15 +09:00
Hajime Hoshi
1c980a16f5 graphicsdriver/opengl: Ignore non-existent uniform locations
Shader users should not have to care about the existence of uniform
variables.

Updates #1168
2020-05-27 11:39:11 +09:00
Hajime Hoshi
7f2092f964 graphicsdriver/opengl: Enable to bind multiple textures (in theory) 2020-05-17 23:57:42 +09:00
Hajime Hoshi
7b77164710 restorable: Ignore the error when restoring failed due to being not ready
(driver.Graphics).BeginFrame tries to restore the images, but
the context might be lost at that time yet. If the attempt to
restore the context because the driver is not ready, return
silently.

Fixes #1133
2020-04-12 20:01:18 +09:00
Hajime Hoshi
e66f1fb71e graphicsdriver/opengl: Use glBufferSubData instead of glTexSubImage2D on browsers
Updates #988
2020-01-02 16:27:51 +09:00
Hajime Hoshi
85cbc7e56b Enable to compile Ebiten on js/wasm with Go 1.14
Fixes #1024
2019-12-19 00:45:53 +09:00
Hajime Hoshi
4120e868be graphicsdriver/opengl: Remove unused functions 2019-11-17 05:10:22 +09:00
Hajime Hoshi
acc933b7c3 graphicsdriver/opengl: Experimental PBO implementation
This change is an experimental implementation to use Pixel Buffer
Objects. This reduces calls of glTexSubImage2D.

This works only on desktops. Unfortunately WebGL does not have
this features. Mobiles can have PBO as of OpenGL ES 3.

Updates #976
2019-11-17 05:01:43 +09:00
Hajime Hoshi
3c29fbdce2 jsutil: Refactoring: SliceToTypedArray -> CopySliceToJS
This unifieslocations of the temporary buffer.
2019-10-30 00:35:48 +09:00
Hajime Hoshi
899fc38d23 Add wasm test with wasmbrowsertest
Fixes #881
2019-09-23 02:45:37 +09:00
Hajime Hoshi
f40798b586 graphics: Move const definitions to driver package
Let's keep 'graphics' package as a package for utility functions
or testable functions as much as possible.
2019-06-26 01:05:13 +09:00
Hajime Hoshi
9bff33472a driver: Add (Graphics).HasHighPrecisionFlaot
This enables to determine whether vertices should be adjusted or
not.

Fixes #879
2019-06-22 14:57:53 +09:00
Hajime Hoshi
c52e043006 Add jsutil package for new API of Go 1.13
Audio part still cannot be compiled due to Oto.

Fixes #878
2019-06-15 00:49:57 +09:00
Hajime Hoshi
9b82ec41de graphicsdriver/opengl: Refactoring: Remove unused variables 2019-06-04 02:11:14 +09:00
Hajime Hoshi
fcb5554aa1 driver: Add Graphics.NeedsRestoring 2019-05-26 19:46:12 +09:00
Hajime Hoshi
10fb5e33be Replace GopherWasm with syscall/js
Fixes #857
2019-05-01 17:28:00 +09:00
Hajime Hoshi
09ca873c41 graphicsdriver/opengl: Use glBindAttribLocation instead of glGetAttribLocation
Attribute variables are often optimized out and it is really hard
to prevent this.

Instead of implicit indices of attribute variables, use explicit
indices by glBindAttribLocation.

Bug: #816
2019-02-16 14:35:53 +09:00
Hajime Hoshi
7ff99d3965 graphicsdriver/opengl: Remove glGetError calls
As glGetError doesn't tell where the error happens, this is not
useful.

Fixes #815
2019-02-16 10:00:27 +09:00
Hajime Hoshi
6c4260d0e1 Revert "graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D"
This reverts commit f5044f3d8f.

Reason: This doesn't work on some iOS machines
2019-02-12 03:34:06 +09:00
Hajime Hoshi
f5044f3d8f graphicsdriver/opengl: Use GL_RGBA8 as the internal format at glTexImage2D
Related: #810
2019-02-09 21:27:46 +09:00
Hajime Hoshi
a3eddeb50f Improve panic messages 2019-02-06 23:43:03 -10:00
Hajime Hoshi
5be567d58f ui: Implement restoring context lost on browsers correctly
Fixes #734
2019-02-01 01:20:40 +09:00
Hajime Hoshi
99e4c874fe Reduce init functions
This mitigates the init-order issue on jsgo.io.
2018-12-26 02:13:47 +09:00
Hajime Hoshi
de788603d6 graphicsdriver/opengl: Remove init order dependency 2018-12-25 23:58:01 +09:00
Hajime Hoshi
7e363a6f3b graphicsdriver/opengl: Unexport Context 2018-11-11 01:19:11 +09:00
Hajime Hoshi
241716d0e6 Add package graphicsdriver; Move opengl to graphicsdriver/opengl 2018-11-10 22:52:37 +09:00