Loading PCSamples/IntroGraphics/SimpleComputePC12/DeviceResources.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ void DeviceResources::CreateDeviceResources() m_fence->SetName(L"DeviceResources"); m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); m_fenceEvent.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_fenceEvent.IsValid()) { throw std::exception("CreateEvent"); Loading PCSamples/IntroGraphics/SimpleComputePC12/SimpleComputePC12.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ namespace pCmdList->ResourceBarrier(1, &barrierDesc); } struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; } Sample::Sample() noexcept(false) : Loading Loading @@ -158,6 +164,7 @@ void Sample::Update(DX::StepTimer const& timer) if (pad.IsViewPressed()) { ExitSample(); m_terminateThread = true; } if ((m_gamePadButtons.a == DirectX::GamePad::ButtonStateTracker::PRESSED)) Loading PCSamples/IntroGraphics/SimpleComputePC12/SimpleComputePC12.h +0 −12 Original line number Diff line number Diff line Loading @@ -80,17 +80,6 @@ public: void GetDefaultSize( int& width, int& height ) const; private: struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; struct Vertex { DirectX::XMFLOAT4 position; DirectX::XMFLOAT2 texcoord; }; void Update(DX::StepTimer const& timer); void Render(); Loading Loading @@ -143,7 +132,6 @@ private: std::atomic<uint32_t> m_renderIndex; // which bank of fractal data the renderer is using, the value is either 0 or 1, compute is using the inverse CB_FractalCS* m_fractalData; // data for compute shader constant buffer on how many iterations on the Mandelbrot set and the bounds DirectX::XMFLOAT4 m_window; // the bounds for the Mandelbrot set being calculated on the CPU uint32_t m_fractalMaxIterations; // number of iterations when calculating the Mandelbrot set on the CPU std::atomic<bool> m_windowUpdated; Loading UWPSamples/IntroGraphics/SimpleComputeUWP12/DeviceResources.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,7 @@ void DeviceResources::CreateDeviceResources() m_fence->SetName(L"DeviceResources"); m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); m_fenceEvent.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_fenceEvent.IsValid()) { throw std::exception("CreateEvent"); Loading UWPSamples/IntroGraphics/SimpleComputeUWP12/SimpleComputeUWP12.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,12 @@ namespace pCmdList->ResourceBarrier(1, &barrierDesc); } struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; } Sample::Sample() : Loading @@ -75,6 +81,8 @@ Sample::Sample() : m_usingAsyncCompute(false), m_renderIndex(0), m_terminateThread(false), m_suspendThread(false), m_computeThread(nullptr), m_fractalMaxIterations(300) { // Renders only 2D, so no need for a depth buffer. Loading Loading @@ -105,6 +113,10 @@ void Sample::Initialize(::IUnknown* window, int width, int height, DXGI_MODE_ROT m_deviceResources->CreateWindowSizeDependentResources(); CreateWindowSizeDependentResources(); m_computeResumeSignal.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_computeResumeSignal.IsValid()) throw std::exception("CreateEvent"); m_computeThread = new std::thread(&Sample::AsyncComputeThreadProc, this); } Loading Loading @@ -413,6 +425,8 @@ void Sample::OnDeactivated() void Sample::OnSuspending() { ResetEvent(m_computeResumeSignal.Get()); m_suspendThread = true; } void Sample::OnResuming() Loading @@ -420,6 +434,9 @@ void Sample::OnResuming() m_timer.ResetElapsedTime(); m_gamePadButtons.Reset(); m_keyboardButtons.Reset(); m_suspendThread = false; SetEvent(m_computeResumeSignal.Get()); } void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) Loading Loading @@ -799,6 +816,11 @@ void Sample::AsyncComputeThreadProc() while (!m_terminateThread) { if (m_suspendThread) { (void)WaitForSingleObject(m_computeResumeSignal.Get(), INFINITE); } LARGE_INTEGER CurrentFrameTime; QueryPerformanceCounter(&CurrentFrameTime); double DeltaTime = (double)(CurrentFrameTime.QuadPart - LastFrameTime.QuadPart) / (double)PerfFreq.QuadPart; Loading Loading @@ -832,6 +854,11 @@ void Sample::AsyncComputeThreadProc() continue; } if (m_suspendThread) { (void)WaitForSingleObject(m_computeResumeSignal.Get(), INFINITE); } m_computeFPS.Tick(static_cast<FLOAT>(DeltaTime)); UpdateFractalData(); Loading Loading
PCSamples/IntroGraphics/SimpleComputePC12/DeviceResources.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -228,7 +228,7 @@ void DeviceResources::CreateDeviceResources() m_fence->SetName(L"DeviceResources"); m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); m_fenceEvent.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_fenceEvent.IsValid()) { throw std::exception("CreateEvent"); Loading
PCSamples/IntroGraphics/SimpleComputePC12/SimpleComputePC12.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,12 @@ namespace pCmdList->ResourceBarrier(1, &barrierDesc); } struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; } Sample::Sample() noexcept(false) : Loading Loading @@ -158,6 +164,7 @@ void Sample::Update(DX::StepTimer const& timer) if (pad.IsViewPressed()) { ExitSample(); m_terminateThread = true; } if ((m_gamePadButtons.a == DirectX::GamePad::ButtonStateTracker::PRESSED)) Loading
PCSamples/IntroGraphics/SimpleComputePC12/SimpleComputePC12.h +0 −12 Original line number Diff line number Diff line Loading @@ -80,17 +80,6 @@ public: void GetDefaultSize( int& width, int& height ) const; private: struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; struct Vertex { DirectX::XMFLOAT4 position; DirectX::XMFLOAT2 texcoord; }; void Update(DX::StepTimer const& timer); void Render(); Loading Loading @@ -143,7 +132,6 @@ private: std::atomic<uint32_t> m_renderIndex; // which bank of fractal data the renderer is using, the value is either 0 or 1, compute is using the inverse CB_FractalCS* m_fractalData; // data for compute shader constant buffer on how many iterations on the Mandelbrot set and the bounds DirectX::XMFLOAT4 m_window; // the bounds for the Mandelbrot set being calculated on the CPU uint32_t m_fractalMaxIterations; // number of iterations when calculating the Mandelbrot set on the CPU std::atomic<bool> m_windowUpdated; Loading
UWPSamples/IntroGraphics/SimpleComputeUWP12/DeviceResources.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -266,7 +266,7 @@ void DeviceResources::CreateDeviceResources() m_fence->SetName(L"DeviceResources"); m_fenceEvent.Attach(CreateEvent(nullptr, FALSE, FALSE, nullptr)); m_fenceEvent.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_fenceEvent.IsValid()) { throw std::exception("CreateEvent"); Loading
UWPSamples/IntroGraphics/SimpleComputeUWP12/SimpleComputeUWP12.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,12 @@ namespace pCmdList->ResourceBarrier(1, &barrierDesc); } struct CB_FractalCS { DirectX::XMFLOAT4 MaxThreadIter; DirectX::XMFLOAT4 Window; }; } Sample::Sample() : Loading @@ -75,6 +81,8 @@ Sample::Sample() : m_usingAsyncCompute(false), m_renderIndex(0), m_terminateThread(false), m_suspendThread(false), m_computeThread(nullptr), m_fractalMaxIterations(300) { // Renders only 2D, so no need for a depth buffer. Loading Loading @@ -105,6 +113,10 @@ void Sample::Initialize(::IUnknown* window, int width, int height, DXGI_MODE_ROT m_deviceResources->CreateWindowSizeDependentResources(); CreateWindowSizeDependentResources(); m_computeResumeSignal.Attach(CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE | SYNCHRONIZE)); if (!m_computeResumeSignal.IsValid()) throw std::exception("CreateEvent"); m_computeThread = new std::thread(&Sample::AsyncComputeThreadProc, this); } Loading Loading @@ -413,6 +425,8 @@ void Sample::OnDeactivated() void Sample::OnSuspending() { ResetEvent(m_computeResumeSignal.Get()); m_suspendThread = true; } void Sample::OnResuming() Loading @@ -420,6 +434,9 @@ void Sample::OnResuming() m_timer.ResetElapsedTime(); m_gamePadButtons.Reset(); m_keyboardButtons.Reset(); m_suspendThread = false; SetEvent(m_computeResumeSignal.Get()); } void Sample::OnWindowSizeChanged(int width, int height, DXGI_MODE_ROTATION rotation) Loading Loading @@ -799,6 +816,11 @@ void Sample::AsyncComputeThreadProc() while (!m_terminateThread) { if (m_suspendThread) { (void)WaitForSingleObject(m_computeResumeSignal.Get(), INFINITE); } LARGE_INTEGER CurrentFrameTime; QueryPerformanceCounter(&CurrentFrameTime); double DeltaTime = (double)(CurrentFrameTime.QuadPart - LastFrameTime.QuadPart) / (double)PerfFreq.QuadPart; Loading Loading @@ -832,6 +854,11 @@ void Sample::AsyncComputeThreadProc() continue; } if (m_suspendThread) { (void)WaitForSingleObject(m_computeResumeSignal.Get(), INFINITE); } m_computeFPS.Tick(static_cast<FLOAT>(DeltaTime)); UpdateFractalData(); Loading