Commit Graph

944 Commits

Author SHA1 Message Date
Hajime Hoshi
fe67399022 internal/graphicsdriver/directx: use CreateSwapChain instead of CreateSwapChainForHwnd
This is a preparation to use IDXGIFactory instead of IDXGIFactory4.

Updates #2613
2023-03-29 23:37:08 +09:00
Hajime Hoshi
ad1bb4b2cb internal/graphicsdriver/directx: remove unused functions 2023-03-29 23:21:08 +09:00
Hajime Hoshi
1017161c36 internal/graphicsdriver/directx: refactoring 2023-03-29 18:26:11 +09:00
Hajime Hoshi
0b0526a05b internal/graphicsdriver/directx: bug fix: had to consider strides when copying resources
Closes #2617
2023-03-29 18:24:36 +09:00
Hajime Hoshi
0449126c5b internal/graphicsdriver/directx: integrate EBITENGINE_DIRECTX and EBITENGINE_DIRECTX_FEATURE_LEVEL 2023-03-29 16:22:20 +09:00
Hajime Hoshi
129956d8f0 internal/graphicsdriver/directx: refactoring: remove graphic12.transparent 2023-03-29 15:56:33 +09:00
Hajime Hoshi
78d76945ad internal/graphicsdriver/directx: implement DirectX 11 driver
Updates #2613
2023-03-29 15:52:33 +09:00
Hajime Hoshi
c8a2e5dc71 internal/graphicsdriver/directx: refactoring
This is a preparation for a DirectX 11 driver.

Updates #2613
2023-03-29 15:34:58 +09:00
Hajime Hoshi
4779bbc04d internal/graphicsdriver/directx: refactoring: remove redundant adapter check 2023-03-29 15:32:49 +09:00
Hajime Hoshi
f23dd72fb4 internal/graphicsdriver/directx: reduce unnecessary settings of pipelines 2023-03-29 14:15:22 +09:00
Hajime Hoshi
c22957f678 internal/graphicsdriver/directx: dispose a screen image explicitly
A screen image in DirectX 12 should not include any buffers to release
so there is not a bug, but disposing it explicitly when resizing the
window should be polite.
2023-03-29 00:42:03 +09:00
Hajime Hoshi
f698f8fc69 internal/graphicsdriver/directx: refactoring 2023-03-28 02:32:01 +09:00
Hajime Hoshi
fe42c1f2b5 internal/graphicsdriver/directx: lower the shader version for feature levels 10.x
Updates #2613
2023-03-27 14:02:59 +09:00
Hajime Hoshi
dbb167c2d0 internal/graphicsdriver/directx: refactoring 2023-03-27 13:57:25 +09:00
Hajime Hoshi
549e6120b5 internal/graphicsdriver/directx: refactoring: reduce indentations 2023-03-26 22:56:15 +09:00
Hajime Hoshi
fe5c3354fc internal/graphicsdriver/directx: bug fix: missing error checking 2023-03-26 18:52:55 +09:00
Hajime Hoshi
c9469a64ee internal/graphicsdriver/directx: refactoring: add graphicsInfra 2023-03-26 18:31:42 +09:00
Hajime Hoshi
0b46d2b799 internal/graphicsdriver/directx: refactoring 2023-03-26 00:49:30 +09:00
Hajime Hoshi
902d7244eb internal/graphicsdriver/directx: rename structs for a new DirectX 11 implementation
Updates #2613
2023-03-26 00:32:47 +09:00
Hajime Hoshi
d6525a2782 internal/graphicsdriver/directx: refactoring 2023-03-25 16:52:58 +09:00
Hajime Hoshi
c394bdcf7c internal/graphicsdriver/directx: separate a part for images and shaders 2023-03-25 15:54:28 +09:00
Hajime Hoshi
4811386d8a internal/graphicsdriver/directx: separate a part for DirectX 12
Updates #2613
2023-03-25 15:35:47 +09:00
Hajime Hoshi
488bce7e36 internal/graphicsdriver/directx: remove unnecessary comments 2023-03-25 13:53:00 +09:00
Hajime Hoshi
c1e83432c0 internal/graphicsdriver/directx: refactoring: split api_windows.go 2023-03-25 12:07:04 +09:00
Hajime Hoshi
4ec27262ed internal/graphicsdriver/directx: refactoring 2023-03-25 01:34:29 +09:00
Hajime Hoshi
90723025cc internal/graphicsdriver/directx: reuse vertices/indices buffers whenever possible 2023-03-23 11:34:39 +09:00
Hajime Hoshi
e5525a04d5 internal/graphicsdriver/directx: refactoring: remove usages of graphics.IndicesCount
Updates #2460
2023-03-23 11:25:29 +09:00
Hajime Hoshi
a19ff07130 internal/graphicsdriver/opengl: bug fix: potential infinite loop 2023-03-23 02:47:23 +09:00
Hajime Hoshi
ad90ae3475 internal/graphicsdriver/directx: refactoring 2023-03-22 21:52:14 +09:00
Hajime Hoshi
034f9c2db8 internal/graphicsdriver/opengl: reland: refactoring: remove usages of graphics.IndicesCount
Updates #2460
2023-03-22 20:13:29 +09:00
Hajime Hoshi
61ee811579 internal/graphicsdriver: define Resetter 2023-03-22 18:35:46 +09:00
Hajime Hoshi
8cbf545e0f internal/graphicsdriver/opengl: revert commits for graphics.Indices
This change reverts these commits:

* 13d3a0487b
* 4cd98d512e

Reason: this caused crashes on Android.

Updates #2460
Closes #2610
2023-03-22 17:28:45 +09:00
Hajime Hoshi
13d3a0487b internal/graphicsdriver/opengl: refactoring: remove usages of graphics.IndicesCount
Updates #2460
2023-03-22 13:33:34 +09:00
Hajime Hoshi
4cd98d512e internal/graphicsdriver/opengl: refactoring 2023-03-21 23:06:49 +09:00
Hajime Hoshi
23e90b7e39 internal/graphicsdriver/opengl: refactoring 2023-03-20 22:48:20 +09:00
Hajime Hoshi
8ae6ea5ff6 internal/graphicsdriver/opengl: update comments 2023-03-20 01:42:54 +09:00
Hajime Hoshi
cbff3555db internal/graphicsdriver/opengl: drop WebGL 1 support
Closes #2191
2023-03-18 22:50:09 +09:00
Hajime Hoshi
3bcac70d1c internal/graphicsdriver/metal: add comments 2023-03-13 22:21:55 +09:00
Hajime Hoshi
65fb9d56ba internal/graphicsdriver/metal: refactoring
Updates #2599
2023-03-13 21:29:42 +09:00
Hajime Hoshi
36e2d0ec40 internal/graphicsdriver/metal: bug fix: a path for CoreGraphics.framework didn't work
Closes #2595
2023-03-10 23:24:06 +09:00
Hajime Hoshi
6ccdc6382c internal/graphicsdriver/metal/mtl: bug fix: fix a vet error 2023-03-04 01:37:45 +09:00
Hajime Hoshi
36bd3329b3 internal/graphicsdriver/metal: bug fix: compile error 2023-03-04 01:25:43 +09:00
Hajime Hoshi
7998e4d31d update purego to v0.3.0-alpha
There are breaking changes between purego v0.2.0 and v0.3.0-alpha.
2023-03-04 01:22:54 +09:00
Hajime Hoshi
a5a5de2f3f internal/graphicsdriver/directx: reduce memory usages for writing pixels
Updates #2294
Updates #2582
2023-03-01 00:11:34 +09:00
Hajime Hoshi
264f0bad42 internal/graphicsdriver/directx: reduce memory usages when reading pixels
Updates #2294
Updates #2582
2023-02-28 22:55:21 +09:00
Hajime Hoshi
f58d7e1ab5 internal/graphicsdriver/directx: bug fix: getting pixels with non-zero position might not work 2023-02-25 02:08:50 +09:00
Pierre Curto
4de807cc44
all: fix typos (#2558)
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2023-01-28 19:06:38 +09:00
Hajime Hoshi
aa52402a90 internal/graphicsdriver/metal: fix a comment 2023-01-24 02:22:35 +09:00
Hajime Hoshi
7f39b9c5b6 internal/graphicsdriver/metal: use supportsFeatureSet: as a fallback
This change is a fix for a regression that happened on macOS High Sierra.

Closes #2553
2023-01-23 23:44:56 +09:00
Hajime Hoshi
72f026e254 internal/graphicsdriver/opengl/gl: bug fix: searching GL libraries failed on some machines
On a Debian machine, LD_LIBRARY_PATH might not be set and libGL.so might
not exist (libGL.so.1 exists instead). In this case, searching for a GL
library fails

This change fixes the issue by not using LD_LIBRARY_PATH and also including
`libGL.so.*` files as candidates for dlopen.

Closes #2539
2023-01-13 15:08:06 +09:00
divVerent
abece041f4
internal/graphicsdriver/opengl: fix state tracking of glBindTexture / glActiveTexture interaction (#2526)
After switching texture units using glActiveTexture, a different texture may
be bound. For now, let's just force the active texture state variable to zero
so the next glBindTexture call isn't skipped.

Closes #2525
2023-01-07 23:13:14 +09:00
Hajime Hoshi
847d1cae73 internal/graphicsdriver/opengl/gl/: refactoring 2023-01-07 17:01:00 +09:00
Hajime Hoshi
d615c2f42a internal/graphicsdriver/opengl/gl: bug fix: isES was not set 2023-01-07 03:46:30 +09:00
Hajime Hoshi
869ca1e01f internal/graphicsdriver/opengl/gl: fix a wrong comment 2023-01-07 03:41:02 +09:00
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
b860d8dc61 internal/graphicsdriver/metal/mtl: bug fix: test failures 2023-01-05 14:14:42 +09:00
Hajime Hoshi
c5848455f5 internal/graphicsdriver/metal: use MTLGPUFamily instead of MTLGPUFeatureSet 2023-01-05 13:37:37 +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
599be725b9 internal/graphicsdriver/metal: fix comments 2023-01-03 23:16:01 +09:00
Hajime Hoshi
7418576c16 internal/ui: re-enable skipping to render the final screen when possible
With Metal, nextDrawable could return immediately when a command buffer
is empty. To avoid high CPU usage, this change adds a slight sleep in
this case.

With DirectX, Present waits for a while even though nothing is updated,
then that's fine.

Updates #2341
Updates #2342
Updates #2520
2023-01-03 23:09:28 +09:00
Hajime Hoshi
edb952c9e7 internal/graphicsdriver/metal: add comments 2023-01-03 22:10:33 +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
34941ca083 all: separate the rendering thread from the main thread
Updates #1704
Closes #2512
2022-12-30 22:57:34 +09:00
Hajime Hoshi
8d020ad414 internal/graphicsdriver/metal: refactoring 2022-12-29 15:27:51 +09:00
Hajime Hoshi
5e17791e4e internal/ui: bug fix: an offscreen was broken with SetScreenClearedEveryFrame(false)
Updates #2500
Closes #2510
2022-12-29 14:57:07 +09:00
Hajime Hoshi
0756be0b68 cmd/ebitenmobile: use an independent thread for rendering on iOS
Closes #2508
2022-12-28 23:37:13 +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
8b588587cc internal/graphicsdriver/directx: do not cache a vertex shader when an error occurs 2022-12-25 04:27:15 +09:00
Hajime Hoshi
8e1bd4eaba internal/graphicsdriver/directx: refactoring 2022-12-24 18:05:47 +09:00
Hajime Hoshi
fda0b1cbcb internal/graphicsdriver/directx: reuse a compiled vertex shader if possible
D3DCompile can be a very slow function, and let's skip this if possible.
2022-12-24 17:44:54 +09:00
Hajime Hoshi
1b4f68d775 internal/graphicsdriver/directx: call D3DCompile in parallel
D3DCompile can be very slow on some old machines.

See also https://bugs.chromium.org/p/angleproject/issues/detail?id=422
2022-12-24 01:22:33 +09:00
Hajime Hoshi
de8184ac10 internal/graphicsdriver/directx: implement suspend/resume for Xbox 2022-12-23 17:28:03 +09:00
Hajime Hoshi
102a2d2138 internal/graphicsdriver/directx: change the default feature level to 11_0
The feature level 12_0 causes some issues on some machines. As we now
have EBITENGINE_DIRECTX_FEATURE_LEVEL, let's go back to the default
feature level 11_0.

Updates #2486
2022-12-07 21:16:47 +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
67430362cc internal/graphicsdriver/directx: add EBITENGINE_DIRECTX_FEATURE_LEVEL
A fix for #2447 was a breaking-change as the DirectX driver was no longer
available for some old graphics card.

To support such old cards, provide a new environment variable
EBITENGINE_DIRECTX_FEATURE_LEVEL to specify a feature level.
The possible values are 11_0, 11_1, 12_0, 12_1, and 12_2. The default
value is 12_0.

Closes #2466
2022-11-21 02:46:07 +09:00
Hajime Hoshi
0b9cbaa1ed internal/shader: introduce integer vectors (ivec2, ivec3, ivec4)
Closes #1911
2022-11-21 00:31:23 +09:00
TotallyGamerJet
fb612ab443
internal/cocoa, internal/graphicsdriver/mtl: remove usages of NSInvocations to directly call ID.Send (#2464)
purego now supports using floats as arguments.
We can remove these instances of NSInvocation that
only existed to circumvent that feature.

Updates #1162
2022-11-20 23:48:22 +09:00
Hajime Hoshi
9a75e266d4 internal/graphicsdriver: fix comments 2022-11-20 23:18:40 +09:00
Hajime Hoshi
7961654927 internal/graphicsdriver/metal: bug fix: wrong alignment for vec3 2022-11-20 23:14:09 +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
c7c9500ba6 internal/graphicsdriver/directx: bug fix: a software adaptor was unexpectedly chosen
Closes #2459
2022-11-16 15:46:17 +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
Hajime Hoshi
8393211ed7 internal/graphicsdriver/opengl: bug fix: compile error 2022-11-13 15:44:15 +09:00
Hajime Hoshi
8c49c88b08 internal/graphicsdriver/opengl: refactoring 2022-11-13 15:27:37 +09:00
Hajime Hoshi
42566c6c9a internal/graphicsdriver/opengl: refactoring: remove SetCanvas 2022-11-13 15:18:44 +09:00
Hajime Hoshi
a0a5f2b301 internal/graphicsdriver/opengl: remove SetGomobileGLContext
This change is needed to initialize the context at opengl.NewGraphics.

Updates #2451
2022-11-13 15:07:14 +09:00
Hajime Hoshi
5cfb7c9469 internal/graphicsdriver/opengl: make context_gles.go closer to context_gl.go
Updates #2451
2022-11-13 14:20:47 +09:00
Hajime Hoshi
0c5a77eaa4 internal/graphicsdriver/opengl/gles: integrate gles and glconst into gl
Updates #2451
2022-11-13 14:15:22 +09:00
Hajime Hoshi
c4abaa32f5 internal/graphicsdriver/opengl: initialize gl at init()
This changes context_gl.go a little closer to context_gles.go.

Updates #2451
2022-11-13 04:13:18 +09:00
Hajime Hoshi
bb30b85d29 internal/graphicsdriver/opengl/gl: simplify C code 2022-11-13 03:35:40 +09:00
Hajime Hoshi
879cf50aaf internal/graphicsdriver/opengl: remove unused functions 2022-11-13 02:54:34 +09:00
Hajime Hoshi
fad9f1592c internal/graphicsdriver/opengl/gles: remove unused functions 2022-11-13 02:45:53 +09:00
Hajime Hoshi
c5fb6fa23f internal/graphicsdriver/opengl/gl: remove unused functions 2022-11-13 02:35:45 +09:00
Hajime Hoshi
1ecac8d834 all: allow integer uniform variables for Kage shaders
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
a406904a51 internal/graphicsdriver: refactoring 2022-11-12 21:03:54 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
0db2318a8d internal/graphicsdriver/opengl: update comments 2022-11-12 19:31:16 +09:00
Hajime Hoshi
cee948048d internal/graphicsdriver/opengl: remove unused functions 2022-11-12 19:28:14 +09:00
Hajime Hoshi
2deceaa0af internal/graphicsdriver/directx: specify DX level 12
The DirectX initialization passed but crashed later on some old machines
supporting the feature level 11 but not 12.

This change fixes the issue by changing the required feature level from
11 to 12 so that the initialization fails and OpenGL is used as the
fallback.

Closes #2447
2022-11-12 12:25:24 +09:00
Hajime Hoshi
303965e1a9 all: remove unnecessary copying
Copying []byte to string should copy the data if necessary, as the
Go specification assures that strings are immutable.
2022-11-11 00:28:47 +09:00
Hajime Hoshi
097adcf8b6 internal/graphicsdriver/opengl/gl: reladn: refactoring
This is a reland of a1ad87a262
2022-11-09 21:02:31 +09:00
Hajime Hoshi
96298bb59d Revert "internal/graphicsdriver/opengl/gl: refactoring"
This reverts commit a1ad87a262.

Reason: compile error
2022-11-09 18:27:06 +09:00
Hajime Hoshi
a1ad87a262 internal/graphicsdriver/opengl/gl: refactoring 2022-11-09 16:07:30 +09:00
Hajime Hoshi
915fff96f8 all: reduce reflect usages 2022-11-09 13:24:31 +09:00
Hajime Hoshi
262ff351f4 internal/graphicsdriver/directx: bug fix: ScheduleFrameEventX might not return S_OK on Xbox One 2022-11-05 15:09:38 +09:00
Hajime Hoshi
a6e121613f internal/graphicsdriver/directx: bug fix: wrong SDK version for Xbox One 2022-11-05 02:31:28 +09:00
Hajime Hoshi
d73e8f785d internal/graphicsdriver: render various destination regions as one command
Closes #2232
2022-11-04 20:49:44 +09:00
Hajime Hoshi
1ce29e2afa internal/graphicsdriver/directx: reduce rendering paths for even-odd rendering 2022-11-04 18:18:08 +09:00
Hajime Hoshi
0afb6fd22a internal/graphicsdriver/metal: reduce rendering paths for even-odd rendering 2022-11-04 16:17:51 +09:00
Hajime Hoshi
384dee7160 internal/graphicscommand: remove unused uniform variables
This improves possibility of merging graphics commands by reducing
uniform variables.

Updates #2232
2022-11-03 22:45:17 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
1b3696a7ff internal/graphicsdriver/opengl: fix comments 2022-10-31 12:59:27 +09:00
Hajime Hoshi
a5993f09a2 internal/graphicscommand: refactoring: add preserved uniform variables at the graphicscommand package
This is a preparation to skip setting unnecessary uniform variables
like dstRegion.

Updates #2232
2022-10-30 22:30:52 +09:00
Hajime Hoshi
690e73c11b all: replace reflect.SliceHeader with unsafe.Slice
Closes #2420
2022-10-30 12:25:30 +09:00
Hajime Hoshi
b019a3723a internal/ui: optimize GPU usages when the screen doesn't have to be updated
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).

Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
2cf651bed8 internal/graphicsdriver/directx: resize the swap buffer chain at the end of a frame
Updates #2144
2022-10-25 00:35:09 +09:00
Nathan Levett
f220eb729c
internal/graphicsdriver/opengl: move OpenGL constants to seperate package (#2408)
Closes #2389
2022-10-24 23:22:14 +09:00
Hajime Hoshi
da5f5ea327 ebiten: add blend factors
Updates #2382
2022-10-18 00:21:13 +09:00
Hajime Hoshi
d2a99afa44 internal/graphicsdriver/opengl: bug fix: lastBlend was not updated correctly on GLES 2022-10-17 16:05:09 +09:00
Hajime Hoshi
46a218c278 internal/graphicsdriver/metal/mtl: bug fix: wrong renaming
Updates #2382
2022-10-17 01:11:54 +09:00
Hajime Hoshi
871a8869db ebiten: bug fix: wrong renaming
Updates #2382
2022-10-17 01:00:23 +09:00
Hajime Hoshi
180e456a8e ebiten: rename members of Blend
Updates #2382
2022-10-17 00:51:55 +09:00
Hajime Hoshi
e03825bf08 ebiten: add BlendOperationSubtract and BlendOperationReverseSubtract
Updates #2382
2022-10-17 00:30:24 +09:00
Hajime Hoshi
06c53c1445 internal/grphicsdriver/opengl: bug fix: wrong consntant was used for blend operations
Updates #2382
2022-10-17 00:21:12 +09:00
Hajime Hoshi
bd0d43f98f internal/graphicsdriver: use byte for blending members 2022-10-16 20:49:12 +09:00
Hajime Hoshi
b6987b6312 internal/graphicsdriver/opengl: bug fix: needed to reset lastBlend 2022-10-16 20:44:09 +09:00
Hajime Hoshi
09a7d39874 internal/graphicsdriver: add Blend struct
This is a preparation to specify blend factors and blend operators.

Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
2f146d5e4f internal/graphicsdriver/opengl: bug fix: build failure for browsers 2022-10-15 23:29:22 +09:00
Hajime Hoshi
257f05883c internal/graphicsdriver/opengl: enable to compiile for browsers with the 'opengles' tag
The 'opengles' tag is just ignored for browsers.
2022-10-15 22:22:28 +09:00
Hajime Hoshi
37c5f53890 internal/graphicsdriver/opengl: refactoring 2022-10-15 22:14:21 +09:00
Hajime Hoshi
1d9f1474e9 internal/graphicsdriver: rename constants 2022-10-15 21:14:59 +09:00
Hajime Hoshi
272d0c6a3f internal/graphicsdriver: rename Operator -> BlendFactor
Updates #2382
2022-10-15 17:34:03 +09:00
Hajime Hoshi
35e9f26681 internal/graphicsdriver/directx: refactoring 2022-10-15 12:16:41 +09:00
Hajime Hoshi
08e6f5af86 internal/graphicsdriver: remove FramebufferYDirection 2022-10-14 00:05:59 +09:00
Hajime Hoshi
69cdd2b178 internal/graphicsdriver/metal: refactoring 2022-10-04 00:29:18 +09:00
Hajime Hoshi
534d82c17d internal/builtinshader: move Filter and Address from internal/graphicsdriver 2022-10-02 23:24:15 +09:00
Hajime Hoshi
080d936d42 internal/graphics: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 22:13:31 +09:00
Hajime Hoshi
a9574627e8 internal/graphicsdriver/directx: remove the built-in shaders
Updates #2369
2022-10-02 21:35:23 +09:00
Hajime Hoshi
033997d928 internal/graphicsdriver/opengl: remove the built-in shaders
Updates #2369
2022-10-02 21:26:13 +09:00
Hajime Hoshi
5f7db485f2 internal/graphicsdriver/metal: remove the built-in shaders
Updates #2369
2022-10-02 20:34:38 +09:00
Hajime Hoshi
5e459bbe42 internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
8a7d860632 all: unify Windows error handlings for Windows HANDLE
Updates #2366
2022-10-02 02:22:06 +09:00
Hajime Hoshi
a9ba0db3d1 internal/glfwwin, internal/graphicsdriver/directx: bug fix: wrong error handlings for Windows HANDLE
Closes #2366
2022-10-02 01:57:24 +09:00
Hajime Hoshi
eb3c45c8af Revert "internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used"
This reverts commit b457dc3307.

Reason: a color scale might be used with ColorM (DrawTriangles)
2022-10-02 00:19:41 +09:00
Hajime Hoshi
b457dc3307 internal/graphicsdriver/opengl, metal, directx: skip multiplying a scale when a color matrix is used 2022-10-01 18:14:22 +09:00
Hajime Hoshi
4203a3b68a internal/graphicsdriver/opengl, metal, directx: add comments
Updates #1212
2022-10-01 15:21:02 +09:00
Hajime Hoshi
a10f3d1dad internal/graphicsdriver/opengl, metal, directx: refactoring: clean up the built-in shaders 2022-10-01 14:35:26 +09:00
Hajime Hoshi
cff64894cc internal/affine: refactoring: use slices instead of array pointers
This doesn't change the performance at the test using ColorM:

```
name           old time/op  new time/op  delta
ColorMScale-8  1.11µs ±43%  1.23µs ±70%   ~     (p=1.000 n=5+5)
```
2022-09-30 22:20:32 +09:00
Hajime Hoshi
c7fcfe5bf7 internal/graphicsdriver/directx: refactoring
This makes more explicit that the pixels are sent after the slice
for the pixels finishes modification.
2022-09-19 00:31:44 +09:00
Hajime Hoshi
cfdf59ef8d internal/graphicsdriver/directx: revert changes to remove GetCopyableFootprints
This reverts these commits
* ccddd4ee20
* 8e40c2ce7e
* 2eb1efe3cc

Without GetCopyableFootprints, the test results on 32bit Windows seemed
much more flaky. This didn't fix the memory issue like #2294 anyway.
2022-09-19 00:26:59 +09:00
Hajime Hoshi
ccddd4ee20 internal/graphicsdriver/directx: refactoring: make the lifetime of uploadingStagingBuffer more explicit 2022-09-19 00:16:53 +09:00
Hajime Hoshi
8e40c2ce7e internal/graphicsdriver/directx: refactoring 2022-09-19 00:06:43 +09:00
Hajime Hoshi
2eb1efe3cc internal/graphicsdriver/directx: stop using GetCopyableFootprints
GetCopyableFootprints seems very conservative and returns a quite
big memory size. Instead of using the info from GetCopyableFootprints
let's use our own minimum footprint.
2022-09-18 23:10:15 +09:00
Hajime Hoshi
45b2bd7b2b internal/graphicsdriver/metal/mtl: remove a TODO comment 2022-09-16 11:48:59 +09:00
Hajime Hoshi
963eb2756a all: fix TODO comments 2022-09-16 02:02:02 +09:00
Hajime Hoshi
2cbc5e7b60 internal/cocoa: remove IsIOS
Use `runtime.GOOS == "ios"` instead.

Closes #1415
2022-09-15 01:04:37 +09:00
Hajime Hoshi
655cd4bf68 all: remove the build tag
Updates #1415
2022-09-15 00:23:40 +09:00