Kaydet (Commit) ecc421ca authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add some assertions and improve comments

Make sure the hardcoded indexes into the iAttributes array that we use
mean what they are supposed to.

Add comments about that, and fix one misleading comment.

Change-Id: Ibb748b00782db4fcaf34f6c717075f6aff50651e
üst 3042270b
...@@ -298,16 +298,22 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, ...@@ -298,16 +298,22 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
}; };
if (!bUseDoubleBufferedRendering) if (!bUseDoubleBufferedRendering)
{
// Use asserts to make sure the iAttributes array is not changed without changing these ugly
// hardcode indexes into it.
assert(iAttributes[0] == WGL_DOUBLE_BUFFER_ARB);
iAttributes[1] = GL_FALSE; iAttributes[1] = GL_FALSE;
}
if (bRequestVirtualDevice) if (bRequestVirtualDevice)
{ {
assert(iAttributes[2] == WGL_DRAW_TO_WINDOW_ARB);
iAttributes[2] = WGL_DRAW_TO_BITMAP_ARB; iAttributes[2] = WGL_DRAW_TO_BITMAP_ARB;
} }
bool bArbMultisampleSupported = true; bool bArbMultisampleSupported = true;
// First we check to see if we can get a pixel format for 4 samples // First we check to see if we can get a pixel format for 8 samples
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
// If we returned true, and our format count is greater than 1 // If we returned true, and our format count is greater than 1
if (valid && numFormats >= 1) if (valid && numFormats >= 1)
...@@ -320,7 +326,8 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, ...@@ -320,7 +326,8 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
DestroyWindow(hWnd); DestroyWindow(hWnd);
return bArbMultisampleSupported; return bArbMultisampleSupported;
} }
// Our pixel format with 4 samples failed, test for 2 samples // Our pixel format with 8 samples failed, test for 2 samples
assert(iAttributes[18] == WGL_SAMPLES_ARB);
iAttributes[19] = 2; iAttributes[19] = 2;
valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
if (valid && numFormats >= 1) if (valid && numFormats >= 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment