Commit Graph

438 Commits

Author SHA1 Message Date
Hajime Hoshi
983e8abd46 internal/graphicsdriver/opengl/gl: bug fix: an unavailable library name might be chosen
Instead, let's try all the names with dlopen.

Updates #2523
2023-01-07 03:06:12 +09:00
Hajime Hoshi
df7b7b731e internal/graphicsdriver/opengl/gl: bug fix: libGL.so might not exist in Steam
Instead, libGL.so.1 might exist. Use LD_LIBRARY_PATH and list the
candidates.

Closes #2523
2023-01-07 00:03:07 +09:00
Hajime Hoshi
cf76e3c646 internal/graphicsdriver/opengl: better place to reset uniform variables
Updates #2517
2023-01-04 01:36:04 +09:00
Hajime Hoshi
edf35b02cb internal/graphicsdriver/opengl: record last uniform variables and reset them before swapping buffers
This is basically a revert of 6b4c696b31.
This change resets the last uniform variables before swapping
buffers.

Updates #2517
2023-01-03 03:13:46 +09:00
Hajime Hoshi
6b4c696b31 internal/graphicsdriver/opengl: bug fix: needed always to set uniform variables
Before this fix, setting uniform variables could be skipped when the
values were the same. This caused some issues when a number of drawing
commands were much small than usual (e.g. SetScreenClearedEveryFrame
with false).

This change fixes this by not doing such optimization. Unfortunately
it was impossible to create a minimum reproducible unit test since
we cannot test the final screen framebuffer's states so far.

Closes #2517
2023-01-03 00:43:10 +09:00
Hajime Hoshi
ece60af1b7 internal/graphicsdriver/metal: stop using presentsWithTransaction
presentsWithTransaction caused many troubles. The critical thing was
that nextDrawable sometimes took more than one second when a user
inputs with NSTextView.

Fortunately, applications work well even without presentsWithTransaction.

Updates #1029
Updates #1196
Updates #1745
Updates #1974
2022-12-27 19:00:56 +09:00
Hajime Hoshi
0a6813c17f internal/graphics: use flatten []float32 slice instead of [][]float32
Closes #2479
2022-12-03 20:23:58 +09:00
Hajime Hoshi
5356b44286 internal/graphicsdriver/opengl: add comments about Firefox
Updates #2077
2022-11-23 00:57:16 +09:00
Hajime Hoshi
0b9cbaa1ed internal/shader: introduce integer vectors (ivec2, ivec3, ivec4)
Closes #1911
2022-11-21 00:31:23 +09:00
Hajime Hoshi
90213d5d80 internal/graphicsdriver/opengl: refactoring 2022-11-18 13:32:09 +09:00
Hajime Hoshi
95b4e67c77 internal/graphicsdriver/opengl: reduce context functions 2022-11-18 03:18:30 +09:00
Hajime Hoshi
4de6da0a50 internal/graphicsdriver/opengl: use an appropriate stencil buffer format 2022-11-17 13:31:36 +09:00
Hajime Hoshi
21670691b1 internal/graphicsdriver/opengl: remove duplicated code 2022-11-17 13:22:48 +09:00
Hajime Hoshi
d6027a9357 internal/graphicsdriver/opengl: remove duplicated code 2022-11-17 13:13:15 +09:00
Hajime Hoshi
8cc6fa82fd internal/graphicsdriver/opengl: remove fnIsContextLost
As restoring from context lost doesn't happen on browsers, isContextLost
doesn't have to be called.
2022-11-17 12:43:26 +09:00
Hajime Hoshi
c768860f3f internal/graphicsdriver/opengl: remove fnGetExtension 2022-11-17 12:40:56 +09:00
Hajime Hoshi
bae5aa7732 internal/graphicsdriver/opengl: move initGL to NewGraphics
As restoring from context lost doesn't happen on browsers, initilizing
GL doesn't have to be done at reset.
2022-11-17 12:34:55 +09:00
Hajime Hoshi
4082223aec internal/graphicsdriver/opengl: remove webGLVersion 2022-11-17 12:27:32 +09:00
Hajime Hoshi
74d9515345 internal/graphicsdriver/opengl: refactoring: move gl_js to gl/context_js.go
This unifies the OpenGL context interface for all the platforms.
2022-11-17 12:22:46 +09:00
Hajime Hoshi
f08983e14d internal/graphicsdriver/opengl: remove unused variables
It should be safe to assume 0 is an invalid texture ID in OpenGL.

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glIsTexture.xhtml
> If texture is zero, or is a non-zero value that is not currently the
> name of a texture, or if an error occurs, glIsTexture returns GL_FALSE.
2022-11-17 10:53:28 +09:00
Hajime Hoshi
de3702e4c2 internal/graphicsdriver/opengl: reduce unnecessary slice allocations 2022-11-17 03:01:31 +09:00
Hajime Hoshi
9df4770d20 internal/graphicsdriver/opengl/gl: make Context closer to gomobile's Context 2022-11-17 01:23:27 +09:00
Hajime Hoshi
49fc1cfdc0 internal/graphicsdriver/opengl/gl: refactoring: replace some *iv functions with *i 2022-11-17 00:26:33 +09:00
Hajime Hoshi
098fed65d5 internal/graphicsdriver/opengl/gl: refactoring: replace GetIntegerv -> GetInteger 2022-11-16 23:59:28 +09:00
Hajime Hoshi
4c389c1752 internal/graphicsdriver/opengl/gl: bug fix: compile error 2022-11-15 02:41:59 +09:00
Hajime Hoshi
056042ca92 internal/graphicsdriver/opengl/gl: refactoring 2022-11-15 02:38:38 +09:00
Hajime Hoshi
0d8912e7ae internal/graphicsdriver/opengl/gl: bug fix: failed to load OpenGL(ES).framework on iOS
This change also fixes the issue that *EXT functions are missing
in OpenGLES.framework.

Closes #2456
2022-11-15 02:33:45 +09:00
Hajime Hoshi
f4e63602d3 internal/graphicsdriver/opengl/gl: dynamic function loading for Android
Closes #2450
2022-11-14 23:23:50 +09:00
Hajime Hoshi
31af27b926 internal/graphicsdriver/opengl/gl: fix error message 2022-11-14 13:19:19 +09:00
Hajime Hoshi
f6f7ed3e3d internal/graphicsdriver/opengl/gl: automatically choose OpenGL and OpenGL ES
Updates #292
2022-11-14 12:50:53 +09:00
Hajime Hoshi
fcf454ef20 internal/graphicsdriver/opengl/gl: use RTLD_LAZY instead of RTLD_NOW
See the discussion at #2453.
2022-11-14 04:46:11 +09:00
TotallyGamerJet
56ec19caa1
all: use RTLD_LAZY in dlopen for darwin (#2453)
dlopen requires either RTLD_LAZY or RTLD_NOW but there was neither.

Updates #1162
2022-11-14 04:44:51 +09:00
Hajime Hoshi
072e91d67f internal/graphicsdriver/opengl/gl: dynamic-load functions with GLX
Updates #292
Updates #2450
2022-11-14 03:21:42 +09:00
Hajime Hoshi
f093996284 internal/graphicsdriver/opengl/gl: refactoring 2022-11-14 03:14:21 +09:00
Hajime Hoshi
1e86e7fa18 internal/ui: refactoring: reduce opengles build tags
Updates #292
2022-11-14 02:46:34 +09:00
Hajime Hoshi
114a8aa6ea internal/graphicsdriver/opengl/gl: reland: refactoring: reduce opengles build tags
Updates #292
2022-11-14 02:33:23 +09:00
Hajime Hoshi
e8810495cf internal/graphicsdriver/opengl/gl: reland: refactoring: reduce opengles build tags
This is a reland of c9cff69dcb.

Updates #292
2022-11-14 02:21:18 +09:00
Hajime Hoshi
e87e4ffbd2 Revert "internal/graphicsdriver/opengl/gl: refactoring"
This reverts commit c9cff69dcb.

Reason: compmile error for browsers
2022-11-14 02:17:27 +09:00
Hajime Hoshi
c9cff69dcb internal/graphicsdriver/opengl/gl: refactoring 2022-11-14 02:13:32 +09:00
Hajime Hoshi
94291ecb17 internal/graphicsdriver/opengl/gl: update copyrights
These files are already completely different from the original files.
2022-11-14 01:56:30 +09:00
Hajime Hoshi
39b8a66359 internal/graphicsdriver/opengl/gl: dynamic function load for OpenGL ES
Updates #292
Updates #2450
2022-11-13 08:48:26 -08:00
Hajime Hoshi
e5e7ceb688 internal/graphicsdriver/opengl/gl: refactoring 2022-11-13 23:10:20 +09:00
Hajime Hoshi
144d2374bf internal/graphicsdriver/opengl/gl: remove 'egl' build tag
Probably nobody uses this.
2022-11-13 22:50:21 +09:00
Hajime Hoshi
5b96d93d13 internal/graphicsdriver/opengl/gl: refactoring 2022-11-13 22:26:13 +09:00
Hajime Hoshi
78f8ddbda8 internal/graphicsdriver/opengl/gl: load OpenGLES.framework if possible on Darwin
Closes #2449
2022-11-13 19:51:43 +09:00
Hajime Hoshi
b6ed95750b internal/graphicsdriver/opengl: unify context_gl.go and context_gles.go
Closes #2451
2022-11-13 19:42:21 +09:00
Hajime Hoshi
f69beffc6c internal/graphicsdriver/opengl: bug fix: initialization was too early on Windows
Closes #2452
2022-11-13 18:00:40 +09:00
Hajime Hoshi
b536b82109 internal/graphicsdriver/opengl/gl: hide concrete context types 2022-11-13 17:13:52 +09:00
Hajime Hoshi
b66cf74c99 internal/graphicsdriver/opengl: bug fix: compile error 2022-11-13 16:16:19 +09:00
Hajime Hoshi
656a2d758e internal/graphicsdriver/opengl: bug fix: compile error 2022-11-13 15:55:33 +09:00