Commit Graph

210 Commits

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