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
a3dff8af
Commit
a3dff8af
authored
Oct 09, 2008
by
Roderick Colenbrander
Committed by
Alexandre Julliard
Oct 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opengl32: Add a test case for WGL_ARB_create_context/opengl3.
parent
b426a0b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
1 deletion
+121
-1
opengl.c
dlls/opengl32/tests/opengl.c
+121
-1
No files found.
dlls/opengl32/tests/opengl.c
View file @
a3dff8af
/*
* Some tests for OpenGL functions
*
* Copyright (C) 2007 Roderick Colenbrander
* Copyright (C) 2007
-2008
Roderick Colenbrander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -30,6 +30,18 @@ const unsigned char * WINAPI glGetString(unsigned int);
#define MAX_FORMATS 256
typedef
void
*
HPBUFFERARB
;
/* WGL_ARB_create_context */
HGLRC
(
WINAPI
*
pwglCreateContextAttribsARB
)(
HDC
hDC
,
HGLRC
hShareContext
,
const
int
*
attribList
);
/* GetLastError */
#define ERROR_INVALID_VERSION_ARB 0x2095
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
/* Flags for WGL_CONTEXT_FLAGS_ARB */
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
/* WGL_ARB_extensions_string */
static
const
char
*
(
WINAPI
*
pwglGetExtensionsStringARB
)(
HDC
);
static
int
(
WINAPI
*
pwglReleasePbufferDCARB
)(
HPBUFFERARB
,
HDC
);
...
...
@@ -64,6 +76,9 @@ static void init_functions(void)
if(!p ## func) \
trace("wglGetProcAddress(%s) failed\n", #func);
/* WGL_ARB_create_context */
GET_PROC
(
wglCreateContextAttribsARB
);
/* WGL_ARB_extensions_string */
GET_PROC
(
wglGetExtensionsStringARB
)
...
...
@@ -400,6 +415,108 @@ static void test_dc(HWND hwnd, HDC hdc)
}
}
static
void
test_opengl3
(
HDC
hdc
)
{
/* Try to create a context using an invalid OpenGL version namely 0.x */
{
HGLRC
gl3Ctx
;
int
attribs
[]
=
{
WGL_CONTEXT_MAJOR_VERSION_ARB
,
0
,
0
};
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
0
,
attribs
);
ok
(
gl3Ctx
==
0
,
"wglCreateContextAttribs with major version=0 should fail!
\n
"
);
if
(
gl3Ctx
)
wglDeleteContext
(
gl3Ctx
);
}
/* Try to create a context compatible with OpenGL 1.x; 1.0-2.1 is allowed */
{
HGLRC
gl3Ctx
;
int
attribs
[]
=
{
WGL_CONTEXT_MAJOR_VERSION_ARB
,
1
,
0
};
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
0
,
attribs
);
ok
(
gl3Ctx
!=
0
,
"pwglCreateContextAttribsARB for a 1.x context failed!
\n
"
);
wglDeleteContext
(
gl3Ctx
);
}
/* Try to pass an invalid HDC */
{
HGLRC
gl3Ctx
;
DWORD
error
;
gl3Ctx
=
pwglCreateContextAttribsARB
((
HDC
)
0xdeadbeef
,
0
,
0
);
ok
(
gl3Ctx
==
0
,
"pwglCreateContextAttribsARB using an invalid HDC passed
\n
"
);
error
=
GetLastError
();
ok
(
error
==
ERROR_DC_NOT_FOUND
,
"Expected ERROR_DC_NOT_FOUND, got error=%x
\n
"
,
error
);
wglDeleteContext
(
gl3Ctx
);
}
/* Try to pass an invalid shareList */
{
HGLRC
gl3Ctx
;
DWORD
error
;
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
(
HGLRC
)
0xdeadbeef
,
0
);
ok
(
gl3Ctx
==
0
,
"pwglCreateContextAttribsARB using an invalid shareList passed
\n
"
);
error
=
GetLastError
();
ok
(
error
==
ERROR_INVALID_OPERATION
,
"Expected ERROR_INVALID_OPERATION, got error=%x
\n
"
,
error
);
wglDeleteContext
(
gl3Ctx
);
}
/* Try to create an OpenGL 3.0 context */
{
int
attribs
[]
=
{
WGL_CONTEXT_MAJOR_VERSION_ARB
,
3
,
WGL_CONTEXT_MINOR_VERSION_ARB
,
0
,
0
};
HGLRC
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
0
,
attribs
);
if
(
gl3Ctx
==
NULL
)
{
skip
(
"Skipping the rest of the WGL_ARB_create_context test due to lack of OpenGL 3.0
\n
"
);
return
;
}
wglDeleteContext
(
gl3Ctx
);
}
/* Test matching an OpenGL 3.0 context with an older one, OpenGL 3.0 should allow it until the new object model is introduced in a future revision */
{
HGLRC
glCtx
=
wglCreateContext
(
hdc
);
int
attribs
[]
=
{
WGL_CONTEXT_MAJOR_VERSION_ARB
,
3
,
WGL_CONTEXT_MINOR_VERSION_ARB
,
0
,
0
};
int
attribs_future
[]
=
{
WGL_CONTEXT_FLAGS_ARB
,
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
,
WGL_CONTEXT_MAJOR_VERSION_ARB
,
3
,
WGL_CONTEXT_MINOR_VERSION_ARB
,
0
,
0
};
HGLRC
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
glCtx
,
attribs
);
ok
(
gl3Ctx
!=
NULL
,
"Sharing of a display list between OpenGL 3.0 and OpenGL 1.x/2.x failed!
\n
"
);
if
(
gl3Ctx
)
wglDeleteContext
(
gl3Ctx
);
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
glCtx
,
attribs_future
);
ok
(
gl3Ctx
!=
NULL
,
"Sharing of a display list between a forward compatible OpenGL 3.0 context and OpenGL 1.x/2.x failed!
\n
"
);
if
(
gl3Ctx
)
wglDeleteContext
(
gl3Ctx
);
if
(
glCtx
)
wglDeleteContext
(
glCtx
);
}
/* Try to create an OpenGL 3.0 context and test windowless rendering */
{
HGLRC
gl3Ctx
;
int
attribs
[]
=
{
WGL_CONTEXT_MAJOR_VERSION_ARB
,
3
,
WGL_CONTEXT_MINOR_VERSION_ARB
,
0
,
0
};
BOOL
res
;
gl3Ctx
=
pwglCreateContextAttribsARB
(
hdc
,
0
,
attribs
);
ok
(
gl3Ctx
!=
0
,
"pwglCreateContextAttribsARB for a 3.0 context failed!
\n
"
);
/* OpenGL 3.0 allows offscreen rendering WITHOUT a drawable */
/* NOTE: Nvidia's 177.89 beta drivers don't allow this yet */
res
=
wglMakeCurrent
(
0
,
gl3Ctx
);
ok
(
res
==
TRUE
,
"OpenGL 3.0 should allow windowless rendering, but the test failed!
\n
"
);
if
(
res
)
wglMakeCurrent
(
0
,
0
);
if
(
gl3Ctx
)
wglDeleteContext
(
gl3Ctx
);
}
}
START_TEST
(
opengl
)
{
HWND
hwnd
;
...
...
@@ -477,6 +594,9 @@ START_TEST(opengl)
wgl_extensions
=
pwglGetExtensionsStringARB
(
hdc
);
if
(
wgl_extensions
==
NULL
)
skip
(
"Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!
\n
"
);
if
(
strstr
(
wgl_extensions
,
"WGL_ARB_create_context"
))
test_opengl3
(
hdc
);
if
(
strstr
(
wgl_extensions
,
"WGL_ARB_make_current_read"
))
test_make_current_read
(
hdc
);
else
...
...
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