Commit Graph

823 Commits

Author SHA1 Message Date
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
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