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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-09 17:31:18 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-07-10 18:48:48 +0300
commit7f5e4a819c4cd30861e424a28a47e0c0a5d1837a (patch)
tree1edfe785328fca5f0baded31de9286f264be91cd /intern/ghost
parent77964b2efb859e27caf48dab5b7a3e0707291c89 (diff)
GHOST/Windows: don't prefer swap copy method.
This is no longer needed with the new offscreen draw method, so use whatever is default and hopefully fastest. Fixes console warnings in some setups that don't have swap copy.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp104
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.h10
2 files changed, 10 insertions, 104 deletions
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 035b0c268c6..9605f7ddff2 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -199,10 +199,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
weight++;
#endif
- /* want swap copy capability -- it matters a lot */
- if (pfd.dwFlags & PFD_SWAP_COPY)
- weight += 16;
-
return weight;
}
@@ -404,7 +400,6 @@ static void makeAttribList(
std::vector<int>& out,
bool stereoVisual,
int numOfAASamples,
- int swapMethod,
bool needAlpha,
bool needStencil,
bool sRGB)
@@ -424,9 +419,6 @@ static void makeAttribList(
out.push_back(WGL_ACCELERATION_ARB);
out.push_back(WGL_FULL_ACCELERATION_ARB);
- out.push_back(WGL_SWAP_METHOD_ARB);
- out.push_back(swapMethod);
-
if (stereoVisual) {
out.push_back(WGL_STEREO_ARB);
out.push_back(GL_TRUE);
@@ -468,13 +460,12 @@ static void makeAttribList(
}
-int GHOST_ContextWGL::_choose_pixel_format_arb_2(
+int GHOST_ContextWGL::_choose_pixel_format_arb_1(
bool stereoVisual,
- int *numOfAASamples,
+ int numOfAASamples,
bool needAlpha,
bool needStencil,
- bool sRGB,
- int swapMethod)
+ bool sRGB)
{
std::vector<int> iAttributes;
@@ -486,12 +477,12 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2(
int samples;
// guard against some insanely high number of samples
- if (*numOfAASamples > 64) {
+ if (numOfAASamples > 64) {
fprintf(stderr, "Warning! Clamping number of samples to 64.\n");
samples = 64;
}
else {
- samples = *numOfAASamples;
+ samples = numOfAASamples;
}
// request a format with as many samples as possible, but not more than requested
@@ -500,7 +491,6 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2(
iAttributes,
stereoVisual,
samples,
- swapMethod,
needAlpha,
needStencil,
sRGB);
@@ -549,13 +539,11 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2(
int actualSamples, alphaBits;
wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &actualSamples);
- if (actualSamples != *numOfAASamples) {
+ 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);
-
- *numOfAASamples = actualSamples; // set context property to actual value
+ numOfAASamples, actualSamples);
}
if (needAlpha) {
iQuery[0] = WGL_ALPHA_BITS_ARB;
@@ -566,69 +554,6 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2(
}
}
}
- else {
- *numOfAASamples = 0;
- }
- return iPixelFormat;
-}
-
-
-int GHOST_ContextWGL::_choose_pixel_format_arb_1(bool stereoVisual,
- int numOfAASamples,
- bool needAlpha,
- bool needStencil,
- bool sRGB,
- int *swapMethodOut)
-{
- int iPixelFormat;
- int copyPixelFormat = 0;
- int undefPixelFormat = 0;
- int exchPixelFormat = 0;
- int copyNumOfAASamples = 0;
- int undefNumOfAASamples = 0;
- int exchNumOfAASamples = 0;
-
- *swapMethodOut = WGL_SWAP_COPY_ARB;
- copyNumOfAASamples = numOfAASamples;
- copyPixelFormat = _choose_pixel_format_arb_2(
- stereoVisual, &copyNumOfAASamples, needAlpha, needStencil, sRGB, *swapMethodOut);
-
- if (copyPixelFormat == 0 || copyNumOfAASamples < numOfAASamples) {
- *swapMethodOut = WGL_SWAP_UNDEFINED_ARB;
- undefNumOfAASamples = numOfAASamples;
- undefPixelFormat = _choose_pixel_format_arb_2(
- stereoVisual, &undefNumOfAASamples, needAlpha, needStencil, sRGB, *swapMethodOut);
-
- if (undefPixelFormat == 0 || undefNumOfAASamples < numOfAASamples) {
- *swapMethodOut = WGL_SWAP_EXCHANGE_ARB;
- exchNumOfAASamples = numOfAASamples;
- exchPixelFormat = _choose_pixel_format_arb_2(
- stereoVisual, &exchNumOfAASamples, needAlpha, needStencil, sRGB, *swapMethodOut);
- if (exchPixelFormat == 0 || exchNumOfAASamples < numOfAASamples) {
- // the number of AA samples cannot be met, take the highest
- if (undefPixelFormat != 0 && undefNumOfAASamples >= exchNumOfAASamples) {
- exchNumOfAASamples = undefNumOfAASamples;
- exchPixelFormat = undefPixelFormat;
- *swapMethodOut = WGL_SWAP_UNDEFINED_ARB;
- }
- if (copyPixelFormat != 0 && copyNumOfAASamples >= exchNumOfAASamples) {
- exchNumOfAASamples = copyNumOfAASamples;
- exchPixelFormat = copyPixelFormat;
- *swapMethodOut = WGL_SWAP_COPY_ARB;
- }
- }
- iPixelFormat = exchPixelFormat;
- m_numOfAASamples = exchNumOfAASamples;
- }
- else {
- iPixelFormat = undefPixelFormat;
- m_numOfAASamples = undefNumOfAASamples;
- }
- }
- else {
- iPixelFormat = copyPixelFormat;
- m_numOfAASamples = copyNumOfAASamples;
- }
return iPixelFormat;
}
@@ -641,15 +566,13 @@ int GHOST_ContextWGL::choose_pixel_format_arb(
bool sRGB)
{
int iPixelFormat;
- int swapMethodOut;
iPixelFormat = _choose_pixel_format_arb_1(
stereoVisual,
numOfAASamples,
needAlpha,
needStencil,
- sRGB,
- &swapMethodOut);
+ sRGB);
if (iPixelFormat == 0 && stereoVisual) {
fprintf(stderr, "Warning! Unable to find a stereo pixel format.\n");
@@ -659,19 +582,11 @@ int GHOST_ContextWGL::choose_pixel_format_arb(
numOfAASamples,
needAlpha,
needStencil,
- sRGB,
- &swapMethodOut);
+ sRGB);
m_stereoVisual = false; // set context property to actual value
}
- if (swapMethodOut != WGL_SWAP_COPY_ARB) {
- fprintf(stderr,
- "Warning! Unable to find a pixel format that supports WGL_SWAP_COPY_ARB. "
- "Substituting one that uses %s.\n",
- swapMethodOut == WGL_SWAP_UNDEFINED_ARB ? "WGL_SWAP_UNDEFINED_ARB" : "WGL_SWAP_EXCHANGE_ARB");
- }
-
return iPixelFormat;
}
@@ -689,7 +604,6 @@ int GHOST_ContextWGL::choose_pixel_format(
(DWORD) (
PFD_SUPPORT_OPENGL |
PFD_DRAW_TO_WINDOW |
- PFD_SWAP_COPY | /* support swap copy */
PFD_DOUBLEBUFFER | /* support double-buffering */
(stereoVisual ? PFD_STEREO : 0) |/* support stereo */
(
diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h
index 2ffe9523008..07ed7f4d2ef 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.h
+++ b/intern/ghost/intern/GHOST_ContextWGL.h
@@ -131,15 +131,7 @@ private:
int numOfAASamples,
bool needAlpha,
bool needStencil,
- bool sRGB,
- int *swapMethodOut);
-
- int _choose_pixel_format_arb_2(bool stereoVisual,
- int *numOfAASamples,
- bool needAlpha,
- bool needStencil,
- bool sRGB,
- int swapMethod);
+ bool sRGB);
void initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD);