From 3f941c5e9ca46792a2044bd7126e7f32d0ca4d30 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Fri, 6 Jul 2018 12:02:14 -0700 Subject: Updated Asteroids demo to handle minimized window in Vulkan; updated BlendTexturesPS_GL.glsl --- DiligentCore | 2 +- DiligentSamples | 2 +- Projects/Asteroids/src/WinWrapper.cpp | 22 +++++++++++++++------- .../assets/Shaders/RTTest/BlendTexturesPS_GL.glsl | 6 +++++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/DiligentCore b/DiligentCore index a029082..b3311e6 160000 --- a/DiligentCore +++ b/DiligentCore @@ -1 +1 @@ -Subproject commit a029082a02e3e1046b7929f3e5ad75a5df930bac +Subproject commit b3311e60b7dc6ee1581469e2d3ac8854cdcb5ba0 diff --git a/DiligentSamples b/DiligentSamples index 018b319..50da5b0 160000 --- a/DiligentSamples +++ b/DiligentSamples @@ -1 +1 @@ -Subproject commit 018b3197f076b4aa5e76ce9fa84a8347b70d737a +Subproject commit 50da5b0e798543b0617cec8c9777045eb11f00c7 diff --git a/Projects/Asteroids/src/WinWrapper.cpp b/Projects/Asteroids/src/WinWrapper.cpp index 036b205..6b0ecfe 100644 --- a/Projects/Asteroids/src/WinWrapper.cpp +++ b/Projects/Asteroids/src/WinWrapper.cpp @@ -142,28 +142,28 @@ LRESULT CALLBACK WindowProc( UINT ww = LOWORD(lParam); UINT wh = HIWORD(lParam); - // Ignore resizing to minimized - if (ww == 0 || wh == 0) return 0; - gSettings.windowWidth = (int)ww; gSettings.windowHeight = (int)wh; gSettings.renderWidth = (UINT)(double(gSettings.windowWidth) * gSettings.renderScale); gSettings.renderHeight = (UINT)(double(gSettings.windowHeight) * gSettings.renderScale); // Update camera projection - float aspect = (float)gSettings.renderWidth / (float)gSettings.renderHeight; - gCamera.Projection(XM_PIDIV2 * 0.8f * 3 / 2, aspect); + if(gSettings.renderWidth !=0 && gSettings.renderHeight !=0) + { + float aspect = (float)gSettings.renderWidth / (float)gSettings.renderHeight; + gCamera.Projection(XM_PIDIV2 * 0.8f * 3 / 2, aspect); + } // Resize currently active swap chain switch (gSettings.mode) { case Settings::RenderMode::NativeD3D11: - if(gWorkloadD3D11) + if(gWorkloadD3D11 && gSettings.renderWidth !=0 && gSettings.renderHeight !=0) gWorkloadD3D11->ResizeSwapChain(gDXGIFactory, hWnd, gSettings.renderWidth, gSettings.renderHeight); break; case Settings::RenderMode::NativeD3D12: - if(gWorkloadD3D12) + if(gWorkloadD3D12 && gSettings.renderWidth !=0 && gSettings.renderHeight !=0) gWorkloadD3D12->ResizeSwapChain(gDXGIFactory, hWnd, gSettings.renderWidth, gSettings.renderHeight); break; @@ -284,6 +284,14 @@ LRESULT CALLBACK WindowProc( } return 0; } + + case WM_GETMINMAXINFO: + { + LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam; + lpMMI->ptMinTrackSize.x = 320; + lpMMI->ptMinTrackSize.y = 240; + return 0; + } default: return DefWindowProc(hWnd, message, wParam, lParam); diff --git a/Tests/TestApp/assets/Shaders/RTTest/BlendTexturesPS_GL.glsl b/Tests/TestApp/assets/Shaders/RTTest/BlendTexturesPS_GL.glsl index 2139000..726dfee 100644 --- a/Tests/TestApp/assets/Shaders/RTTest/BlendTexturesPS_GL.glsl +++ b/Tests/TestApp/assets/Shaders/RTTest/BlendTexturesPS_GL.glsl @@ -9,7 +9,11 @@ layout(location = 0) out vec4 out_Color; void main() { - vec2 UV = vec2( ex_UV.x, 1.0 - ex_UV.y ); + vec2 UV = vec2( ex_UV.x, ex_UV.y ); +#ifndef TARGET_API_VULKAN + UV.y = 1.0 - UV.y; +#endif + vec4 Col0 = texture(g_tex2DTest0, UV); vec4 Col1 = texture(g_tex2DTest1, UV); vec4 Col2 = texture(g_tex2DTest2, UV); -- cgit v1.2.3