Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2019-04-25 15:09:01 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-25 15:29:26 +0300
commiteda7e84aac661f19478b2e5fe94d8899c9782cc8 (patch)
treef6b0b500c1d291dea7fa626ebec2bba19a19eecf /intern
parent9408023a81843f0c034bab117c654e11d2b7343f (diff)
GHOST: remove OpenGL depth buffer, remove code for other unused buffers
Viewport drawing has moved to offscreen buffers, and we no longer need to have depth, stencil, aa samples, sRGB buffers as part of the window. So all that code is removed now. The depth buffer was the only one still being allocated, its removal save a bit of memory. Code by Germano and Brecht. Differential Revision: https://developer.blender.org/D4708
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/GHOST_C-api.h6
-rw-r--r--intern/ghost/GHOST_ISystem.h3
-rw-r--r--intern/ghost/GHOST_IWindow.h6
-rw-r--r--intern/ghost/GHOST_Types.h1
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp7
-rw-r--r--intern/ghost/intern/GHOST_Context.h12
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextCGL.mm73
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.cpp37
-rw-r--r--intern/ghost/intern/GHOST_ContextEGL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.cpp35
-rw-r--r--intern/ghost/intern/GHOST_ContextGLX.h9
-rw-r--r--intern/ghost/intern/GHOST_ContextNone.h3
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.cpp19
-rw-r--r--intern/ghost/intern/GHOST_ContextSDL.h1
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp153
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.h12
-rw-r--r--intern/ghost/intern/GHOST_System.cpp9
-rw-r--r--intern/ghost/intern/GHOST_System.h6
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm2
-rw-r--r--intern/ghost/intern/GHOST_SystemSDL.cpp7
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp3
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp13
-rw-r--r--intern/ghost/intern/GHOST_Window.h13
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowCocoa.mm4
-rw-r--r--intern/ghost/intern/GHOST_WindowNULL.h5
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp6
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.h3
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp6
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.h2
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.cpp145
-rw-r--r--intern/ghost/intern/GHOST_WindowX11.h2
34 files changed, 102 insertions, 509 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 8bb6a670754..ec8115c914f 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -691,12 +691,6 @@ extern GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int
extern GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *intervalOut);
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
-extern GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle);
-
-/**
* Activates the drawing context of this window.
* \param windowhandle The handle to the window
* \return A success indicator.
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 66e37a525c0..0b7b3a18309 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -287,8 +287,7 @@ class GHOST_ISystem {
virtual GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground = 0,
- const GHOST_TUns16 numOfAASamples = 0) = 0;
+ const bool alphaBackground = 0) = 0;
/**
* Updates the resolution while in fullscreen mode.
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 0b1b83c36a7..2c5f6e811d3 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -211,12 +211,6 @@ class GHOST_IWindow {
virtual GHOST_TSuccess getSwapInterval(int &intervalOut) = 0;
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
- virtual GHOST_TUns16 getNumOfAASamples() = 0;
-
- /**
* Activates the drawing context of this window.
* \return A boolean success indicator.
*/
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 36678bcc913..69513ec514c 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -49,7 +49,6 @@ typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef struct {
- GHOST_TUns16 numOfAASamples;
int flags;
} GHOST_GLSettings;
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 8d9570a39f3..3848c723e5b 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -611,13 +611,6 @@ GHOST_TSuccess GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle, int *inter
return window->getSwapInterval(*intervalOut);
}
-GHOST_TUns16 GHOST_GetNumOfAASamples(GHOST_WindowHandle windowhandle)
-{
- GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
-
- return window->getNumOfAASamples();
-}
-
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
diff --git a/intern/ghost/intern/GHOST_Context.h b/intern/ghost/intern/GHOST_Context.h
index ed7b63aa436..7937fd1f7c7 100644
--- a/intern/ghost/intern/GHOST_Context.h
+++ b/intern/ghost/intern/GHOST_Context.h
@@ -37,10 +37,8 @@ class GHOST_Context : public GHOST_IContext {
/**
* Constructor.
* \param stereoVisual Stereo visual for quad buffered stereo.
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
- GHOST_Context(bool stereoVisual, GHOST_TUns16 numOfAASamples)
- : m_stereoVisual(stereoVisual), m_numOfAASamples(numOfAASamples)
+ GHOST_Context(bool stereoVisual) : m_stereoVisual(stereoVisual)
{
}
@@ -121,19 +119,11 @@ class GHOST_Context : public GHOST_IContext {
return m_stereoVisual;
}
- /** Number of samples used in anti-aliasing, set to 0 if no AA */
- inline GHOST_TUns16 getNumOfAASamples() const
- {
- return m_numOfAASamples;
- }
-
protected:
void initContextGLEW();
bool m_stereoVisual;
- GHOST_TUns16 m_numOfAASamples;
-
static void initClearGL();
#ifdef WITH_CXX_GUARDEDALLOC
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index 648af1cc9c7..fd760837d45 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -44,7 +44,6 @@ class GHOST_ContextCGL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextCGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
NSWindow *window,
NSOpenGLView *openGLView,
int contextProfileMask,
diff --git a/intern/ghost/intern/GHOST_ContextCGL.mm b/intern/ghost/intern/GHOST_ContextCGL.mm
index 9b4e1864adf..4a493cc416d 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.mm
+++ b/intern/ghost/intern/GHOST_ContextCGL.mm
@@ -40,7 +40,6 @@ NSOpenGLContext *GHOST_ContextCGL::s_sharedOpenGLContext = nil;
int GHOST_ContextCGL::s_sharedCount = 0;
GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
NSWindow *window,
NSOpenGLView *openGLView,
int contextProfileMask,
@@ -48,7 +47,7 @@ GHOST_ContextCGL::GHOST_ContextCGL(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_openGLView(openGLView),
m_openGLContext(nil),
m_debug(contextFlags)
@@ -183,9 +182,7 @@ GHOST_TSuccess GHOST_ContextCGL::updateDrawingContext()
static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
bool coreProfile,
bool stereoVisual,
- int numOfAASamples,
bool needAlpha,
- bool needStencil,
bool softwareGL)
{
attribs.clear();
@@ -207,9 +204,6 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back(NSOpenGLPFAAllowOfflineRenderers); // for automatic GPU switching
- attribs.push_back(NSOpenGLPFADepthSize);
- attribs.push_back((NSOpenGLPixelFormatAttribute)32);
-
if (stereoVisual)
attribs.push_back(NSOpenGLPFAStereo);
@@ -218,22 +212,6 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
attribs.push_back((NSOpenGLPixelFormatAttribute)8);
}
- if (needStencil) {
- attribs.push_back(NSOpenGLPFAStencilSize);
- attribs.push_back((NSOpenGLPixelFormatAttribute)8);
- }
-
- if (numOfAASamples > 0) {
- // Multisample anti-aliasing
- attribs.push_back(NSOpenGLPFAMultisample);
-
- attribs.push_back(NSOpenGLPFASampleBuffers);
- attribs.push_back((NSOpenGLPixelFormatAttribute)1);
-
- attribs.push_back(NSOpenGLPFASamples);
- attribs.push_back((NSOpenGLPixelFormatAttribute)numOfAASamples);
- }
-
attribs.push_back((NSOpenGLPixelFormatAttribute)0);
}
@@ -263,57 +241,18 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
static const bool needAlpha = false;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- static const bool needStencil = true;
-#else
- static const bool needStencil = false;
-#endif
-
static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better
GLint major = 0, minor = 0;
NSOpenGLPixelFormat *pixelFormat;
// TODO: keep pixel format for subsequent windows/contexts instead of recreating each time
- makeAttribList(attribs,
- m_coreProfile,
- m_stereoVisual,
- m_numOfAASamples,
- needAlpha,
- needStencil,
- softwareGL);
+ makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
- // Fall back to no multisampling if Antialiasing init failed
- if (m_numOfAASamples > 0 && pixelFormat == nil) {
- // XXX jwilkins: Does CGL only succeed when it makes an exact match on the number of samples?
- // Does this need to explicitly try for a lesser match before giving up?
- // (Now that I think about it, does WGL really require the code that it has for finding a lesser match?)
-
- attribs.clear();
- makeAttribList(attribs, m_coreProfile, m_stereoVisual, 0, needAlpha, needStencil, softwareGL);
- pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
- }
-
if (pixelFormat == nil)
goto error;
- if (m_numOfAASamples > 0) { //Set m_numOfAASamples to the actual value
- GLint actualSamples;
- [pixelFormat getValues:&actualSamples forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
-
- if (m_numOfAASamples != (GHOST_TUns16)actualSamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- m_numOfAASamples,
- actualSamples);
-
- m_numOfAASamples = (GHOST_TUns16)actualSamples;
- }
- }
-
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:s_sharedOpenGLContext];
[pixelFormat release];
@@ -336,13 +275,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
[m_openGLContext release];
// create software GL context
- makeAttribList(attribs,
- m_coreProfile,
- m_stereoVisual,
- m_numOfAASamples,
- needAlpha,
- needStencil,
- softwareGL);
+ makeAttribList(attribs, m_coreProfile, m_stereoVisual, needAlpha, softwareGL);
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attribs[0]];
m_openGLContext = [[NSOpenGLContext alloc] initWithFormat:pixelFormat
shareContext:s_sharedOpenGLContext];
diff --git a/intern/ghost/intern/GHOST_ContextEGL.cpp b/intern/ghost/intern/GHOST_ContextEGL.cpp
index 34df5f3119d..d4eeda2a9ef 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextEGL.cpp
@@ -200,7 +200,6 @@ template<typename T> T &choose_api(EGLenum api, T &a, T &b, T &c)
}
GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
EGLNativeWindowType nativeWindow,
EGLNativeDisplayType nativeDisplay,
EGLint contextProfileMask,
@@ -209,7 +208,7 @@ GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
EGLint contextFlags,
EGLint contextResetNotificationStrategy,
EGLenum api)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_nativeDisplay(nativeDisplay),
m_nativeWindow(nativeWindow),
m_contextProfileMask(contextProfileMask),
@@ -435,22 +434,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
attrib_list.push_back(8);
#endif
- attrib_list.push_back(EGL_DEPTH_SIZE);
- attrib_list.push_back(24);
-
-#ifdef GHOST_OPENGL_STENCIL
- attrib_list.push_back(EGL_STENCIL_SIZE);
- attrib_list.push_back(8);
-#endif
-
- if (m_numOfAASamples > 0) {
- attrib_list.push_back(EGL_SAMPLE_BUFFERS);
- attrib_list.push_back(1);
-
- attrib_list.push_back(EGL_SAMPLES);
- attrib_list.push_back(m_numOfAASamples);
- }
-
attrib_list.push_back(EGL_NONE);
EGLConfig config;
@@ -462,24 +445,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
if (num_config != 1) // num_config should be exactly 1
goto error;
- if (m_numOfAASamples > 0) {
- EGLint actualSamples;
-
- if (!EGL_CHK(::eglGetConfigAttrib(m_display, config, EGL_SAMPLE_BUFFERS, &actualSamples)))
- goto error;
-
- if (m_numOfAASamples != actualSamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- m_numOfAASamples,
- actualSamples);
-
- m_numOfAASamples = (GHOST_TUns16)actualSamples;
- }
- }
-
m_surface = ::eglCreateWindowSurface(m_display, config, m_nativeWindow, NULL);
if (!EGL_CHK(m_surface != EGL_NO_SURFACE))
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index 0a759493e4d..cd6b0c959b7 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -42,7 +42,6 @@ class GHOST_ContextEGL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextEGL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
EGLNativeWindowType nativeWindow,
EGLNativeDisplayType nativeDisplay,
EGLint contextProfileMask,
diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp
index 6a5126d59b8..fac75f299fc 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.cpp
+++ b/intern/ghost/intern/GHOST_ContextGLX.cpp
@@ -44,7 +44,6 @@ GLXContext GHOST_ContextGLX::s_sharedContext = None;
int GHOST_ContextGLX::s_sharedCount = 0;
GHOST_ContextGLX::GHOST_ContextGLX(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
Window window,
Display *display,
GLXFBConfig fbconfig,
@@ -53,7 +52,7 @@ GHOST_ContextGLX::GHOST_ContextGLX(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_display(display),
m_fbconfig(fbconfig),
m_window(window),
@@ -260,7 +259,7 @@ GHOST_TSuccess GHOST_ContextGLX::initializeDrawingContext()
int glx_attribs[64];
int fbcount = 0;
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, false, true);
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_stereoVisual, false, true);
framebuffer_config = glXChooseFBConfig(
m_display, DefaultScreen(m_display), glx_attribs, &fbcount);
@@ -369,21 +368,11 @@ GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut)
*
* \note Similar to SDL's 'X11_GL_GetAttributes'
*/
-int GHOST_X11_GL_GetAttributes(int *attribs,
- int attribs_max,
- int samples,
- bool is_stereo_visual,
- bool need_alpha,
- bool for_fb_config)
+int GHOST_X11_GL_GetAttributes(
+ int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config)
{
int i = 0;
-#ifdef GHOST_OPENGL_STENCIL
- const bool need_stencil = true;
-#else
- const bool need_stencil = false;
-#endif
-
if (is_stereo_visual) {
attribs[i++] = GLX_STEREO;
if (for_fb_config) {
@@ -413,27 +402,11 @@ int GHOST_X11_GL_GetAttributes(int *attribs,
attribs[i++] = GLX_GREEN_SIZE;
attribs[i++] = True;
- attribs[i++] = GLX_DEPTH_SIZE;
- attribs[i++] = True;
-
if (need_alpha) {
attribs[i++] = GLX_ALPHA_SIZE;
attribs[i++] = True;
}
- if (need_stencil) {
- attribs[i++] = GLX_STENCIL_SIZE;
- attribs[i++] = True;
- }
-
- if (samples) {
- attribs[i++] = GLX_SAMPLE_BUFFERS_ARB;
- attribs[i++] = True;
-
- attribs[i++] = GLX_SAMPLES_ARB;
- attribs[i++] = samples;
- }
-
attribs[i++] = 0;
GHOST_ASSERT(i <= attribs_max, "attribute size too small");
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index 5b631ea55de..ba8df7dac1b 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -43,7 +43,6 @@ class GHOST_ContextGLX : public GHOST_Context {
* Constructor.
*/
GHOST_ContextGLX(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
Window window,
Display *display,
GLXFBConfig fbconfig,
@@ -124,11 +123,7 @@ class GHOST_ContextGLX : public GHOST_Context {
};
/* used to get GLX info */
-int GHOST_X11_GL_GetAttributes(int *attribs,
- int attribs_max,
- int samples,
- bool is_stereo_visual,
- bool need_alpha,
- bool for_fb_config);
+int GHOST_X11_GL_GetAttributes(
+ int *attribs, int attribs_max, bool is_stereo_visual, bool need_alpha, bool for_fb_config);
#endif // __GHOST_CONTEXTGLX_H__
diff --git a/intern/ghost/intern/GHOST_ContextNone.h b/intern/ghost/intern/GHOST_ContextNone.h
index b7297d2497c..2a3c08701b4 100644
--- a/intern/ghost/intern/GHOST_ContextNone.h
+++ b/intern/ghost/intern/GHOST_ContextNone.h
@@ -30,8 +30,7 @@
class GHOST_ContextNone : public GHOST_Context {
public:
- GHOST_ContextNone(bool stereoVisual, GHOST_TUns16 numOfAASamples)
- : GHOST_Context(stereoVisual, numOfAASamples), m_swapInterval(1)
+ GHOST_ContextNone(bool stereoVisual) : GHOST_Context(stereoVisual), m_swapInterval(1)
{
}
diff --git a/intern/ghost/intern/GHOST_ContextSDL.cpp b/intern/ghost/intern/GHOST_ContextSDL.cpp
index 600cab6f6d5..bf0737e5efa 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.cpp
+++ b/intern/ghost/intern/GHOST_ContextSDL.cpp
@@ -35,14 +35,13 @@ SDL_GLContext GHOST_ContextSDL::s_sharedContext = NULL;
int GHOST_ContextSDL::s_sharedCount = 0;
GHOST_ContextSDL::GHOST_ContextSDL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
SDL_Window *window,
int contextProfileMask,
int contextMajorVersion,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_window(window),
m_hidden_window(NULL),
m_contextProfileMask(contextProfileMask),
@@ -113,12 +112,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
const bool needAlpha = false;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- const bool needStencil = true;
-#else
- const bool needStencil = false;
-#endif
-
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, m_contextProfileMask);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, m_contextMajorVersion);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, m_contextMinorVersion);
@@ -126,7 +119,6 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
@@ -135,19 +127,10 @@ GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext()
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
}
- if (needStencil) {
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
- }
-
if (m_stereoVisual) {
SDL_GL_SetAttribute(SDL_GL_STEREO, 1);
}
- if (m_numOfAASamples) {
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
- SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, m_numOfAASamples);
- }
-
if (m_window == NULL) {
m_hidden_window = SDL_CreateWindow("Offscreen Context Windows",
SDL_WINDOWPOS_UNDEFINED,
diff --git a/intern/ghost/intern/GHOST_ContextSDL.h b/intern/ghost/intern/GHOST_ContextSDL.h
index bbd8dd5ad5e..670d930e1e7 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.h
+++ b/intern/ghost/intern/GHOST_ContextSDL.h
@@ -48,7 +48,6 @@ class GHOST_ContextSDL : public GHOST_Context {
* Constructor.
*/
GHOST_ContextSDL(bool stereoVisual,
- GHOST_TUns16 numOfAASamples,
SDL_Window *window,
int contextProfileMask,
int contextMajorVersion,
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 96d6e0c1600..6918d95445f 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -42,7 +42,6 @@ static bool is_crappy_intel_card()
GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual,
bool alphaBackground,
- GHOST_TUns16 numOfAASamples,
HWND hWnd,
HDC hDC,
int contextProfileMask,
@@ -50,7 +49,7 @@ GHOST_ContextWGL::GHOST_ContextWGL(bool stereoVisual,
int contextMinorVersion,
int contextFlags,
int contextResetNotificationStrategy)
- : GHOST_Context(stereoVisual, numOfAASamples),
+ : GHOST_Context(stereoVisual),
m_hWnd(hWnd),
m_hDC(hDC),
m_contextProfileMask(contextProfileMask),
@@ -154,7 +153,7 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
/* if no formats can be found, can we determine why it was rejected? */
if (!(pfd.dwFlags & PFD_SUPPORT_OPENGL) || !(pfd.dwFlags & PFD_DRAW_TO_WINDOW) ||
!(pfd.dwFlags & PFD_DOUBLEBUFFER) || /* Blender _needs_ this */
- !(pfd.iPixelType == PFD_TYPE_RGBA) || (pfd.cDepthBits < 16) ||
+ !(pfd.iPixelType == PFD_TYPE_RGBA) ||
(pfd.cColorBits > 32) || /* 64 bit formats disable aero */
(pfd.dwFlags & PFD_GENERIC_FORMAT)) /* no software renderers */
{
@@ -163,10 +162,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
weight = 1; /* it's usable */
- /* the bigger the depth buffer the better */
- /* give no weight to a 16-bit depth buffer, because those are crap */
- weight += pfd.cDepthBits - 16;
-
weight += pfd.cColorBits - 8;
if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0)
@@ -175,10 +170,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION))
weight++;
#endif
-#ifdef GHOST_OPENGL_STENCIL
- if (pfd.cStencilBits >= 8)
- weight++;
-#endif
return weight;
}
@@ -373,12 +364,7 @@ finalize:
}
}
-static void makeAttribList(std::vector<int> &out,
- bool stereoVisual,
- int numOfAASamples,
- bool needAlpha,
- bool needStencil,
- bool sRGB)
+static void makeAttribList(std::vector<int> &out, bool stereoVisual, bool needAlpha)
{
out.clear();
out.reserve(30);
@@ -406,37 +392,15 @@ static void makeAttribList(std::vector<int> &out,
out.push_back(WGL_COLOR_BITS_ARB);
out.push_back(24);
- out.push_back(WGL_DEPTH_BITS_ARB);
- out.push_back(24);
-
if (needAlpha) {
out.push_back(WGL_ALPHA_BITS_ARB);
out.push_back(8);
}
- if (needStencil) {
- out.push_back(WGL_STENCIL_BITS_ARB);
- out.push_back(8);
- }
-
- if (numOfAASamples > 0) {
- out.push_back(WGL_SAMPLES_ARB);
- out.push_back(numOfAASamples);
-
- out.push_back(WGL_SAMPLE_BUFFERS_ARB);
- out.push_back(GL_TRUE);
- }
-
- if (sRGB) {
- out.push_back(WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB);
- out.push_back(GL_TRUE);
- }
-
out.push_back(0);
}
-int GHOST_ContextWGL::_choose_pixel_format_arb_1(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::_choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha)
{
std::vector<int> iAttributes;
@@ -445,27 +409,17 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
int iPixelFormat = 0;
int iPixelFormats[_MAX_PIXEL_FORMATS];
- int samples;
-
- // guard against some insanely high number of samples
- if (numOfAASamples > 64) {
- fprintf(stderr, "Warning! Clamping number of samples to 64.\n");
- samples = 64;
- }
- else {
- samples = numOfAASamples;
- }
+ makeAttribList(iAttributes, stereoVisual, needAlpha);
- // request a format with as many samples as possible, but not more than requested
- while (samples >= 0) {
- makeAttribList(iAttributes, stereoVisual, samples, needAlpha, needStencil, sRGB);
+ UINT nNumFormats;
+ WIN32_CHK(wglChoosePixelFormatARB(
+ m_hDC, &(iAttributes[0]), NULL, _MAX_PIXEL_FORMATS, iPixelFormats, &nNumFormats));
- UINT nNumFormats;
- WIN32_CHK(wglChoosePixelFormatARB(
- m_hDC, &(iAttributes[0]), NULL, _MAX_PIXEL_FORMATS, iPixelFormats, &nNumFormats));
+ if (nNumFormats > 0) {
+ iPixelFormat = iPixelFormats[0];
#ifdef WIN32_COMPOSITING
- if (needAlpha && nNumFormats) {
+ if (needAlpha) {
// scan through all pixel format to make sure one supports compositing
PIXELFORMATDESCRIPTOR pfd;
int i;
@@ -480,41 +434,16 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
}
if (i == nNumFormats) {
fprintf(stderr, "Warning! Unable to find a pixel format with compositing capability.\n");
- iPixelFormat = iPixelFormats[0];
}
}
- else
#endif
- iPixelFormat = iPixelFormats[0];
- /* total number of formats that match (regardless of size of iPixelFormat array)
- * see: WGL_ARB_pixel_format extension spec */
- if (nNumFormats > 0)
- break;
-
- /* if not reset, then the state of iPixelFormat is undefined after call to wglChoosePixelFormatARB
- * see: WGL_ARB_pixel_format extension spec */
- iPixelFormat = 0;
-
- samples--;
}
- // check how many samples were actually gotten
+ // check pixel format
if (iPixelFormat != 0) {
- int iQuery[] = {WGL_SAMPLES_ARB};
- int actualSamples, alphaBits;
- wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &actualSamples);
-
- if (actualSamples != numOfAASamples) {
- fprintf(
- stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
if (needAlpha) {
- iQuery[0] = WGL_ALPHA_BITS_ARB;
- wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &alphaBits);
+ int alphaBits, iQuery = WGL_ALPHA_BITS_ARB;
+ wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, &iQuery, &alphaBits);
if (alphaBits == 0) {
fprintf(stderr, "Warning! Unable to find a frame buffer with alpha channel.\n");
}
@@ -523,18 +452,16 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(
return iPixelFormat;
}
-int GHOST_ContextWGL::choose_pixel_format_arb(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::choose_pixel_format_arb(bool stereoVisual, bool needAlpha)
{
int iPixelFormat;
- iPixelFormat = _choose_pixel_format_arb_1(
- stereoVisual, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = _choose_pixel_format_arb_1(stereoVisual, needAlpha);
if (iPixelFormat == 0 && stereoVisual) {
fprintf(stderr, "Warning! Unable to find a stereo pixel format.\n");
- iPixelFormat = _choose_pixel_format_arb_1(false, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = _choose_pixel_format_arb_1(false, needAlpha);
m_stereoVisual = false; // set context property to actual value
}
@@ -542,8 +469,7 @@ int GHOST_ContextWGL::choose_pixel_format_arb(
return iPixelFormat;
}
-int GHOST_ContextWGL::choose_pixel_format(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB)
+int GHOST_ContextWGL::choose_pixel_format(bool stereoVisual, bool needAlpha)
{
PIXELFORMATDESCRIPTOR preferredPFD = {
sizeof(PIXELFORMATDESCRIPTOR), /* size */
@@ -572,12 +498,12 @@ int GHOST_ContextWGL::choose_pixel_format(
0,
0,
0,
- 0, /* accum bits (ignored) */
- 24, /* depth buffer */
- (BYTE)(needStencil ? 8 : 0), /* stencil buffer */
- 0, /* no auxiliary buffers */
- PFD_MAIN_PLANE, /* main layer */
- 0, /* reserved */
+ 0, /* accum bits (ignored) */
+ 0, /* depth buffer */
+ 0, /* stencil buffer */
+ 0, /* no auxiliary buffers */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
0,
0,
0 /* layer, visible, and damage masks (ignored) */
@@ -585,21 +511,10 @@ int GHOST_ContextWGL::choose_pixel_format(
initContextWGLEW(preferredPFD);
- if (numOfAASamples > 0 && !WGLEW_ARB_multisample) {
- fprintf(stderr, "Warning! Unable to request a multisample framebuffer.\n");
- numOfAASamples = 0;
- }
-
- if (sRGB && !(WGLEW_ARB_framebuffer_sRGB || WGLEW_EXT_framebuffer_sRGB)) {
- fprintf(stderr, "Warning! Unable to request an sRGB framebuffer.\n");
- sRGB = false;
- }
-
int iPixelFormat = 0;
if (WGLEW_ARB_pixel_format)
- iPixelFormat = choose_pixel_format_arb(
- stereoVisual, numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = choose_pixel_format_arb(stereoVisual, needAlpha);
if (iPixelFormat == 0)
iPixelFormat = choose_pixel_format_legacy(m_hDC, preferredPFD);
@@ -629,25 +544,12 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (!WGLEW_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
const bool needAlpha = m_alphaBackground;
-
-#ifdef GHOST_OPENGL_STENCIL
- const bool needStencil = true;
-#else
- const bool needStencil = false;
-#endif
-
-#ifdef GHOST_OPENGL_SRGB
- const bool sRGB = true;
-#else
- const bool sRGB = false;
-#endif
int iPixelFormat;
int lastPFD;
PIXELFORMATDESCRIPTOR chosenPFD;
- iPixelFormat = choose_pixel_format(
- m_stereoVisual, m_numOfAASamples, needAlpha, needStencil, sRGB);
+ iPixelFormat = choose_pixel_format(m_stereoVisual, needAlpha);
if (iPixelFormat == 0) {
goto error;
@@ -663,9 +565,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
if (needAlpha && chosenPFD.cAlphaBits == 0)
fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n");
- if (needStencil && chosenPFD.cStencilBits == 0)
- fprintf(stderr, "Warning! Unable to find a pixel format with a stencil buffer.\n");
-
if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) {
goto error;
}
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index a3fd9de74a1..a990e42c4ff 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -41,7 +41,6 @@ class GHOST_ContextWGL : public GHOST_Context {
*/
GHOST_ContextWGL(bool stereoVisual,
bool alphaBackground,
- GHOST_TUns16 numOfAASamples,
HWND hWnd,
HDC hDC,
int contextProfileMask,
@@ -101,14 +100,9 @@ class GHOST_ContextWGL : public GHOST_Context {
GHOST_TSuccess getSwapInterval(int &intervalOut);
private:
- int choose_pixel_format(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
-
- int choose_pixel_format_arb(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
-
- int _choose_pixel_format_arb_1(
- bool stereoVisual, int numOfAASamples, bool needAlpha, bool needStencil, bool sRGB);
+ int choose_pixel_format(bool stereoVisual, bool needAlpha);
+ int choose_pixel_format_arb(bool stereoVisual, bool needAlpha);
+ int _choose_pixel_format_arb_1(bool stereoVisual, bool needAlpha);
void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 1530dddd5f1..e5187165a2c 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -129,8 +129,7 @@ bool GHOST_System::validWindow(GHOST_IWindow *window)
GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples)
+ const bool alphaBackground)
{
GHOST_TSuccess success = GHOST_kFailure;
GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager");
@@ -145,7 +144,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting &setting
if (success == GHOST_kSuccess) {
//GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n");
success = createFullScreenWindow(
- (GHOST_Window **)window, setting, stereoVisual, alphaBackground, numOfAASamples);
+ (GHOST_Window **)window, setting, stereoVisual, alphaBackground);
if (success == GHOST_kSuccess) {
m_windowManager->beginFullScreen(*window, stereoVisual);
}
@@ -353,8 +352,7 @@ GHOST_TSuccess GHOST_System::exit()
GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
const GHOST_DisplaySetting &settings,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples)
+ const bool alphaBackground)
{
GHOST_GLSettings glSettings = {0};
@@ -362,7 +360,6 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
glSettings.flags |= GHOST_glStereoVisual;
if (alphaBackground)
glSettings.flags |= GHOST_glAlphaBackground;
- glSettings.numOfAASamples = numOfAASamples;
/* note: don't use getCurrentDisplaySetting() because on X11 we may
* be zoomed in and the desktop may be bigger then the viewport. */
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 2c7025b6036..a62641c5cf5 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -137,8 +137,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting &setting,
GHOST_IWindow **window,
const bool stereoVisual,
- const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool alphaBackground);
/**
* Updates the resolution while in fullscreen mode.
@@ -350,8 +349,7 @@ class GHOST_System : public GHOST_ISystem {
GHOST_TSuccess createFullScreenWindow(GHOST_Window **window,
const GHOST_DisplaySetting &settings,
const bool stereoVisual,
- const bool alphaBackground = 0,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool alphaBackground = 0);
/** The display manager (platform dependent). */
GHOST_DisplayManager *m_displayManager;
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 903fe4a6e8d..1c33e361dc1 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -733,7 +733,6 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
state,
type,
glSettings.flags & GHOST_glStereoVisual,
- glSettings.numOfAASamples,
glSettings.flags & GHOST_glDebugContext);
if (window->getValid()) {
@@ -763,7 +762,6 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const STR_String &title,
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext()
{
GHOST_Context *context = new GHOST_ContextCGL(false,
- 0,
NULL,
NULL,
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index 81f1a4007cb..8b2dda4043f 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -37,10 +37,7 @@ GHOST_SystemSDL::GHOST_SystemSDL() : GHOST_System()
printf("Error initializing SDL: %s\n", SDL_GetError());
}
- /* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); */
- /* SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
@@ -75,8 +72,7 @@ GHOST_IWindow *GHOST_SystemSDL::createWindow(const STR_String &title,
parentWindow,
type,
((glSettings.flags & GHOST_glStereoVisual) != 0),
- exclusive,
- glSettings.numOfAASamples);
+ exclusive);
if (window) {
if (GHOST_kWindowStateFullScreen == state) {
@@ -145,7 +141,6 @@ GHOST_TUns8 GHOST_SystemSDL::getNumDisplays() const
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext()
{
GHOST_Context *context = new GHOST_ContextSDL(0,
- 0,
NULL,
0, // profile bit
3,
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index ab159e91d85..56601059756 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -279,7 +279,6 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const STR_String &title,
type,
((glSettings.flags & GHOST_glStereoVisual) != 0),
((glSettings.flags & GHOST_glAlphaBackground) != 0),
- glSettings.numOfAASamples,
parentWindow,
((glSettings.flags & GHOST_glDebugContext) != 0));
@@ -327,7 +326,6 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextWGL(false,
true,
- 0,
wnd,
mHDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -346,7 +344,6 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
context = new GHOST_ContextWGL(false,
true,
- 0,
wnd,
mHDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -374,7 +371,6 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
// 2.1 ignores the profile bit & is incompatible with core profile
context = new GHOST_ContextWGL(false,
true,
- 0,
NULL,
NULL,
0, // no profile bit
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index b850619e851..37c1f9cae6b 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -355,7 +355,6 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const STR_String &title,
((glSettings.flags & GHOST_glStereoVisual) != 0),
exclusive,
((glSettings.flags & GHOST_glAlphaBackground) != 0),
- glSettings.numOfAASamples,
(glSettings.flags & GHOST_glDebugContext) != 0);
if (window) {
@@ -421,7 +420,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextGLX(false,
- 0,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
@@ -439,7 +437,6 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext()
}
context = new GHOST_ContextGLX(false,
- 0,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index 06b76aee23d..85283a34d2e 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -35,15 +35,13 @@ GHOST_Window::GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual,
- const bool /*exclusive*/,
- const GHOST_TUns16 wantNumOfAASamples)
+ const bool /*exclusive*/)
: m_drawingContextType(GHOST_kDrawingContextTypeNone),
m_cursorVisible(true),
m_cursorGrab(GHOST_kGrabDisable),
m_cursorShape(GHOST_kStandardCursorDefault),
m_wantStereoVisual(wantStereoVisual),
- m_wantNumOfAASamples(wantNumOfAASamples),
- m_context(new GHOST_ContextNone(false, 0))
+ m_context(new GHOST_ContextNone(false))
{
m_isUnsavedChanges = false;
m_canAcceptDragOperation = false;
@@ -85,7 +83,7 @@ GHOST_TSuccess GHOST_Window::setDrawingContextType(GHOST_TDrawingContextType typ
m_drawingContextType = type;
}
else {
- m_context = new GHOST_ContextNone(m_wantStereoVisual, m_wantNumOfAASamples);
+ m_context = new GHOST_ContextNone(m_wantStereoVisual);
m_drawingContextType = GHOST_kDrawingContextTypeNone;
}
@@ -111,11 +109,6 @@ GHOST_TSuccess GHOST_Window::getSwapInterval(int &intervalOut)
return m_context->getSwapInterval(intervalOut);
}
-GHOST_TUns16 GHOST_Window::getNumOfAASamples()
-{
- return m_context->getNumOfAASamples();
-}
-
GHOST_TSuccess GHOST_Window::activateDrawingContext()
{
return m_context->activateDrawingContext();
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 8c01d66bbfd..2d51ee83555 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -50,14 +50,12 @@ class GHOST_Window : public GHOST_IWindow {
* \param stereoVisual Stereo visual for quad buffered stereo.
* \param exclusive Use to show the window ontop and ignore others
* (used fullscreen).
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_Window(GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
const bool wantStereoVisual = false,
- const bool exclusive = false,
- const GHOST_TUns16 wantNumOfAASamples = 0);
+ const bool exclusive = false);
/**
* \section Interface inherited from GHOST_IWindow left for derived class
@@ -202,12 +200,6 @@ class GHOST_Window : public GHOST_IWindow {
GHOST_TSuccess getSwapInterval(int &intervalOut);
/**
- * Gets the current swap interval for swapBuffers.
- * \return Number of AA Samples (0 if there is no multisample buffer)
- */
- GHOST_TUns16 getNumOfAASamples();
-
- /**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
void setAcceptDragOperation(bool canAccept);
@@ -400,9 +392,6 @@ class GHOST_Window : public GHOST_IWindow {
/** Whether to attempt to initialize a context with a stereo framebuffer. */
bool m_wantStereoVisual;
- /** Attempt to initialize a context with this many samples. */
- GHOST_TUns16 m_wantNumOfAASamples;
-
/** Full-screen width */
GHOST_TUns32 m_fullScreenWidth;
/** Full-screen height */
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index acda109eb7f..e709fdd65b0 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -54,7 +54,6 @@ class GHOST_WindowCocoa : public GHOST_Window {
* \param state The state the window is initially opened with.
* \param type The type of drawing context installed in this window.
* \param stereoVisual Stereo visual for quad buffered stereo.
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
const STR_String &title,
@@ -65,7 +64,6 @@ class GHOST_WindowCocoa : public GHOST_Window {
GHOST_TWindowState state,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
- const GHOST_TUns16 numOfAASamples = 0,
bool is_debug = false);
/**
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index a73c818297c..7c7dbc3d847 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -529,9 +529,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(GHOST_SystemCocoa *systemCocoa,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
const bool stereoVisual,
- const GHOST_TUns16 numOfAASamples,
bool is_debug)
- : GHOST_Window(width, height, state, stereoVisual, false, numOfAASamples),
+ : GHOST_Window(width, height, state, stereoVisual, false),
m_customCursor(0),
m_debug_context(is_debug)
{
@@ -1018,7 +1017,6 @@ GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType ty
if (type == GHOST_kDrawingContextTypeOpenGL) {
GHOST_Context *context = new GHOST_ContextCGL(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_openGLView,
diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h
index 3ac3389291d..0ea33710ef6 100644
--- a/intern/ghost/intern/GHOST_WindowNULL.h
+++ b/intern/ghost/intern/GHOST_WindowNULL.h
@@ -45,9 +45,8 @@ class GHOST_WindowNULL : public GHOST_Window {
GHOST_TWindowState state,
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type,
- const bool stereoVisual,
- const GHOST_TUns16 numOfAASamples)
- : GHOST_Window(width, height, state, stereoVisual, false, numOfAASamples), m_system(system)
+ const bool stereoVisual)
+ : GHOST_Window(width, height, state, stereoVisual, false), m_system(system)
{
setTitle(title);
}
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 89efdf1a94e..83ef71956bb 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -36,9 +36,8 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type,
const bool stereoVisual,
- const bool exclusive,
- const GHOST_TUns16 numOfAASamples)
- : GHOST_Window(width, height, state, stereoVisual, exclusive, numOfAASamples),
+ const bool exclusive)
+ : GHOST_Window(width, height, state, stereoVisual, exclusive),
m_system(system),
m_valid_setup(false),
m_invalid_window(false),
@@ -81,7 +80,6 @@ GHOST_Context *GHOST_WindowSDL::newDrawingContext(GHOST_TDrawingContextType type
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
GHOST_Context *context = new GHOST_ContextSDL(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_sdl_win,
0, // profile bit
3,
diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h
index 3a9a1ad7df2..7b3cddc5f17 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.h
+++ b/intern/ghost/intern/GHOST_WindowSDL.h
@@ -63,8 +63,7 @@ class GHOST_WindowSDL : public GHOST_Window {
const GHOST_TEmbedderWindowID parentWindow,
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
const bool stereoVisual = false,
- const bool exclusive = false,
- const GHOST_TUns16 numOfAASamples = 0);
+ const bool exclusive = false);
~GHOST_WindowSDL();
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 2feda927998..d2bd1e5217f 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -66,10 +66,9 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
GHOST_TDrawingContextType type,
bool wantStereoVisual,
bool alphaBackground,
- GHOST_TUns16 wantNumOfAASamples,
GHOST_TEmbedderWindowID parentwindowhwnd,
bool is_debug)
- : GHOST_Window(width, height, state, wantStereoVisual, false, wantNumOfAASamples),
+ : GHOST_Window(width, height, state, wantStereoVisual, false),
m_inLiveResize(false),
m_system(system),
m_hDC(0),
@@ -661,7 +660,6 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -679,7 +677,6 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
}
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -707,7 +704,6 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
// 2.1 ignores the profile bit & is incompatible with core profile
context = new GHOST_ContextWGL(m_wantStereoVisual,
m_wantAlphaBackground,
- m_wantNumOfAASamples,
m_hWnd,
m_hDC,
0, // no profile bit
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 73791d3fbbf..036f998ce91 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -223,7 +223,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
* \param state The state the window is initially opened with.
* \param type The type of drawing context installed in this window.
* \param wantStereoVisual Stereo visual for quad buffered stereo.
- * \param wantNumOfAASamples Number of samples used for AA (zero if no AA)
* \param parentWindowHwnd
*/
GHOST_WindowWin32(GHOST_SystemWin32 *system,
@@ -236,7 +235,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
bool wantStereoVisual = false,
bool alphaBackground = false,
- GHOST_TUns16 wantNumOfAASamples = 0,
GHOST_TEmbedderWindowID parentWindowHwnd = 0,
bool is_debug = false);
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 21e42e01aea..5e47a52e7df 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -92,14 +92,10 @@ typedef struct {
static XVisualInfo *x11_visualinfo_from_glx(Display *display,
bool stereoVisual,
- GHOST_TUns16 *r_numOfAASamples,
bool needAlpha,
GLXFBConfig *fbconfig)
{
- XVisualInfo *visual = NULL;
- GHOST_TUns16 numOfAASamples = *r_numOfAASamples;
int glx_major, glx_minor, glx_version; /* GLX version: major.minor */
- GHOST_TUns16 actualSamples;
int glx_attribs[64];
*fbconfig = NULL;
@@ -118,14 +114,6 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
}
glx_version = glx_major * 100 + glx_minor;
- if (glx_version >= 104) {
- actualSamples = numOfAASamples;
- }
- else {
- numOfAASamples = 0;
- actualSamples = 0;
- }
-
#ifdef WITH_X11_ALPHA
if (needAlpha && glx_version >= 103 &&
(glXChooseFBConfig || (glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddressARB(
@@ -133,106 +121,63 @@ static XVisualInfo *x11_visualinfo_from_glx(Display *display,
(glXGetVisualFromFBConfig ||
(glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddressARB(
(const GLubyte *)"glXGetVisualFromFBConfig")) != NULL)) {
- GLXFBConfig *fbconfigs;
- int nbfbconfig;
- int i;
-
- for (;;) {
-
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, true);
- fbconfigs = glXChooseFBConfig(display, DefaultScreen(display), glx_attribs, &nbfbconfig);
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, stereoVisual, needAlpha, true);
- /* Any sample level or even zero, which means oversampling disabled, is good
- * but we need a valid visual to continue */
- if (nbfbconfig > 0) {
- /* take a frame buffer config that has alpha cap */
- for (i = 0; i < nbfbconfig; i++) {
- visual = (XVisualInfo *)glXGetVisualFromFBConfig(display, fbconfigs[i]);
- if (!visual)
+ int nbfbconfig;
+ GLXFBConfig *fbconfigs = glXChooseFBConfig(
+ display, DefaultScreen(display), glx_attribs, &nbfbconfig);
+
+ /* Any sample level or even zero, which means oversampling disabled, is good
+ * but we need a valid visual to continue */
+ if (nbfbconfig > 0) {
+ /* take a frame buffer config that has alpha cap */
+ for (int i = 0; i < nbfbconfig; i++) {
+ XVisualInfo *visual = (XVisualInfo *)glXGetVisualFromFBConfig(display, fbconfigs[i]);
+ if (!visual)
+ continue;
+ /* if we don't need a alpha background, the first config will do, otherwise
+ * test the alphaMask as it won't necessarily be present */
+ if (needAlpha) {
+ XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
+ if (!pict_format)
+ continue;
+ if (pict_format->direct.alphaMask <= 0)
continue;
- /* if we don't need a alpha background, the first config will do, otherwise
- * test the alphaMask as it won't necessarily be present */
- if (needAlpha) {
- XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual);
- if (!pict_format)
- continue;
- if (pict_format->direct.alphaMask <= 0)
- continue;
- }
- *fbconfig = fbconfigs[i];
- break;
- }
- XFree(fbconfigs);
- if (i < nbfbconfig) {
- if (actualSamples < numOfAASamples) {
- fprintf(stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d "
- "samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
- break;
}
- visual = NULL;
- }
- if (actualSamples == 0) {
- /* All options exhausted, cannot continue */
- fprintf(stderr,
- "%s:%d: X11 glXChooseVisual() failed, "
- "verify working openGL system!\n",
- __FILE__,
- __LINE__);
+ *fbconfig = fbconfigs[i];
+ XFree(fbconfigs);
- return NULL;
- }
- else {
- --actualSamples;
+ return visual;
}
+
+ XFree(fbconfigs);
}
}
else
#endif
{
/* legacy, don't use extension */
- for (;;) {
- GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, false);
+ GHOST_X11_GL_GetAttributes(glx_attribs, 64, stereoVisual, needAlpha, false);
- visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs);
+ XVisualInfo *visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs);
- /* Any sample level or even zero, which means oversampling disabled, is good
+ /* Any sample level or even zero, which means oversampling disabled, is good
* but we need a valid visual to continue */
- if (visual != NULL) {
- if (actualSamples < numOfAASamples) {
- fprintf(stderr,
- "Warning! Unable to find a multisample pixel format that supports exactly %d "
- "samples. "
- "Substituting one that uses %d samples.\n",
- numOfAASamples,
- actualSamples);
- }
- break;
- }
-
- if (actualSamples == 0) {
- /* All options exhausted, cannot continue */
- fprintf(stderr,
- "%s:%d: X11 glXChooseVisual() failed, "
- "verify working openGL system!\n",
- __FILE__,
- __LINE__);
-
- return NULL;
- }
- else {
- --actualSamples;
- }
+ if (visual != NULL) {
+ return visual;
}
}
- *r_numOfAASamples = actualSamples;
- return visual;
+
+ /* All options exhausted, cannot continue */
+ fprintf(stderr,
+ "%s:%d: X11 glXChooseVisual() failed, "
+ "verify working openGL system!\n",
+ __FILE__,
+ __LINE__);
+
+ return NULL;
}
GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
@@ -248,9 +193,8 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
const bool stereoVisual,
const bool exclusive,
const bool alphaBackground,
- const GHOST_TUns16 numOfAASamples,
const bool is_debug)
- : GHOST_Window(width, height, state, stereoVisual, exclusive, numOfAASamples),
+ : GHOST_Window(width, height, state, stereoVisual, exclusive),
m_display(display),
m_visualInfo(NULL),
m_fbconfig(NULL),
@@ -271,11 +215,8 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
m_is_debug_context(is_debug)
{
if (type == GHOST_kDrawingContextTypeOpenGL) {
- m_visualInfo = x11_visualinfo_from_glx(m_display,
- stereoVisual,
- &m_wantNumOfAASamples,
- alphaBackground,
- (GLXFBConfig *)&m_fbconfig);
+ m_visualInfo = x11_visualinfo_from_glx(
+ m_display, stereoVisual, alphaBackground, (GLXFBConfig *)&m_fbconfig);
}
else {
XVisualInfo tmp = {0};
@@ -1298,7 +1239,6 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextGLX(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_display,
(GLXFBConfig)m_fbconfig,
@@ -1316,7 +1256,6 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
}
context = new GHOST_ContextGLX(m_wantStereoVisual,
- m_wantNumOfAASamples,
m_window,
m_display,
(GLXFBConfig)m_fbconfig,
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index 8378a8b5ef8..ce3f422823f 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -65,7 +65,6 @@ class GHOST_WindowX11 : public GHOST_Window {
* \param type The type of drawing context installed in this window.
* \param stereoVisual Stereo visual for quad buffered stereo.
* \param alphaBackground Enable alpha blending of window with display background
- * \param numOfAASamples Number of samples used for AA (zero if no AA)
*/
GHOST_WindowX11(GHOST_SystemX11 *system,
Display *display,
@@ -80,7 +79,6 @@ class GHOST_WindowX11 : public GHOST_Window {
const bool stereoVisual = false,
const bool exclusive = false,
const bool alphaBackground = false,
- const GHOST_TUns16 numOfAASamples = 0,
const bool is_debug = false);
bool getValid() const;