Hajime Hoshi
f4a1f90d92
graphicsdriver/opengl/gl: Reduce reflect usage
2020-05-17 14:28:13 +09:00
Hajime Hoshi
8029dc352a
driver: Use framebuffer's Y directions
2020-05-08 16:49:19 +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
eabe4152a7
graphicsdriver/opengl: Rename Driver -> Graphics
2020-04-04 17:23:38 +09:00
Hajime Hoshi
b4a9538e1d
graphicsdriver/opengl/gl: Remove a misspelled unused const
2020-02-26 12:06:47 +09:00
Hajime Hoshi
59431e1cad
graphicsdriver/opengl: Leave comments why we don't use PBO on Android
...
Unfotunately, PBO might slow Android applications expecially when
coming back from context lost. Ebiten sends a lot of draw calls to
replace pixels in such case.
Until we find a good solution, let's not use PBO on Android.
Fixes #988
2020-01-19 17:02:34 +09:00
Hajime Hoshi
6eb05a0203
graphicsdriver/opengl: Enable to compile with gldebug
2020-01-13 18:55:30 +09:00
Hajime Hoshi
9be3495077
driver: Remove Graphics.SetWindow
...
Fixes #1026
2020-01-03 19:04:48 +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
de48a13a6e
graphicsdriver/opengl/gl: Remove unused functions
2020-01-02 00:17:39 +09:00
Hajime Hoshi
38815ba801
graphicsdriver/opengl: Use glBufferSubData instead of glMapBuffer
...
We have confirmed that this does not slow down ReplacePixels.
Fixes #993
Fixes #1040
2020-01-02 00:01:27 +09:00
Hajime Hoshi
51f4ba1320
graphicsdriver/opengl: Refactoring
2020-01-01 01:57:12 +09:00
Hajime Hoshi
815afe6670
graphicsdriver/opengl: Reduce calls of glBindTexture
2020-01-01 01:39:45 +09:00
Hajime Hoshi
8285fbfac9
graphicsdriver/opengl: Add error checks
2019-12-31 04:22:28 +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
a3343afc36
graphicsdriver/opengl/gl: Use pkg-config instead of LDFLAGS
...
Updates #1012
2019-12-11 03:00:25 +09:00
Hajime Hoshi
c9bc5913fd
driver: Refactoring: Remove Graphics.Flush
...
Updates #226
2019-12-06 08:56:55 +09:00
Hajime Hoshi
0ec447e0d0
ui: Add SetScreenTransparent / IsScreenTransparent
...
Fixes #1001
2019-12-01 03:31:32 +09:00
Hajime Hoshi
a040aae83b
glfw: Update to GLFW 3.3
...
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
21ba42325c
graphicsdriver/opengl: Use smaller PBOs
2019-11-24 18:32:35 +09:00
Hajime Hoshi
78e912e30b
graphicsdriver/opengl: Fix comments
2019-11-24 18:11:45 +09:00
Hajime Hoshi
3d3a1be1c4
graphicsdriver/opengl: Use glTexSubImage2D instead of glTexImage2D
2019-11-24 18:07:21 +09:00
Hajime Hoshi
9f483ddc60
graphicsdriver/opengl: Adopt WRITE_ONLY for PBOs
...
It looks like it is safe to use WRITE_ONLY:
https://stackoverflow.com/questions/30248594/write-only-glmapbuffer-what-if-i-dont-write-it-all
2019-11-24 17:42:28 +09:00
Hajime Hoshi
4c4f67197f
graphicsdriver/opengl/gl: Bug fix: compile error on non-Windows (again)
2019-11-24 03:05:14 +09:00
Hajime Hoshi
ac6a3f0900
graphicsdriver/opengl/gl: Bug fix: compile error on non-Windows
2019-11-24 02:02:40 +09:00
Hajime Hoshi
0ef8009c11
graphicsdriver/opengl: Use uintptr whenever possible instead of unsafe.Pointer
2019-11-20 02:00:02 +09:00
Hajime Hoshi
4296c11256
graphicsdriver/opengl: Refactoring
2019-11-24 00:08:38 +09:00
Hajime Hoshi
3df198f68e
graphicsdriver/opengl: Use GL_READ_WRITE at glMapBuffer
...
Updates #993
2019-11-22 00:27:20 +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
161771cc99
graphicsdriver/opengl: Refactoring
2019-11-20 12:23:45 +09:00
Hajime Hoshi
52f6be2639
graphicsdriver/opengl: Fix suspicious GL function calls
...
Before this change, the pixel object buffer is unbound just after
getting a pointer by glMapBuffer. This seemed suspicious.
This change fixes to do all pixel manipulations once between
glMapBuffer and glUnmapBuffer without changing a bound buffer.
This might fix a wrong rendering on some machines, but I am not
sure.
Updates #993
2019-11-20 02:41:34 +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
8c54cf639a
graphicsdriver/opengl: Reduce glFlush calls
...
Fixes #981
2019-11-14 01:21:08 +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
4088de5349
graphicsdriver/opengl/gl: Fix go-vet errors on Windows
...
Updates #889
2019-10-06 23:19:59 +09:00
Hajime Hoshi
3a0f8655e6
graphicsdriver/opengl/gl: Indentation
2019-10-06 23:02:15 +09:00
Hajime Hoshi
378be6be80
graphicsdriver/opengl/gl: Remove unused functions
...
This improves `go vet` results.
Updates #889
2019-10-06 22:49:38 +09:00
Hajime Hoshi
0d56207672
graphicsdriver/opengl/gl: Remove unnecessary consts
2019-10-06 04:27:57 +09:00
Hajime Hoshi
38ee9113ee
graphicsdriver/opengl/gl: Remvoe PtrOffset
...
Updates #889
2019-10-01 01:48:42 +09:00
Hajime Hoshi
899fc38d23
Add wasm test with wasmbrowsertest
...
Fixes #881
2019-09-23 02:45:37 +09:00
Hajime Hoshi
33c7f39f0f
graphicsdriver/opengl/gl: Exclude all the files for Wasm
...
Fixes #938
2019-09-23 00:42:54 +09:00
Hajime Hoshi
3a0dbd3977
graphicsdriver/opengl: Use sync.Once for concurrent safety
2019-07-04 01:15:51 +09:00
Hajime Hoshi
6b7f21f0c8
driver: Add Graphics.MaxImageSize and use it
...
There are some devices that cannot accept 4096x4096 pixels
textures. Get the maximum size and use it.
Fixes #892
2019-07-04 01:10:11 +09:00
Hajime Hoshi
480c5527a3
ui/mobile: Move 'DoWork' logic to ui/mobile package
...
This simplifies driver.Graphics interface, and will make it easy
to use another graphics driver than OpenGL.
2019-06-27 00:32: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
1e93d9c699
graphicsdriver/opengl: Use context.Context when possible
2019-06-08 01:30:15 +09:00
Hajime Hoshi
85dcafe176
thread: Rename Run -> Call
2019-06-06 00:25:57 +09:00
Hajime Hoshi
15a5896efd
thread: Rename mainthread -> thread and add struct Thread
...
This enables thread available not only for the main thread but also
any threads.
This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.
Updates #737
2019-06-06 00:25:53 +09:00
Hajime Hoshi
9b82ec41de
graphicsdriver/opengl: Refactoring: Remove unused variables
2019-06-04 02:11:14 +09:00
Hajime Hoshi
ca907e2846
uidriver/mobile: Refactoring
2019-06-01 00:21:59 +09:00
Hajime Hoshi
fcb5554aa1
driver: Add Graphics.NeedsRestoring
2019-05-26 19:46:12 +09:00
Acid147
21abd85a63
Small cleanup ( #877 )
...
* Remove unused variables and constants
* Remove redundant return statement
* Change flock.NewFlock to flock.New
2019-05-26 18:06:43 +09:00
Hajime Hoshi
10fb5e33be
Replace GopherWasm with syscall/js
...
Fixes #857
2019-05-01 17:28:00 +09:00
Hajime Hoshi
a064955a13
graphicsdriver/metal: Use NSAutoreleasePool to release drawable correctly
...
Fixes #847
2019-04-20 15:20:38 +09:00
Hajime Hoshi
7445144194
Move graphicsdriver.GrapahicsDriver to driver.Graphics
2019-03-30 22:38:02 +09:00
Hajime Hoshi
0bf911905a
Revert "graphicsdriver/opengl: Call glFinish before glReadPixels"
...
This reverts commit 04dc1faa9c
.
Reason: True fix for #814 is 82178794c3
2019-02-19 10:55:06 +09:00
Hajime Hoshi
84b1c282ff
graphicsdriver/opengl: Refactoring by reduing unused variables
2019-02-17 20:22:03 +09:00
Hajime Hoshi
3aa6eb3a66
graphicsdriver: Optimize shaders for the case of FILTER_SCREEN
...
Assume a color matrix or color vertex values are not used when
the filter is FILTER_SCREEN.
2019-02-17 19:40:52 +09:00
Hajime Hoshi
cbb0a1da95
graphicsdriver: Refactoring
...
This improved FPS on mobiles a little bit. Maybe now texture2D is
called only when necessary, but not sure.
2019-02-17 17:37:11 +09:00
Hajime Hoshi
742bbb4ccd
graphicsdriver: Simplify clamping color values
...
For negative values, OpenGL (and Metal) should take care of them
so we don't have to care.
2019-02-17 15:09:05 +09:00
Hajime Hoshi
3d8a45a770
graphicsdriver/opengl: Refactoring
2019-02-17 14:30:32 +09:00
Hajime Hoshi
d927241223
graphicsdriver/opengl: Remove unnecessary function calls
2019-02-17 11:44:50 +09:00
Hajime Hoshi
3ecb00f717
graphicsdriver: Optimize shaders
...
Simplified the case when a color matrix is not used.
2019-02-16 23:53:22 +09:00
Hajime Hoshi
a8b97c9755
graphicsdriver: Optimize shader (skip color matrix calculation)
...
Skip multiplying with a color matrix when possible.
2019-02-16 17:33:12 +09:00
Hajime Hoshi
815ed8cda2
graphicsdriver: Optimize shader by removing 'if'
2019-02-16 16:39:02 +09:00
Hajime Hoshi
1f46299870
graphicsdriver/opengl: Bug fix: source_size can be optimized out with nearest filter
2019-02-16 15:14:48 +09:00
Hajime Hoshi
b1b8d0b4b1
graphics: Move texel-region adjustment from shaders to program
...
This reduces GPU burden.
2019-02-16 14:50:03 +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
fd250c8d8c
graphics: Rename NextPowerOf2Int -> InternalImageSize and add image size adjustment
...
There is a minimum internal image size on some system like old iOS
devices. This change adds adjustment of the size.
Issue: #810
2019-02-14 23:06:01 +09:00
Hajime Hoshi
04dc1faa9c
graphicsdriver/opengl: Call glFinish before glReadPixels
...
It looks like glFlush is not enough at least on Travis CI.
Fixes #814
2019-02-14 02:03:05 +09:00
Hajime Hoshi
c2c3579cde
graphicsdriver/opengl: Reduce 'if' in shader programs
...
Fixes #812
2019-02-12 12:46:18 +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
ba47a19b17
mobile: Bug fix: error must be received without waiting for renderCh
...
Even when error happens, the error was not received when renderCh
received. This was the cause of freezing when error happens.
2019-01-28 12:32:48 +09:00
Hajime Hoshi
fd4cdd445c
graphicsdriver/opengl/gl: Unexport or remove C symbols ( #786 )
2019-01-17 22:16:47 +09:00
Hajime Hoshi
12f7d14d91
graphicsdriver/opengl: Check the reserved keyword
...
Fixes #772
2019-01-08 00:07:49 +09:00
Hajime Hoshi
758b957b01
graphicsdriver/opengl: Bug fix: filter is a preserved keyword ( #771 )
2019-01-07 11:20:29 +09:00
Hajime Hoshi
123be16699
graphicsdriver/opengl: Use NewLazySystemDLL instead of NewLazyDLL ( #766 )
2019-01-04 15:05:27 +09:00
Hajime Hoshi
454a7d8ef9
graphicsdriver/opengl: Bug fix: misspelling on variables
...
Fixes #764
2018-12-26 03:03:06 +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
f5708cb58a
graphicsdriver/opengl: Bug fix: Rename a function not to override an existing function
2018-12-24 17:45:16 +09:00
Hajime Hoshi
f1582c2d73
graphics: Add Address representing a sampler address mode
...
Fixes #761
2018-12-24 17:29:31 +09:00
Hajime Hoshi
7e50ae39c9
graphicsdriver/opengl: Refactoring: Filter as a uniform value
2018-12-24 16:06:25 +09:00
Hajime Hoshi
85df49dc96
graphicsdriver/opengl: Bug fix: variables can be optimized out
2018-12-23 06:04:35 +09:00
Hajime Hoshi
4149a56524
graphics: Refactoring: Use 12 floats for each vertex
...
This is a preparation for #761 .
2018-12-23 02:36:28 +09:00
Hajime Hoshi
ff62876552
Add Metal implementation
...
Fixes #621
2018-12-20 02:37:10 +09:00
Hajime Hoshi
d738639c48
graphicsdriver/opengl: Fix panic messages
2018-12-20 02:36:21 +09:00
Hajime Hoshi
d29cabca43
graphicsdriver: Remove MaxImageSize
2018-12-15 03:46:32 +09:00
Hajime Hoshi
18d109e3df
graphicsdriver/opengl/gl: Fix README
2018-12-09 04:41:43 +09:00
Hajime Hoshi
e8a1be7748
graphicsdriver/opengl: Use non-cgo gl package on Windows ( #171 )
...
This is a temporal fix until go-gl/glow#102 is applied.
2018-12-09 03:06:11 +09:00
Hajime Hoshi
c6dd0a75d9
graphicscommand: Optimize replace-image calls
...
Now ReplacePixels command is called only when necessary.
This also ensures that DrawImage must be called after ReplacePixels
is called since there is a potential problem that rendering images
on a texture without initializing by replacing pixels might cause
problems (escpecially on Metal. Perhaps #593 might be related).
2018-12-01 21:36:47 +01:00
Hajime Hoshi
62210c89f3
graphicsdriver/opengl: Add assertion at ReplacePixels
2018-11-18 02:09:44 +09:00
Hajime Hoshi
31f15bc5ad
Revert "graphics: Change the number of floats for a vertex from 10 to 12"
...
This reverts commit 7586c660d5
.
2018-11-18 00:07:15 +09:00
Hajime Hoshi
d8f337985d
graphicsdriver/opengl: Refactoring
2018-11-17 22:40:21 +09:00
Hajime Hoshi
ef08e218c8
graphicsdriver/opengl: Refactoring: Remove framebuffer.projectionMatrix
2018-11-17 22:29:04 +09:00
Hajime Hoshi
14f5a03a79
Merge math and graphics packages
2018-11-17 20:23:12 +09:00
Hajime Hoshi
de745f00fa
graphicsdriver/opengl: Refactoring: Improve logic to generate framebuffer
2018-11-17 19:49:30 +09:00
Hajime Hoshi
44d1b137e7
graphicsdriver/opengl: Refactoring
2018-11-17 19:29:52 +09:00
Hajime Hoshi
7586c660d5
graphics: Change the number of floats for a vertex from 10 to 12
...
This is a preparation for Metal, that forces 4 floats for a vertex
position.
2018-11-17 15:30:11 +09:00
Hajime Hoshi
e24f6b7848
graphicsdriver/opengl: Rename GetDriver -> Get
2018-11-13 00:01:26 +09:00
Hajime Hoshi
2313f79160
graphicsdriver: Rename Delete -> Dispose
2018-11-12 23:44:39 +09:00
Hajime Hoshi
cc2174bd69
graphicsdriver: Adjust API
2018-11-11 23:57:23 +09:00
Hajime Hoshi
907a28c434
graphicsdriver: Rename BufferSubData -> SetVertices
2018-11-11 23:54:58 +09:00
Hajime Hoshi
846a719d6c
graphicsdriver: Merge UseProgram and DrawElements into Draw
2018-11-11 23:53:23 +09:00
Hajime Hoshi
575af7e416
graphicsdriver: Change indexOffsetInBytes -> indexOffset at DrawElements
2018-11-11 23:51:16 +09:00
Hajime Hoshi
b2b51fb1bf
graphicsdriver/opengl: Refactoring
2018-11-11 22:08:36 +09:00
Hajime Hoshi
aff77d98e4
graphicsdriver/opengl: Bug fix: compile error on browsers and mobiles
2018-11-11 04:51:17 +09:00
Hajime Hoshi
734aeabc8d
graphicsdriver/opengl: Remove theContext
2018-11-11 03:37:37 +09:00
Hajime Hoshi
2f692d98c7
graphicsdriver: Rename TexSubImage2D -> ReplacePixels
2018-11-11 01:35:10 +09:00
Hajime Hoshi
61ca48225c
graphicsdriver: Rename MaxTextureSize -> MaxImageSize
2018-11-11 01:26:37 +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