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
1cbc85c4
Commit
1cbc85c4
authored
Apr 11, 2024
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Apr 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32/tests: Add default framebuffer tests.
parent
b395d9ec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
92 additions
and
0 deletions
+92
-0
opengl.c
dlls/opengl32/tests/opengl.c
+92
-0
No files found.
dlls/opengl32/tests/opengl.c
View file @
1cbc85c4
...
...
@@ -53,8 +53,29 @@ static void (WINAPI *pglDebugMessageCallbackARB)(void *, void *);
static
void
(
WINAPI
*
pglDebugMessageControlARB
)(
GLenum
,
GLenum
,
GLenum
,
GLsizei
,
const
GLuint
*
,
GLboolean
);
static
void
(
WINAPI
*
pglDebugMessageInsertARB
)(
GLenum
,
GLenum
,
GLuint
,
GLenum
,
GLsizei
,
const
char
*
);
/* GL_ARB_framebuffer_object */
static
void
(
WINAPI
*
pglBindFramebuffer
)(
GLenum
target
,
GLuint
framebuffer
);
static
GLenum
(
WINAPI
*
pglCheckFramebufferStatus
)(
GLenum
target
);
static
const
char
*
wgl_extensions
=
NULL
;
static
void
flush_events
(
void
)
{
MSG
msg
;
int
diff
=
200
;
int
min_timeout
=
100
;
DWORD
time
=
GetTickCount
()
+
diff
;
while
(
diff
>
0
)
{
if
(
MsgWaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
min_timeout
,
QS_ALLINPUT
)
==
WAIT_TIMEOUT
)
break
;
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
diff
=
time
-
GetTickCount
();
}
}
static
void
init_functions
(
void
)
{
#define GET_PROC(func) \
...
...
@@ -90,6 +111,10 @@ static void init_functions(void)
GET_PROC
(
glDebugMessageControlARB
)
GET_PROC
(
glDebugMessageInsertARB
)
/* GL_ARB_framebuffer_object */
GET_PROC
(
glBindFramebuffer
)
GET_PROC
(
glCheckFramebufferStatus
)
#undef GET_PROC
}
...
...
@@ -1335,6 +1360,72 @@ static void test_minimized(void)
DestroyWindow
(
window
);
}
static
void
test_framebuffer
(
void
)
{
static
const
PIXELFORMATDESCRIPTOR
pf_desc
=
{
sizeof
(
PIXELFORMATDESCRIPTOR
),
1
,
/* version */
PFD_DRAW_TO_WINDOW
|
PFD_SUPPORT_OPENGL
|
PFD_DOUBLEBUFFER
,
PFD_TYPE_RGBA
,
24
,
/* 24-bit color depth */
0
,
0
,
0
,
0
,
0
,
0
,
/* color bits */
0
,
/* alpha buffer */
0
,
/* shift bit */
0
,
/* accumulation buffer */
0
,
0
,
0
,
0
,
/* accum bits */
32
,
/* z-buffer */
0
,
/* stencil buffer */
0
,
/* auxiliary buffer */
PFD_MAIN_PLANE
,
/* main layer */
0
,
/* reserved */
0
,
0
,
0
/* layer masks */
};
int
pixel_format
;
GLenum
status
;
HWND
window
;
HGLRC
ctx
;
BOOL
ret
;
HDC
dc
;
/* Test the default framebuffer status for a window that becomes visible after wglMakeCurrent() */
window
=
CreateWindowA
(
"static"
,
"opengl32_test"
,
WS_POPUP
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
ok
(
!!
window
,
"Failed to create window, last error %#lx.
\n
"
,
GetLastError
());
dc
=
GetDC
(
window
);
ok
(
!!
dc
,
"Failed to get DC.
\n
"
);
pixel_format
=
ChoosePixelFormat
(
dc
,
&
pf_desc
);
if
(
!
pixel_format
)
{
win_skip
(
"Failed to find pixel format.
\n
"
);
ReleaseDC
(
window
,
dc
);
DestroyWindow
(
window
);
return
;
}
ret
=
SetPixelFormat
(
dc
,
pixel_format
,
&
pf_desc
);
ok
(
ret
,
"Failed to set pixel format, last error %#lx.
\n
"
,
GetLastError
());
ctx
=
wglCreateContext
(
dc
);
ok
(
!!
ctx
,
"Failed to create GL context, last error %#lx.
\n
"
,
GetLastError
());
ret
=
wglMakeCurrent
(
dc
,
ctx
);
ok
(
ret
,
"Failed to make context current, last error %#lx.
\n
"
,
GetLastError
());
ShowWindow
(
window
,
SW_SHOW
);
flush_events
();
pglBindFramebuffer
(
GL_FRAMEBUFFER
,
0
);
status
=
pglCheckFramebufferStatus
(
GL_FRAMEBUFFER
);
todo_wine_if
(
status
==
GL_FRAMEBUFFER_UNDEFINED
)
/* macOS */
ok
(
status
==
GL_FRAMEBUFFER_COMPLETE
,
"Expected %#x, got %#x.
\n
"
,
GL_FRAMEBUFFER_COMPLETE
,
status
);
ret
=
wglMakeCurrent
(
NULL
,
NULL
);
ok
(
ret
,
"Failed to clear current context, last error %#lx.
\n
"
,
GetLastError
());
ret
=
wglDeleteContext
(
ctx
);
ok
(
ret
,
"Failed to delete GL context, last error %#lx.
\n
"
,
GetLastError
());
ReleaseDC
(
window
,
dc
);
DestroyWindow
(
window
);
}
static
void
test_window_dc
(
void
)
{
PIXELFORMATDESCRIPTOR
pf_desc
=
...
...
@@ -2162,6 +2253,7 @@ START_TEST(opengl)
test_colorbits
(
hdc
);
test_gdi_dbuf
(
hdc
);
test_acceleration
(
hdc
);
test_framebuffer
();
wgl_extensions
=
pwglGetExtensionsStringARB
(
hdc
);
if
(
wgl_extensions
==
NULL
)
skip
(
"Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!
\n
"
);
...
...
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