29 October 2017, 11:58 | #61 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Did you use updated vertex shader? (post #49). If yes, then someone needs to find fixed shader/projection calculations. I don't want to know.
|
29 October 2017, 13:02 | #62 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Unfortunately makes no difference.. (i've changed it in the file "_winuae.vs"). Does 1:1 mapping work for you in single line mode? I've tested this now on my LCD with NVidia GTX1070.
I don't think I'll be able to be of much help with that . Sadly without 1:1 mapping this is not going to work for CRT setups. |
29 October 2017, 18:17 | #63 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
That was the whole point of finding Direct3D11 2D example that is usable. I knew it wasn't going to be that simple because most examples are not designed for perfect 1:1 pixel mapping and 2D examples are rare.
|
29 October 2017, 19:05 | #64 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Yeah I understand. Is there a reason for you to think we should be looking for the issue in the shader / projection calculation (and not something else), since double line mode seem to be fine?
|
29 October 2017, 20:56 | #65 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Currently you use DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL. On Windows 10 DXGI_SWAP_EFFECT_FLIP_DISCARD could be more optimal?
That's assuming you don't want to experiment with using dirty rectangles to optimise rendering (telling DXGI which parts of the buffer have changed, which could make use over RDP better/feasible). |
29 October 2017, 20:59 | #66 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
RTG needs partial updates. Currently it flickers because it is not yet handled properly.
|
30 October 2017, 14:22 | #67 | ||
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Toni, could the following be causing the "blurriness" issue in single line mode?
Half-Pixel Offset in DirectX 11 Some quotes: Quote:
Quote:
Code:
Texture2D g_Texture : register(t0); SamplerState g_SamplerState : register(s0); cbuffer : register(b0) { float2 g_ScreenResolution; }; void PixelShader(float2 Position : SV_Position, out float4 Color : SV_Target) { Color = g_Texture.Sample(g_SamplerState, Position / g_ScreenResolution); } Last edited by Dr.Venom; 30 October 2017 at 14:30. |
||
30 October 2017, 18:14 | #68 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
Explanation makes sense but the shader fix does not (at least not for me). Not enough information.
|
30 October 2017, 20:23 | #69 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
With regards to the half pixel offset possibly being the culprit in single line mode; looking at the corsair tekst in single line mode enlarged (fourth picture in post #60 ), it seems that it may be interpolated / sampled just between the lines. I.e. the vertical white stripes of the letters seem correct, but the horizontal white pixels / lines in the "corsair" text are all grey.
Is the input to the shader by any chance an odd number of lines in single line mode, but an even number of lines in double-line-mode? Just guessing as to what is happening in single line mode, and why it seems to be correct in double line mode.. |
30 October 2017, 22:14 | #70 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
|
|
01 November 2017, 13:16 | #71 |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
I created a simple test picture with dpaint that shows a white single pixel line square and cross on black background. (Upped to the zone as a bootable adf "testpicture.zip").
This may be helpful to more easily check whether there are display irregularities (maybe also useful when implementing integer scaling modes..) It clearly shows the difference between double line mode and single line mode. Double line mode is showing the picture perfectly. In single line mode all horizontal lines are grey (vertical lines are correct). This strongly suggests there's a half pixel offset in the y direction, where color is sampled as an average of white and black, resulting in the grey lines. From what I read D3D11 already applies the half-pixel offset (that was explicitly needed in d3d9) in the background, so it's not needed for D3D10 and 11. You don't by any chance have a half-pixel offset left over somewhere (from d3d9 code) in the display code? |
01 November 2017, 14:06 | #72 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
As I already said: all the maths is from that 2d d3d11 example. I don't want to know how matrixes and shaders exactly work, I want ready made perfect example solution.
EDIT: and it is not specific to vertical, odd width or height causes it, and some other "not exactly aligned" values. Last edited by Toni Wilen; 01 November 2017 at 19:39. |
02 November 2017, 20:59 | #73 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Is there any change if you vary window size slightly? I remember seeing extra/missing lines in D3D9 mode when window width/height is odd.
Adding an option to use the WARP renderer for D3D11 could be useful. Both to compare with how hardware drivers render, but also because it allows D3D11 mode to be used anywhere, e.g. with no graphics driver installed, in a VM which doesn't support hardware 3D acceleration, on some old PC with pre-DX9-class graphics card etc. I wonder how non-vsync/with-tearing would work with WARP... Edit: The WARP renderer might be used by default if there's no suitable hardware/driver. But a manual option would be good for testing. Last edited by mark_k; 02 November 2017 at 22:20. |
04 November 2017, 14:01 | #74 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
There are two ways to make WinUAE use the WARP device at the moment.
1. Install the Windows SDK then run dxcpl.exe. Click Edit List... and add the WinUAE executable to the list. Check the Force WARP box and click Apply. 2. If you don't want to install the Windows SDK, you can patch WinUAE to use the WARP device. Note that these details are for the current unofficial-beta 32-bit winuae.exe. Official betas are built with different optimisation level so they may not apply there. This patch effectively changes the source code line pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, cdflags, levels, 2, D3D11_SDK_VERSION, &d3d->m_device, NULL, &d3d->m_deviceContext); to pD3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, cdflags, levels, 2, D3D11_SDK_VERSION, &d3d->m_device, NULL, &d3d->m_deviceContext); Using a binary file editor, load your backup/renamed winuae.exe into it. Search for the byte sequence 6A 20 6A 00 6A 01 6A 00 Replace the 01 with 05 so it becomes 6A 20 6A 00 6A 05 6A 00 Both methods seemed to work OK for me. Windowed and full-window modes work (no tearing, sadly). Full-screen doesn't. Maybe that's because WinUAE enumerates only physical hardware adapters for full-screen mode??? Or perhaps the WARP device just doesn't support full-screen mode. Dr.Venom: Would be interested to hear whether you see the same issues with the WARP device... |
04 November 2017, 14:38 | #75 | |
Registered User
Join Date: Jul 2008
Location: Netherlands
Posts: 485
|
Quote:
With the WARP patched exe the same issue as posted in #71 occurs for me, so no change. I imagine you're seeing the same issue in single line mode? (You could use the testpicture.zip from the zone if you haven't done so already.) |
|
04 November 2017, 14:57 | #76 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Ah yes, I see the problem both with hardware and WARP renderers. So it's not driver-specific, but whether it occurs does seem to depend on the Amiga display mode. I didn't see it with HIGHGFX or SUPER72 modes, but did with PAL.
|
04 November 2017, 20:04 | #77 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
In UpdateBuffers() you have:
Code:
float left, right, top, bottom; float positionX, positionY; positionX = (d3d->m_screenWidth - d3d->m_bitmapWidth) / 2.0 + d3d->xoffset; positionY = (d3d->m_screenHeight - d3d->m_bitmapHeight) / 2.0 + d3d->yoffset; // Calculate the screen coordinates of the left side of the bitmap. left = (float)((d3d->m_screenWidth / 2) * -1) + positionX; // Calculate the screen coordinates of the right side of the bitmap. right = left + (float)d3d->m_bitmapWidth; // Calculate the screen coordinates of the top of the bitmap. top = (float)(d3d->m_screenHeight / 2) - positionY; // Calculate the screen coordinates of the bottom of the bitmap. bottom = top - (float)d3d->m_bitmapHeight; Let's plug some numbers into the above: screenWidth = 400, screenHeight = 300, bitmapWidth = 376, bitmapHeight = 283 (assume xoffset and yoffset are 0 here) Then: positionX = (400 - 376)/2.0 = 24/2.0 = 12.0 positionY = (300 - 283)/2.0 = 17/2.0 = 8.5 left = (400/2 × -1) + 12.0 = -200.0 + 12.0 = -188.0 right = -188.0 + 376.0 = 188.0 top = (float)(300/2) - 8.5 = 150.0 - 8.5 = 141.5 bottom = 141.5 - 283.0 = -141.5 Notice how top and bottom are not whole numbers. How about reworking the calculations like this: Code:
// positionX and positionY no longer used // Calculate the screen coordinates of the left side of the bitmap. left = d3d->xoffset - (float)((d3d->m_bitmapWidth + 1)/2); // +1 to round properly, probably doesn't matter??? // Calculate the screen coordinates of the right side of the bitmap. right = left + (float)d3d->m_bitmapWidth; // Calculate the screen coordinates of the top of the bitmap. top = d3d->yoffset - (float)((d3d->m_bitmapHeight + 1)/2); // +1 to round properly, probably doesn't matter??? // Calculate the screen coordinates of the bottom of the bitmap. bottom = top - (float)d3d->m_bitmapHeight; Last edited by mark_k; 04 November 2017 at 20:29. |
04 November 2017, 20:33 | #78 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
I already did that few days ago. No change.
|
04 November 2017, 21:26 | #79 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,333
|
Hmm, OK next guess...
Code:
// Create a texture sampler state description. samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; Have you tried changing that to D3D11_FILTER_MIN_MAG_MIP_POINT instead? (But there's probably still an off-by-half-a-pixel error somewhere.) Also (not related to this problem), similarly to D3D9, should probably use D3D11_TEXTURE_ADDRESS_MIRROR or D3D11_TEXTURE_ADDRESS_CLAMP for AddressU and AddressV to avoid "texture wraparound shadow". |
06 November 2017, 21:26 | #80 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
samplerDesc.Filter = filterd3d->gfx_filter_bilinear ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_POINT;
Seems to fix it, at least it looks better now. (WRAP -> CLAMP also changed). (RTG is also fixed) |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Photos and/or measurements of Amiga 500 | bLAZER | request.Other | 144 | 16 October 2018 01:40 |
A method for further improving latency (input lag) in FS-UAE | Dr.Venom | support.FS-UAE | 4 | 12 September 2017 16:49 |
Optimizing DirectX apps for low latency input and longer battery life | Dr.Venom | support.WinUAE | 2 | 24 April 2017 09:40 |
What are the measurements of Amiga 1200 case screws | Tallrot | support.Hardware | 9 | 15 June 2016 10:04 |
A1200 and B1230 Voltage Measurements for Dummies? | Jarin | support.Hardware | 2 | 23 January 2014 10:02 |
|
|