Commit Graph

840 Commits

Author SHA1 Message Date
Hajime Hoshi
8274b32301 internal/graphicslibrary: refactoring: remove IsGL and IsDirectX 2023-10-15 17:30:16 +09:00
Hajime Hoshi
567e2fa04c ebiten: add BlendOperationMin and BlendOperationMax
Closes #2395
2023-10-13 01:56:33 +09:00
Hajime Hoshi
e7ad5c52fe internal/glfw: merge internal/goglfw into internal/glfw
This also changes APIs in internal/glfw to return errors.

Updates #2703
2023-10-05 03:09:51 +09:00
Hajime Hoshi
0e722669ef internal/glfw: add const definitions
This is one of the steps to merge internal/glfw and internal/goglfw.

Updates #2703
2023-10-04 03:04:47 +09:00
Hajime Hoshi
b2a6e79a5a internal/graphicsdriver/opengl/gl: rename procaddr_others.go to procaddr_linbsd.go 2023-10-02 01:02:51 +09:00
Hajime Hoshi
386bda3c84 internal/graphicsdriver/opengl/gl: add do-not-edit comment 2023-10-02 00:21:53 +09:00
Hajime Hoshi
4ca3fa5e57
internal/graphicsdriver: replace Region with image.Rectangle (#2791)
Closes #2790
2023-09-28 14:29:55 +09:00
Hajime Hoshi
915ed48f7a internal/graphicsdriver/metal/mtl: bug fix: fail to resolve Metal.framework path with Xcode 15
Updates #2732
Closes #2784
2023-09-24 16:15:54 +09:00
Hajime Hoshi
6f41a05264 Revert "internal/graphicsdriver/directx: remove tearing"
This reverts commit 78d3e4273b.

Reason: tearing is potentially risky but needed for maximizing FPS.
Also, tearing is officially recommended by Microsoft (see [1])

Closes #2697

[1] https://github.com/microsoft/DirectX-Graphics-Samples/blob/master/Samples/Desktop/D3D12Raytracing/src/D3D12RaytracingHelloWorld/DeviceResources.cpp#L520
2023-09-18 03:30:34 +09:00
Hajime Hoshi
dec08b9e4e all: bug fix: relative paths for dlopen didn't work on macOS Sonoma
Closes #2732
2023-08-26 14:52:52 +09:00
Hajime Hoshi
592d6c57b7 internal/graphicsdriver/metal: improve an error message for Metal initialization
Updates #2732
2023-08-26 12:43:16 +09:00
Hajime Hoshi
e270dea460 internal/graphicsdriver: use []PixelsArgs for ReadPixels
Closes #2592
2023-08-17 03:06:48 +09:00
Hajime Hoshi
842c3cbfcd internal/graphicscommand: use a slice to values instead of pointers
This should reduce heap allocations.
2023-08-16 23:23:30 +09:00
Hajime Hoshi
377b0b8502 internal/graphicscommand: rename WritePixelsArgs -> PixelsArgs
Updates #2592
2023-08-16 22:34:56 +09:00
Hajime Hoshi
4158e206e6 internal/graphicsdriver/metal: rename files 2023-08-03 23:54:48 +09:00
Hajime Hoshi
d410d740a3 internal/graphicsdriver/opengl/gl: change the license of default_cgo* to Apache-2.0
Updates #2695
2023-08-01 23:45:43 +09:00
Hajime Hoshi
f8d8d7a231 examples/life, internal/graphicsdriver/opengl/gl: format copyright texts 2023-07-08 02:50:54 +09:00
Hajime Hoshi
d16b591a35 internal/graphicsdriver/directx: bug fix: use an associated IDXGIFactory
In DirectX 11, if a device and a factory are independently created,
some functions like MakeWindowAssociation doe't work well.

This change fixes the issue by getting a factory from a device and
using it.

Closes #2661
2023-05-01 19:17:08 +09:00
Hajime Hoshi
e98acd3dc7 internal/graphicsdriver: refactoring: use image.Rectangle 2023-04-29 01:12:05 +09:00
Hajime Hoshi
00e45affe9 all: update OpenGL version from 2.1 to 3.2
'texelFetch' requires OpenGLSL 1.30, which requires OpenGL 3.0+.
macOS might not support OpenGL 3.0 and 3.1, so adopt 3.2.

Updates #1431
2023-04-23 14:25:36 +09:00
Hajime Hoshi
40c38eb9ee internal/graphicsdriver/opengl: refactoring: remove contextPlatform 2023-04-22 21:52:20 +09:00
Hajime Hoshi
8926a4213e internal/graphicsdriver/opengl: refactoring: move consts to gl 2023-04-22 21:20:34 +09:00
Hajime Hoshi
00ed6f08fc internal/graphicsdriver/opengl/gl: refactoring: reduce types 2023-04-22 19:27:56 +09:00
Hajime Hoshi
504006fc22 internal/graphicsdriver/opengl/gl: refactoring: remove unused types 2023-04-22 16:18:18 +09:00
Hajime Hoshi
0495101450 internal/graphicsdriver/opengl/gl: bug fix: build error with GOOS=js 2023-04-22 16:10:49 +09:00
Hajime Hoshi
0542f9daa3 internal/graphicsdriver/opengl/gl: refactoring 2023-04-22 15:59:18 +09:00
Hajime Hoshi
4f69ca4ea9 internal/graphicsdriver/opengl: add a debug mode with a build tag ebitenginegldebug
In the debug mode, GetError is inserted in each GL function call.

Closes #2650
2023-04-22 13:17:08 +09:00
Hajime Hoshi
95709d9182 internal/graphicsdriver/opengl: update GLES version to 3.0
GLES 3.0 is required for GLSL ES 3.0

Updates #1431
2023-04-19 22:43:26 +09:00
Hajime Hoshi
7509c1d7f5 internal/graphicsdriver/opengl: remove the version es100
es300 is requried for 'texelFetch' [1].

[1] https://registry.khronos.org/OpenGL-Refpages/es3.0/html/texelFetch.xhtml

Updates #1431
2023-04-19 22:10:32 +09:00
Hajime Hoshi
a56924b22f internal/graphicsdriver/directx: refactoring 2023-04-09 16:49:52 +09:00
Hajime Hoshi
4473557e23 internal/graphicsdriver/directx: smooth rendering when resizing the window with DirectX 12
Updates #2615
2023-04-09 16:38:29 +09:00
Hajime Hoshi
2423733598 internal/graphicsdriver/directx: bug fix: wrong size was used when resizing
Updates #2633
2023-04-09 16:34:56 +09:00
Hajime Hoshi
2c088b9059 internal/graphicsdriver/directx: resize the swap chain after presenting is done
Updates #2633
2023-04-09 16:29:00 +09:00
Hajime Hoshi
730c7a2ad0 internal/graphicsdriver/directx: refactoring 2023-04-09 15:30:46 +09:00
Hajime Hoshi
78d3e4273b internal/graphicsdriver/directx: remove tearing
This is basically a revert of 0035ba0bd1.
I couldn't confirm that allowing tearing improved FPS. Rather, this
has a potential risk to cause an error at Present of the swap chain due
to an inconsistent argument, though I have not confirmed an actual issue.

Now the DirectX 11 driver was introduced, the situation has changed.

Updates #2034
Updates #2188
2023-04-09 14:47:51 +09:00
Hajime Hoshi
182ac21866 internal/goglfw: separate the Windows version detection to a new package winver 2023-03-31 02:16:01 +09:00
Hajime Hoshi
c0adcee12c Revert "internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7"
This reverts commit a4bfe8a869.

Reason: This doesn't take any effects.

Updates #2613
2023-03-30 22:40:53 +09:00
Hajime Hoshi
a4bfe8a869 internal/graphicsdriver/directx: initialize the refresh rate explicitly for Windows 7
This is an experimental fix inspired by Chromium/ANGLE
https://source.chromium.org/chromium/chromium/src/+/main:third_party/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp;l=491-492;drc=79aa846e38739138918891e8b334fac464dd9b83

Updates #2613
2023-03-30 22:22:26 +09:00
Hajime Hoshi
09250ff4f3 internal/graphicsdriver/directx: adjust buffer count
Apparently the buffer count should be 1 with a non-flipping swap effect.

Updates #2613
2023-03-30 21:09:41 +09:00
Hajime Hoshi
61ced5127b internal/graphicsdriver/directx: limit d3dcompiler versions
For example, the verions 45/44 are alpha and should not be used.

Updates #2613
Updates #2618
2023-03-30 17:54:42 +09:00
Hajime Hoshi
d22158b156 internal/graphicsdriver/directx: use non-flip swap effect for old Windows
Updates #2613
Updates #2619
2023-03-30 12:33:08 +09:00
Hajime Hoshi
0cd832f096 internal/graphicsdriver/directx: check the DLL availability at NewGraphics
Updates #2613
Updates #2618
2023-03-30 01:45:31 +09:00
Hajime Hoshi
3e477d0bbb internal/graphicsdriver/directx: bug fix: d3dcomipler_47.dll might be missing
Updates #2613
Closes #2618
2023-03-30 01:12:46 +09:00
Hajime Hoshi
6858e4b60b internal/graphicsdriver/directx: use QueryInterface to cast IDXGISwapChain to IDXGISwapChain4
QueryInterface is better in terms of error messages than a dumb
pointer casting.
2023-03-30 00:44:39 +09:00
Hajime Hoshi
7fa65ae983 internal/graphicsdriver/directx: reduce unnecessary usages of IDXGISwapChain4
IDXGISwapChain is enough for DirectX 11.

Updates #2613
2023-03-30 00:14:04 +09:00
Hajime Hoshi
c9f1696a5b internal/graphicsdriver/directx: use CreateDXGIFactory instead of CreateDXGIFactory2
CreateDXGIFactory2 is available in Windows 8.1 and newer. This is not
necessary for the current Ebitengine implementation. Use the old version
CreateDXGIFactory to support Windows 8 and older.

Updates #2613
2023-03-29 23:56:17 +09:00
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