Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3fc8ac55
Commit
3fc8ac55
authored
Aug 02, 2007
by
Chris Robinson
Committed by
Alexandre Julliard
Aug 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wgl: WGL_COLOR_BITS_ARB does include alpha.
parent
38c7e935
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
46 deletions
+43
-46
opengl.c
dlls/opengl32/tests/opengl.c
+38
-0
opengl.c
dlls/winex11.drv/opengl.c
+5
-46
No files found.
dlls/opengl32/tests/opengl.c
View file @
3fc8ac55
...
...
@@ -30,7 +30,13 @@ static const char* (WINAPI *pwglGetExtensionsStringARB)(HDC);
static
int
(
WINAPI
*
pwglReleasePbufferDCARB
)(
HPBUFFERARB
,
HDC
);
/* WGL_ARB_pixel_format */
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_ALPHA_BITS_ARB 0x201B
static
BOOL
(
WINAPI
*
pwglChoosePixelFormatARB
)(
HDC
,
const
int
*
,
const
FLOAT
*
,
UINT
,
int
*
,
UINT
*
);
static
BOOL
(
WINAPI
*
pwglGetPixelFormatAttribivARB
)(
HDC
,
int
,
int
,
UINT
,
const
int
*
,
int
*
);
/* WGL_ARB_pbuffer */
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
...
...
@@ -46,6 +52,7 @@ static void init_functions(void)
/* WGL_ARB_pixel_format */
pwglChoosePixelFormatARB
=
(
void
*
)
wglGetProcAddress
(
"wglChoosePixelFormatARB"
);
pwglGetPixelFormatAttribivARB
=
(
void
*
)
wglGetProcAddress
(
"wglGetPixelFormatAttribivARB"
);
/* WGL_ARB_pbuffer */
pwglCreatePbufferARB
=
(
void
*
)
wglGetProcAddress
(
"wglCreatePbufferARB"
);
...
...
@@ -188,6 +195,36 @@ static void test_setpixelformat(void)
ok
(
res
==
0
,
"SetPixelFormat on main device context should fail
\n
"
);
}
static
void
test_colorbits
(
HDC
hdc
)
{
const
int
iAttribList
[]
=
{
WGL_COLOR_BITS_ARB
,
WGL_RED_BITS_ARB
,
WGL_GREEN_BITS_ARB
,
WGL_BLUE_BITS_ARB
,
WGL_ALPHA_BITS_ARB
};
int
iAttribRet
[
sizeof
(
iAttribList
)
/
sizeof
(
iAttribList
[
0
])];
const
int
iAttribs
[]
=
{
WGL_ALPHA_BITS_ARB
,
1
,
0
};
unsigned
int
nFormats
;
int
res
;
int
iPixelFormat
=
0
;
/* We need a pixel format with at least one bit of alpha */
res
=
pwglChoosePixelFormatARB
(
hdc
,
iAttribs
,
NULL
,
1
,
&
iPixelFormat
,
&
nFormats
);
if
(
res
==
FALSE
||
nFormats
==
0
)
{
skip
(
"No suitable pixel formats found
\n
"
);
return
;
}
res
=
pwglGetPixelFormatAttribivARB
(
hdc
,
iPixelFormat
,
0
,
sizeof
(
iAttribList
)
/
sizeof
(
iAttribList
[
0
]),
iAttribList
,
iAttribRet
);
if
(
res
==
FALSE
)
{
skip
(
"wglGetPixelFormatAttribivARB failed
\n
"
);
return
;
}
iAttribRet
[
1
]
+=
iAttribRet
[
2
]
+
iAttribRet
[
3
]
+
iAttribRet
[
4
];
ok
(
iAttribRet
[
0
]
==
iAttribRet
[
1
],
"WGL_COLOR_BITS_ARB (%d) does not equal R+G+B+A (%d)!
\n
"
,
iAttribRet
[
0
],
iAttribRet
[
1
]);
}
START_TEST
(
opengl
)
{
HWND
hwnd
;
...
...
@@ -236,6 +273,7 @@ START_TEST(opengl)
init_functions
();
test_setpixelformat
();
test_colorbits
(
hdc
);
wgl_extensions
=
pwglGetExtensionsStringARB
(
hdc
);
if
(
wgl_extensions
==
NULL
)
skip
(
"Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!
\n
"
);
...
...
dlls/winex11.drv/opengl.c
View file @
3fc8ac55
...
...
@@ -619,9 +619,6 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuf
int
drawattrib
=
0
;
int
nvfloatattrib
=
GLX_DONT_CARE
;
int
pixelattrib
=
0
;
int
isColor
=
0
;
int
wantColorBits
=
0
;
int
sz_alpha
=
0
;
/* The list of WGL attributes is allowed to be NULL. We don't return here for NULL
* because we need to do fixups for GLX_DRAWABLE_TYPE/GLX_RENDER_TYPE/GLX_FLOAT_COMPONENTS_NV. */
...
...
@@ -631,7 +628,8 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuf
switch
(
iWGLAttr
[
cur
])
{
case
WGL_COLOR_BITS_ARB
:
pop
=
iWGLAttr
[
++
cur
];
wantColorBits
=
pop
;
/** see end */
PUSH2
(
oGLXAttr
,
GLX_BUFFER_SIZE
,
pop
);
TRACE
(
"pAttr[%d] = GLX_BUFFER_SIZE: %d
\n
"
,
cur
,
pop
);
break
;
case
WGL_BLUE_BITS_ARB
:
pop
=
iWGLAttr
[
++
cur
];
...
...
@@ -650,7 +648,6 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuf
break
;
case
WGL_ALPHA_BITS_ARB
:
pop
=
iWGLAttr
[
++
cur
];
sz_alpha
=
pop
;
PUSH2
(
oGLXAttr
,
GLX_ALPHA_SIZE
,
pop
);
TRACE
(
"pAttr[%d] = GLX_ALPHA_SIZE: %d
\n
"
,
cur
,
pop
);
break
;
...
...
@@ -674,7 +671,7 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuf
pop
=
iWGLAttr
[
++
cur
];
TRACE
(
"pAttr[%d] = WGL_PIXEL_TYPE_ARB: %d
\n
"
,
cur
,
pop
);
switch
(
pop
)
{
case
WGL_TYPE_COLORINDEX_ARB
:
pixelattrib
=
GLX_COLOR_INDEX_BIT
;
isColor
=
1
;
break
;
case
WGL_TYPE_COLORINDEX_ARB
:
pixelattrib
=
GLX_COLOR_INDEX_BIT
;
break
;
case
WGL_TYPE_RGBA_ARB
:
pixelattrib
=
GLX_RGBA_BIT
;
break
;
/* This is the same as WGL_TYPE_RGBA_FLOAT_ATI but the GLX constants differ, only the ARB GLX one is widely supported so use that */
case
WGL_TYPE_RGBA_FLOAT_ATI
:
pixelattrib
=
GLX_RGBA_FLOAT_BIT
;
break
;
...
...
@@ -787,36 +784,6 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_GLPBuf
++
cur
;
}
/**
* Trick as WGL_COLOR_BITS_ARB != GLX_BUFFER_SIZE
* WGL_COLOR_BITS_ARB + WGL_ALPHA_BITS_ARB == GLX_BUFFER_SIZE
*
* WGL_COLOR_BITS_ARB
* The number of color bitplanes in each color buffer. For RGBA
* pixel types, it is the size of the color buffer, excluding the
* alpha bitplanes. For color-index pixels, it is the size of the
* color index buffer.
*
* GLX_BUFFER_SIZE
* This attribute defines the number of bits per color buffer.
* For GLX FBConfigs that correspond to a PseudoColor or StaticColor visual,
* this is equal to the depth value reported in the X11 visual.
* For GLX FBConfigs that correspond to TrueColor or DirectColor visual,
* this is the sum of GLX_RED_SIZE, GLX_GREEN_SIZE, GLX_BLUE_SIZE, and GLX_ALPHA_SIZE.
*
*/
if
(
0
<
wantColorBits
)
{
if
(
!
isColor
)
{
wantColorBits
+=
sz_alpha
;
}
if
(
32
<
wantColorBits
)
{
ERR
(
"buggy %d GLX_BUFFER_SIZE default to 32
\n
"
,
wantColorBits
);
wantColorBits
=
32
;
}
PUSH2
(
oGLXAttr
,
GLX_BUFFER_SIZE
,
wantColorBits
);
TRACE
(
"pAttr[%d] = WGL_COLOR_BITS_ARB: %d
\n
"
,
cur
,
wantColorBits
);
}
/* Apply the OR'd drawable type bitmask now EVEN when WGL_DRAW_TO* is unset.
* It is needed in all cases because GLX_DRAWABLE_TYPE default to GLX_WINDOW_BIT. */
PUSH2
(
oGLXAttr
,
GLX_DRAWABLE_TYPE
,
drawattrib
);
...
...
@@ -2595,16 +2562,8 @@ static GLboolean WINAPI X11DRV_wglGetPixelFormatAttribivARB(HDC hdc, int iPixelF
continue
;
case
WGL_COLOR_BITS_ARB
:
/** see ConvertAttribWGLtoGLX for explain */
if
(
!
fmt
)
goto
pix_error
;
hTest
=
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_BUFFER_SIZE
,
piValues
+
i
);
if
(
hTest
)
goto
get_error
;
TRACE
(
"WGL_COLOR_BITS_ARB: GLX_BUFFER_SIZE = %d
\n
"
,
piValues
[
i
]);
hTest
=
pglXGetFBConfigAttrib
(
gdi_display
,
fmt
->
fbconfig
,
GLX_ALPHA_SIZE
,
&
tmp
);
if
(
hTest
)
goto
get_error
;
TRACE
(
"WGL_COLOR_BITS_ARB: GLX_ALPHA_SIZE = %d
\n
"
,
tmp
);
piValues
[
i
]
=
piValues
[
i
]
-
tmp
;
continue
;
curGLXAttr
=
GLX_BUFFER_SIZE
;
break
;
case
WGL_BIND_TO_TEXTURE_RGB_ARB
:
if
(
use_render_texture_ati
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment