Commit: 61014e1dd9b6fe7594ae15cdfb6e22ca9d6e48c6
Author: Julian Eisel
Date: Fri Aug 23 23:45:14 2019 +0200
Branches: soc-2019-openxr
https://developer.blender.org/rB61014e1dd9b6fe7594ae15cdfb6e22ca9d6e48c6
Remove hack to resize the usable default framebuffer region
===================================================================
M intern/ghost/intern/GHOST_Context.h
M intern/ghost/intern/GHOST_ContextD3D.cpp
M intern/ghost/intern/GHOST_ContextD3D.h
M intern/ghost/intern/GHOST_ContextWGL.cpp
M intern/ghost/intern/GHOST_ContextWGL.h
M intern/ghost/intern/GHOST_SystemWin32.cpp
M intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_Context.h
b/intern/ghost/intern/GHOST_Context.h
index c780d4503eb..b8372dd7bc3 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -137,18 +137,6 @@ class GHOST_Context : public GHOST_IContext {
return 0;
}
- /**
- * For offscreen rendering, we create an invisible window. So this can be
used to update the
- * offscreen buffer size by changing the size of this context's window.
- *
- * \note This actually changes the window size! That is the only way to
change the default
- * framebuffer size. Better only use for offscreen contexts.
- */
- virtual GHOST_TSuccess setDefaultFramebufferSize(GHOST_TUns32 /*width*/,
GHOST_TUns32 /*height*/)
- {
- return GHOST_kFailure;
- }
-
protected:
void initContextGLEW();
diff --git a/intern/ghost/intern/GHOST_ContextD3D.cpp
b/intern/ghost/intern/GHOST_ContextD3D.cpp
index 59a3d1de75a..b9bdb28dd7e 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.cpp
+++ b/intern/ghost/intern/GHOST_ContextD3D.cpp
@@ -66,35 +66,6 @@ GHOST_TSuccess GHOST_ContextD3D::releaseDrawingContext()
return GHOST_kFailure;
}
-GHOST_TSuccess GHOST_ContextD3D::setDefaultFramebufferSize(GHOST_TUns32 width,
GHOST_TUns32 height)
-{
- RECT rect = {0, 0, (long)width, (long)height};
- RECT winrect;
-
- /* To use swapchain buffers/textures with custom size, the hidden window has
to be resized. */
-
- GetWindowRect(m_hWnd, &winrect);
-
- WIN32_CHK(AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, false, 0));
-
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
-
- if (((winrect.right - winrect.left) != width) || ((winrect.bottom -
winrect.top) != height)) {
- return SetWindowPos(m_hWnd,
- HWND_TOP,
- 0,
- 0,
- width,
- height,
- SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOMOVE |
SWP_NOZORDER) ?
- GHOST_kSuccess :
- GHOST_kFailure;
- }
-
- return GHOST_kSuccess;
-}
-
GHOST_TSuccess GHOST_ContextD3D::setupD3DLib()
{
if (s_d3d_lib == NULL) {
diff --git a/intern/ghost/intern/GHOST_ContextD3D.h
b/intern/ghost/intern/GHOST_ContextD3D.h
index 1a5cdbd77e1..c482992a6e2 100644
--- a/intern/ghost/intern/GHOST_ContextD3D.h
+++ b/intern/ghost/intern/GHOST_ContextD3D.h
@@ -55,8 +55,6 @@ class GHOST_ContextD3D : public GHOST_Context {
*/
GHOST_TSuccess releaseDrawingContext();
- GHOST_TSuccess setDefaultFramebufferSize(GHOST_TUns32 width, GHOST_TUns32
height);
-
/**
* Call immediately after new to initialize. If this fails then immediately
delete the object.
* \return Indication as to whether initialization has succeeded.
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp
b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 1991dff6fa1..d4851450ce8 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -24,7 +24,6 @@
*/
#include "GHOST_ContextWGL.h"
-#include "GHOST_Rect.h"
#include <tchar.h>
@@ -32,8 +31,6 @@
#include <cassert>
#include <vector>
-#include <windef.h>
-
HGLRC GHOST_ContextWGL::s_sharedHGLRC = NULL;
int GHOST_ContextWGL::s_sharedCount = 0;
@@ -143,35 +140,6 @@ GHOST_TSuccess GHOST_ContextWGL::releaseDrawingContext()
}
}
-GHOST_TSuccess GHOST_ContextWGL::setDefaultFramebufferSize(GHOST_TUns32 width,
GHOST_TUns32 height)
-{
- RECT rect = {0, 0, (long)width, (long)height};
- RECT winrect;
-
- /* To get a default framebuffer with custom size, the hidden window has to
be resized. */
-
- GetWindowRect(m_hWnd, &winrect);
-
- WIN32_CHK(AdjustWindowRectEx(&rect, WS_OVERLAPPEDWINDOW, false, 0));
-
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
-
- if (((winrect.right - winrect.left) != width) || ((winrect.bottom -
winrect.top) != height)) {
- return SetWindowPos(m_hWnd,
- HWND_TOP,
- 0,
- 0,
- width,
- height,
- SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOMOVE |
SWP_NOZORDER) ?
- GHOST_kSuccess :
- GHOST_kFailure;
- }
-
- return GHOST_kSuccess;
-}
-
/* Ron Fosner's code for weighting pixel formats and forcing software.
* See http://www.opengl.org/resources/faq/technical/weight.cpp
*/
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h
b/intern/ghost/intern/GHOST_ContextWGL.h
index 99d1bb6efe5..a8d2c18b463 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -102,8 +102,6 @@ class GHOST_ContextWGL : public GHOST_Context {
*/
GHOST_TSuccess getSwapInterval(int &intervalOut);
- GHOST_TSuccess setDefaultFramebufferSize(GHOST_TUns32 width, GHOST_TUns32
height);
-
private:
int choose_pixel_format(bool stereoVisual, bool needAlpha);
int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp
b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 47cbece963f..fc9b0677d9d 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -297,29 +297,6 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const
STR_String &title,
return window;
}
-LRESULT WINAPI offscreen_s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
lParam)
-{
- LRESULT lResult = 0;
- bool event_handled = false;
-
- switch (msg) {
- case WM_GETMINMAXINFO: {
- ::DefWindowProc(hwnd, msg, wParam, lParam);
- MINMAXINFO *mmi = (MINMAXINFO *)lParam;
- mmi->ptMaxTrackSize.x = LONG_MAX;
- mmi->ptMaxTrackSize.y = LONG_MAX;
- event_handled = true;
- break;
- }
- }
-
- if (!event_handled) {
- lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
- }
-
- return lResult;
-}
-
/**
* Create a new offscreen context.
* Never explicitly delete the window, use #disposeContext() instead.
@@ -329,30 +306,9 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
{
bool debug_context = false; /* TODO: inform as a parameter */
- /* TODO Doesn't use STATIC class to allow offscreen context framebuffer
bigger than screen size.
- * For that, WM_GETMINMAXINFO event has to be listented to in custom WndProc
callback. Need to
- * verify this doesn't cause side effects, also, de-duplicate class
definition.
- */
GHOST_Context *context;
- WNDCLASSW wc = {0};
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = offscreen_s_wndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = ::GetModuleHandle(0);
- wc.hCursor = ::LoadCursor(0, IDC_ARROW);
- wc.hbrBackground =
-#ifdef INW32_COMPISITING
- (HBRUSH)CreateSolidBrush
-#endif
- (0x00000000);
- wc.lpszMenuName = 0;
- wc.lpszClassName = L"GHOST_OffscreenWindowClass";
-
- // Use RegisterClassEx for setting small icon
- ::RegisterClassW(&wc);
- HWND wnd = CreateWindowA("GHOST_OffscreenWindowClass",
+ HWND wnd = CreateWindowA("STATIC",
"BlenderGLEW",
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
0,
@@ -460,29 +416,7 @@ GHOST_IContext
*GHOST_SystemWin32::createOffscreenContextD3D()
{
GHOST_Context *context;
- /* TODO Doesn't use STATIC class to allow offscreen context framebuffer
bigger than screen size.
- * For that, WM_GETMINMAXINFO event has to be listented to in custom WndProc
callback. Need to
- * verify this doesn't cause side effects, also, de-duplicate class
definition.
- */
- WNDCLASSW wc = {0};
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = offscreen_s_wndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = ::GetModuleHandle(0);
- wc.hCursor = ::LoadCursor(0, IDC_ARROW);
- wc.hbrBackground =
-#ifdef INW32_COMPISITING
- (HBRUSH)CreateSolidBrush
-#endif
- (0x00000000);
- wc.lpszMenuName = 0;
- wc.lpszClassName = L"GHOST_OffscreenWindowClass";
-
- // Use RegisterClassEx for setting small icon
- ::RegisterClassW(&wc);
-
- HWND wnd = CreateWindowA("GHOST_OffscreenWindowClass",
+ HWND wnd = CreateWindowA("STATIC",
"BlenderD3D",
WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
0,
diff --git a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
index 0b3c07b8984..60dff3a83d8 100644
--- a/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
+++ b/intern/ghost/intern/GHOST_XrGraphicsBinding.cpp
@@ -154,7 +154,6 @@ class GHOST_XrGraphicsBindingOpenGL : public
GHOST_IXrGraphicsBinding {
swapchain_image);
ogl_ctx->activateDrawingContext();
- ogl_ctx->setDefaultFramebufferSize(draw_info->width, draw_info->height);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo);
@@ -258,7 +257,6 @@ class GHOST_XrGraphicsBindingD3D : public
GHOST_IXrGraphicsBinding {
swapchain_image);
ogl_ctx->activateDrawingContext();
- ogl_ctx->setDefaultFramebufferSize(draw_info->width, draw_info->height);
# if 0
/* Ideally we'd just create a render target view for the OpenXR swapchain
image texture and
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs