English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 29 September 2017, 19:42   #21
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
Direct3D version isn't that important. DXGI is the important part, which apparently can be used as a sort of "new" directdraw without need for using D3D textures. This is probably my starting point, to get something visible in DXGI mode.

Direct3D migration instructions are not really relevant because shaders can't be compatible with D3D10+ anyway -> D3D11+ support can be made from scratch, there is nothing useful to migrate. (Or perhaps it is possible to use d3d9 to render to texture and then copy the texture to DXGI surface but performance probably isn't optimal..)

So far most interesting features are:
- variable sync (gsync/freesync) natively supported, even in windowed mode.
- latency options (that apparently drivers can't decide to ignore which is possible with d3d9)
- fullscreen/windowed mode switching and size changes are "built-in".

probably more..
Toni Wilen is offline  
AdSense AdSense  
Old 30 September 2017, 09:18   #22
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
Quote:
Originally Posted by Toni Wilen View Post
So far most interesting features are:
- variable sync (gsync/freesync) natively supported, even in windowed mode.
- latency options (that apparently drivers can't decide to ignore which is possible with d3d9)
- fullscreen/windowed mode switching and size changes are "built-in".

probably more..
Indeed, it seems that DX11 is fixing all the things of DX9 to make it actually great, certainly in the context of emulation.. Seemsless mode switching sound promising too (think seemless non-lace / lace switching on real CRT like real Amiga )

Quote:
Originally Posted by mark_k View Post
Here's a tiny program (104 bytes long) with source which could possibly be used for display/input latency comparison.
Code:
https://www.media!fire.com/file/97fgadd6go7ka5j/LatencyTest.lha
It disables interrupts. Sets background colour to blue then to yellow immediately (or as immediately as is possible) on pressing left mouse button or joystick fire button. Press right mouse button to reset back to blue. Press both left and right buttons to exit.

If the raster beam is in the visible display area, where the blue->yellow transition is corresponds to the moment the button press was detected.
Giving it a second thought, I think it's indeed something that is similar to do with the button program. If you set the rasterline value for the button press to something within blanking (for example "button 10") it will show a red screen in the visible area immediately as soon as the button is pressed. If I remember correctly the button program resets to black every time at rasterline 0, so it will flicker between black/red/yellow (depending on where you set the value) when you keep the button pressed.
Dr.Venom is offline  
Old 07 October 2017, 16:36   #23
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
Quote:
Originally Posted by Toni Wilen View Post
Direct3D migration instructions are not really relevant because shaders can't be compatible with D3D10+ anyway -> D3D11+ support can be made from scratch, there is nothing useful to migrate. (Or perhaps it is possible to use d3d9 to render to texture and then copy the texture to DXGI surface but performance probably isn't optimal..
While looking for some other information I came across a post that may be relevant for the DX11 topic:

Direct3D 11 missing GetRasterStatus, how do I detect the vertical blank period?

The answer links to these pages, not sure but maybe it's of help somewhere down the line..

DwmGetCompositionTimingInfo function
DWM_TIMING_INFO structure
Dr.Venom is offline  
Old 07 October 2017, 18:16   #24
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
Looks nice, that structure has all the needed info. If reported refresh rate is accurate. At least it can be non-integer now so there is hope it works as expected..
Toni Wilen is offline  
Old 07 October 2017, 19:40   #25
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
One missing piece is simple example how to draw normal 2d texture to DXGI backbuffer using D3D11 with 1:1 mapping. Use of D3D11 seems to be better choice than directly using DXGI surface, for example it makes sure GPU acceleration is in use.

I don't want any emulator/whatever sources, there are usually far too much abstraction and extra stuff. I don't want anything extra. Just simple skeleton code that can be extended with other stuff (fullscreen mode, variable sync, latency stuff, shaders etc)
Toni Wilen is offline  
Old 07 October 2017, 19:58   #26
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,606
I don't know enough to say whether it is helpful at all, but take a look at Direct3D Tutorial Win32 Sample.
mark_k is offline  
Old 07 October 2017, 20:40   #27
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
Quote:
Originally Posted by mark_k View Post
I don't know enough to say whether it is helpful at all, but take a look at Direct3D Tutorial Win32 Sample.
It isn't. Normal samples render 3d objects (or single triangle), not render 2d texture as 1:1 mapped surface.
Toni Wilen is offline  
Old 07 October 2017, 22:26   #28
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,606
Some more links, hopefully some are of some use...

There are some Direct3D 11 tutorials at http://www.rastertek.com/tutdx11.html.
Tutorial 11 covers 2D rendering. That uses its TextureClass::Initialize() function, which calls D3DX11CreateShaderResourceViewFromFile() to create a shader resource view and load texture from file. Rather than doing that you'll want to create a shader resource view manually.

ID3D11Device::CreateShaderResourceView method
D3D11_SHADER_RESOURCE_VIEW_DESC structure

ID3D11Device::CreateTexture2D method

How to: Create a Texture

How to: Initialize a Texture Programmatically

D3D11_USAGE enumeration
You'd probably want to use D3D11_USAGE_DYNAMIC, since that page says:
"A resource that is accessible by both the GPU (read only) and the CPU (write only). A dynamic resource is a good choice for a resource that will be updated by the CPU at least once per frame."
mark_k is offline  
Old 08 October 2017, 10:17   #29
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
To add, maybe one of these links provides a usable example on drawing normal 2D texture:

The following samples demonstrate the Direct2D API.

Direct2D and Direct3D Interoperability Overview: Draw a 2-D Background
Dr.Venom is offline  
Old 08 October 2017, 10:21   #30
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
Tutorial 11 looks good (but still has some "useless" stuff included)

Direct2D is wrong choice, it is not designed for pixel perfect rendering. (Sounds illogical but thats how it is) EDIT: and it would restrict future shader usage too.

Last edited by Toni Wilen; 08 October 2017 at 10:30.
Toni Wilen is offline  
Old 08 October 2017, 11:21   #31
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
Cool, good to know.

In that context the following Github may be of additional use: matt77hias/RasterTek

Quote:
The source code of RasterTek's DirectX 11 tutorials (made ready to use in Visual Studio 2017). Documentation and further explanation can be found at RasterTek.
I am not backing all the (software) design decisions nor the used conventions, but the tutorials get the things done, obtain very pleasing results and are inspiring for people wanting to grasp the rendering pipeline (which is for most special effects less intuitive as opposed to ray tracing).
These tutorials require the obsolete DirectX 11 SDK which is very similar to the DirectX 11 component contained in the Windows SDK. With the exception of the use of D3DXMath (for which DirectXMath is a superior and widely used alternative), nearly all code would remain the same and is still relevant. For more info, I refer to Chuck Walbourn's Living without D3DX.
Use

  1. Install the DirectX 11 SDK. (It is possible that the installer ends with an error code. Nothing to worry about, since I think this is Microsoft's way of notifying the user of installing obsolete Microsoft Software. Roughly stated: if C:\Program Files (x86)\Microsoft DirectX SDK (June 2010) is present and contains data the installation succeeded.)
  2. Make sure the DXSDK_DIR environment variable is set. (If you also use the obsolete DirectX 9 SDK, you need to decide whether DXSDK_DIR points to the DirectX 9 SDK or DirectX 11 SDK.)
  3. You can now open all .sln files and compile the projects.
  4. Have fun!
Here's also a short discussion on the Tutorial 11 with some derived code, see the answer to the question: Creating a simple 2d engine (C++).
Dr.Venom is offline  
Old 08 October 2017, 11:45   #32
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
I am not going to use obsolete SDKs = need to find example that uses vertex shader for orthographic projection. (or precomputes it using CPU)
Toni Wilen is offline  
Old 13 October 2017, 15:10   #33
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
Quote:
Originally Posted by Toni Wilen View Post
I am not going to use obsolete SDKs = need to find example that uses vertex shader for orthographic projection. (or precomputes it using CPU)
In the following thread some code is discussed that uses shaders for orthographic view/projection, see the thread Orthographic camera on gamedev.net

Apparently the OP got it working in the end, so hopefully it's of some help for our case.
Dr.Venom is offline  
Old 13 October 2017, 17:28   #34
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,606
You could look at the DirectX Toolkit (DirectXTK) (blog post).

That includes a kind of 2D sprite engine. Perhaps Src/SpriteBatch.cpp could be helpful? Not necessarily to use the whole thing in WinUAE (just that file is ~1200 lines of code), but about displaying 2D bitmap images.
mark_k is offline  
Old 13 October 2017, 18:42   #35
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
As I already said: I want minimal example. Nothing extra. (EDIT: the point is that I am not interested in learning D3D11, at least not now. First comes DXGI improvements stuff, then much later all the D3D11 extra things)

Last edited by Toni Wilen; 13 October 2017 at 22:07.
Toni Wilen is offline  
Old 14 October 2017, 12:35   #36
Dr.Venom
Registered User
 
Join Date: Jul 2008
Location: Netherlands
Posts: 320
Quote:
Originally Posted by Toni Wilen View Post
First comes DXGI improvements stuff, then much later all the D3D11 extra things)
Which changes related to DXGI are you planning to target first?

With regards to minimum requirements, are you targeting DXGI 1.3 (which seems necessary for the lower-latency swap chain presentation), i.e. minimum requirements will be Windows 8.1 or better?
Dr.Venom is offline  
Old 14 October 2017, 13:53   #37
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
I probably use latest first. Then later (when/if it becomes "official" feature), it will support older versions. Maybe.
Toni Wilen is offline  
Old 22 October 2017, 15:26   #38
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
Very experimental D3D 11 support added..

- Don't try to use fullscreen. (DXGI mode enumeration returns much more info than old ones and again it seems to not be possible to match old style mode with new style)
- Filter settings are ignored.
- Scaling is not available.
- Enables (if available) windowed variable refresh rate mode (DXGI_FEATURE_PRESENT_ALLOW_TEARING). G-Sync confirmed working. Which is nice.
- In theory it may work with Windows 7 but may require 8 or 10 (at this point). Windows 10 16299 only tested.
- No error checking, it just fails if something goes wrong.
- Still requires d3d9x (=June 2010 DX redistributable) for matrix calculations.
- Calls SetMaximumFrameLatency(1) but I am not sure if it has any effect in windowed mode.
- This is very quick and dirty hack of 2D example tutorial.
- There is something wrong with calculations because display quality changes depending on window size. It should be pixel perfect all the time.

EDIT: shaders from tutorial added, must be located at plugins/filtershaders/direct3d11
Attached Files
File Type: zip direct3d11.zip (1,006 Bytes, 16 views)
Toni Wilen is offline  
Old 22 October 2017, 17:06   #39
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,606
Testing winuae.exe dated 2017-10-22 12:52 I couldn't get D3D11 mode to work. Windows 10 16299.19 x64, AMD FirePro W5100.

Log output:
D3D11 free start
D3D11 free end
Max hardware surface size: 16384x16384
Allocated draw temp buffer (1600*1280*32) = 13BEF020
D3D11 init start
CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING) = 00000000 1D3D11 free start
D3D11 free end
D3D11 free start
D3D11 free end
D3D11 ERROR!


Edit: Could use a \n after the CheckFeatureSupport log line...
mark_k is offline  
Old 22 October 2017, 17:16   #40
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,766
More logging added. (btw, don't try to change Direct3D mode on the fly, it isn't going to work. Same with many other options..)
Toni Wilen is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
A method for further improving latency (input lag) in FS-UAE Dr.Venom support.FS-UAE 4 12 September 2017 17:49
Photos and/or measurements of Amiga 500 bLAZER request.Other 143 29 June 2017 18:42
Optimizing DirectX apps for low latency input and longer battery life Dr.Venom support.WinUAE 2 24 April 2017 10:40
What are the measurements of Amiga 1200 case screws Tallrot support.Hardware 9 15 June 2016 11:04
A1200 and B1230 Voltage Measurements for Dummies? Jarin support.Hardware 2 23 January 2014 11:02

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:27.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.29864 seconds with 12 queries