Jump to content

  • Log In with Google      Sign In   
  • Create Account

NightCreature83

Member Since 21 Feb 2008
Offline Last Active Today, 03:02 AM

Posts I've Made

In Topic: DX11 black screen when windowed.

12 September 2016 - 11:40 AM

It works perfectly now, thank you very much to both!

What I don't understand is why now, and not before. Anyway it's solved now, thank you.

I think the Windows 10 drivers got stricter with the inclusion of DX12, because the first time I noticed this happening was in the switch from WIn 8 to 10


In Topic: DX11 black screen when windowed.

12 September 2016 - 02:49 AM

If you dont pass it the actual GetClientRect window size the problem I was seeing with Dedicated GPUs was that the compositing and final output to the window was actually still happening on the iGPU instead of on the dGPU.

 

The DX11 adapter selection should be enough to select the dGPU and you dont need to add any of the NV or AMD apis to force the selection of the GPU.


In Topic: Getting debug information using TextOut()

31 August 2016 - 01:18 PM

 

You can use OutputDebugString() which will print to your console window in the debugger if you are using Visual Studio or you can see this by using DebugView without a debugger.

When dealing with GDI as TextOut is you need a WM_PAINT or similar message to update the screen in.

 

Hi, thanks for your response. I am a bit confused first of all. I don't seem to have a 'console' window, just the win32 window that the demo creates, so I dont know where this output goes? I will have a look into DebugView.

 

 

It's been quite awhile since I've written a Win32 game but if I'm not mistaken, calling InvalidateRect() causes a WM_Paint messages to be sent. Setup a timer to periodically call InvalidateRect() and you should see your text output update. You'll probably want to store that hwnd value from when you create the window so that you'll have access to it for the first parameter. You can use a NULL for the rect parameter to paint the entire window's contents and then it's just whether you want to erase the current contents of the window or not.

 

Thank you, I have kind of got it to work. I am seeing the debug text flicker on the screen, as if it is getting overwritten with a blank white fill or something... I am not sure why. Win32 stuff is so confusing...

 

My message loop now looks like this

    while (msg.message != WM_QUIT)
    {
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
        {
            game.run(hwnd);
            InvalidateRect(hwnd, NULL, false);
        }
    }

 

with WM paint

 

    case WM_PAINT:
    {
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hwnd, &ps);

        //Textout output
        wchar_t text[] = L"tess test test";
        
        TextOut(hdc, 1, 1, text, ARRAYSIZE(text));
        //Textout output end

        //FillRect(hdc, &ps.rcPaint, (HBRUSH)(COLOR_WINDOW + 1));

        EndPaint(hwnd, &ps);
    }

 

When FillRect is not commented out the screen stays white. Thanks for all your help guys.

 

Your console window is the output window in Visual Studio, were you can see which Dlls and symbols are loaded on application start up.


In Topic: DirectX 11 Sharpdx - Instancing - ATI Vs Nvidia

30 August 2016 - 04:21 AM

Thanks bud, I have uncovered a raft of small issues that didnt seem to bother the ATI Driver but were showing up.  The worst being a data alignment issue on the Matrix instance buffer.  This wasn't an issue in one SetVertexBuffer call because I was setting the alignment correctly, BUT if I used the other call, the creation of the binding was incorrectly offset.  This was causing an issue.  

 

I've attached the code for Sharpdx for everyone's reference in future.

    D3D11.InfoQueue m_infoQueue = m_parentDevice.QueryInterface<D3D11.InfoQueue>();

    try
    {
        Context.DrawInstanced(vb.m_bufferRun, a_renderCount, vb.m_startingIndex, 0);
    }
    catch
    {               
        for (int j = 0; j < m_infoQueue.NumStoredMessages; j++)
        {
            D3D11.Message a = m_infoQueue.GetMessage(j);

            Console.WriteLine(a.Description);
        }
    }

On another note, I was not setting the backbuffer resolution to the correct resolution and leaving it to be set by the window handle, this also caused an exception in relation to setting the stencil buffer in SetRenderTargets.  This also was fixed.  Thanks for your help!


Added note: still have to wait on my colleague to test the changes :)  But I feel these issues were at the core of it.  Also, Sharpdx AppendAligned doesn't seem to work and was causing an issue!

YEah NVIdia can be a bit finicky when you dont set the backbuffers to the exact client rect size, I saw extreme slowdowns in those cases (a 970M ran at the same speeds of a 4600HD).


In Topic: Getting debug information using TextOut()

30 August 2016 - 04:14 AM

You can use OutputDebugString() which will print to your console window in the debugger if you are using Visual Studio or you can see this by using DebugView without a debugger.

When dealing with GDI as TextOut is you need a WM_PAINT or similar message to update the screen in.


PARTNERS