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
8da09ba1
Commit
8da09ba1
authored
Sep 04, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Sep 05, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Test DDCAPS2_TEXTUREMANAGE compatibility, with other flags.
parent
b73464a4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
207 additions
and
0 deletions
+207
-0
ddraw.c
dlls/ddraw/ddraw.c
+15
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+96
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+96
-0
No files found.
dlls/ddraw/ddraw.c
View file @
8da09ba1
...
...
@@ -2699,6 +2699,21 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
}
}
if
(
DDSD
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_TEXTUREMANAGE
)
{
if
(
!
(
DDSD
->
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
))
{
WARN
(
"DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.
\n
"
);
return
DDERR_INVALIDCAPS
;
}
if
(
DDSD
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_SYSTEMMEMORY
))
{
WARN
(
"DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
"or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.
\n
"
);
return
DDERR_INVALIDCAPS
;
}
}
/* According to the msdn this flag is ignored by CreateSurface */
if
(
DDSD
->
dwSize
>=
sizeof
(
DDSURFACEDESC2
))
DDSD
->
ddsCaps
.
dwCaps2
&=
~
DDSCAPS2_MIPMAPSUBLEVEL
;
...
...
dlls/ddraw/tests/ddraw4.c
View file @
8da09ba1
...
...
@@ -3819,6 +3819,101 @@ static void test_coop_level_activateapp(void)
IDirectDraw4_Release
(
ddraw
);
}
static
void
test_texturemanage
(
void
)
{
IDirectDraw4
*
ddraw
;
HRESULT
hr
;
DDSURFACEDESC2
ddsd
;
IDirectDrawSurface4
*
surface
;
unsigned
int
i
;
DDCAPS
hal_caps
,
hel_caps
;
DWORD
needed_caps
=
DDSCAPS_TEXTURE
|
DDSCAPS_VIDEOMEMORY
;
static
const
struct
{
DWORD
caps_in
,
caps2_in
;
HRESULT
hr
;
DWORD
caps_out
,
caps2_out
;
}
tests
[]
=
{
{
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
},
{
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
,
0
,
DD_OK
,
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
|
DDSCAPS_LOCALVIDMEM
,
0
},
{
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
0
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
0
},
{
0
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
,
0
,
DD_OK
,
DDSCAPS_LOCALVIDMEM
|
DDSCAPS_VIDEOMEMORY
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
,
0
},
};
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create IDirectDraw4 object, skipping tests.
\n
"
);
return
;
}
hr
=
IDirectDraw4_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
memset
(
&
hal_caps
,
0
,
sizeof
(
hal_caps
));
hal_caps
.
dwSize
=
sizeof
(
hal_caps
);
memset
(
&
hel_caps
,
0
,
sizeof
(
hel_caps
));
hel_caps
.
dwSize
=
sizeof
(
hel_caps
);
hr
=
IDirectDraw4_GetCaps
(
ddraw
,
&
hal_caps
,
&
hel_caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get caps, hr %#x.
\n
"
,
hr
);
if
((
hal_caps
.
ddsCaps
.
dwCaps
&
needed_caps
)
!=
needed_caps
)
{
skip
(
"Managed textures not supported, skipping managed texture test.
\n
"
);
IDirectDraw4_Release
(
ddraw
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
i
++
)
{
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
;
ddsd
.
ddsCaps
.
dwCaps
=
tests
[
i
].
caps_in
;
ddsd
.
ddsCaps
.
dwCaps2
=
tests
[
i
].
caps2_in
;
ddsd
.
dwWidth
=
4
;
ddsd
.
dwHeight
=
4
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
hr
==
tests
[
i
].
hr
,
"Got unexpected, hr %#x, case %u.
\n
"
,
hr
,
i
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
hr
=
IDirectDrawSurface4_GetSurfaceDesc
(
surface
,
&
ddsd
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
ddsd
.
ddsCaps
.
dwCaps
==
tests
[
i
].
caps_out
,
"Input caps %#x, %#x, expected output caps %#x, got %#x, case %u.
\n
"
,
tests
[
i
].
caps_in
,
tests
[
i
].
caps2_in
,
tests
[
i
].
caps_out
,
ddsd
.
ddsCaps
.
dwCaps
,
i
);
ok
(
ddsd
.
ddsCaps
.
dwCaps2
==
tests
[
i
].
caps2_out
,
"Input caps %#x, %#x, expected output caps %#x, got %#x, case %u.
\n
"
,
tests
[
i
].
caps_in
,
tests
[
i
].
caps2_in
,
tests
[
i
].
caps2_out
,
ddsd
.
ddsCaps
.
dwCaps2
,
i
);
IDirectDrawSurface4_Release
(
surface
);
}
IDirectDraw4_Release
(
ddraw
);
}
START_TEST
(
ddraw4
)
{
test_process_vertices
();
...
...
@@ -3849,4 +3944,5 @@ START_TEST(ddraw4)
test_coop_level_versions
();
test_lighting_interface_versions
();
test_coop_level_activateapp
();
test_texturemanage
();
}
dlls/ddraw/tests/ddraw7.c
View file @
8da09ba1
...
...
@@ -3633,6 +3633,101 @@ static void test_coop_level_activateapp(void)
IDirectDraw7_Release
(
ddraw
);
}
static
void
test_texturemanage
(
void
)
{
IDirectDraw7
*
ddraw
;
HRESULT
hr
;
DDSURFACEDESC2
ddsd
;
IDirectDrawSurface7
*
surface
;
unsigned
int
i
;
DDCAPS
hal_caps
,
hel_caps
;
DWORD
needed_caps
=
DDSCAPS_TEXTURE
|
DDSCAPS_VIDEOMEMORY
;
static
const
struct
{
DWORD
caps_in
,
caps2_in
;
HRESULT
hr
;
DWORD
caps_out
,
caps2_out
;
}
tests
[]
=
{
{
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
},
{
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
,
0
,
DD_OK
,
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_TEXTURE
|
DDSCAPS_LOCALVIDMEM
,
0
},
{
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
0
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
|
DDSCAPS_TEXTURE
,
0
},
{
0
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_SYSTEMMEMORY
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
,
DDSCAPS2_TEXTUREMANAGE
,
DDERR_INVALIDCAPS
,
~
0U
,
~
0U
},
{
DDSCAPS_VIDEOMEMORY
,
0
,
DD_OK
,
DDSCAPS_LOCALVIDMEM
|
DDSCAPS_VIDEOMEMORY
,
0
},
{
DDSCAPS_SYSTEMMEMORY
,
0
,
DD_OK
,
DDSCAPS_SYSTEMMEMORY
,
0
},
};
if
(
!
(
ddraw
=
create_ddraw
()))
{
skip
(
"Failed to create IDirectDraw7 object, skipping tests.
\n
"
);
return
;
}
hr
=
IDirectDraw7_SetCooperativeLevel
(
ddraw
,
NULL
,
DDSCL_NORMAL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cooperative level, hr %#x.
\n
"
,
hr
);
memset
(
&
hal_caps
,
0
,
sizeof
(
hal_caps
));
hal_caps
.
dwSize
=
sizeof
(
hal_caps
);
memset
(
&
hel_caps
,
0
,
sizeof
(
hel_caps
));
hel_caps
.
dwSize
=
sizeof
(
hel_caps
);
hr
=
IDirectDraw7_GetCaps
(
ddraw
,
&
hal_caps
,
&
hel_caps
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get caps, hr %#x.
\n
"
,
hr
);
if
((
hal_caps
.
ddsCaps
.
dwCaps
&
needed_caps
)
!=
needed_caps
)
{
skip
(
"Managed textures not supported, skipping managed texture test.
\n
"
);
IDirectDraw7_Release
(
ddraw
);
return
;
}
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
i
++
)
{
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
;
ddsd
.
ddsCaps
.
dwCaps
=
tests
[
i
].
caps_in
;
ddsd
.
ddsCaps
.
dwCaps2
=
tests
[
i
].
caps2_in
;
ddsd
.
dwWidth
=
4
;
ddsd
.
dwHeight
=
4
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
hr
==
tests
[
i
].
hr
,
"Got unexpected, hr %#x, case %u.
\n
"
,
hr
,
i
);
if
(
FAILED
(
hr
))
continue
;
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
hr
=
IDirectDrawSurface7_GetSurfaceDesc
(
surface
,
&
ddsd
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get surface desc, hr %#x.
\n
"
,
hr
);
ok
(
ddsd
.
ddsCaps
.
dwCaps
==
tests
[
i
].
caps_out
,
"Input caps %#x, %#x, expected output caps %#x, got %#x, case %u.
\n
"
,
tests
[
i
].
caps_in
,
tests
[
i
].
caps2_in
,
tests
[
i
].
caps_out
,
ddsd
.
ddsCaps
.
dwCaps
,
i
);
ok
(
ddsd
.
ddsCaps
.
dwCaps2
==
tests
[
i
].
caps2_out
,
"Input caps %#x, %#x, expected output caps %#x, got %#x, case %u.
\n
"
,
tests
[
i
].
caps_in
,
tests
[
i
].
caps2_in
,
tests
[
i
].
caps2_out
,
ddsd
.
ddsCaps
.
dwCaps2
,
i
);
IDirectDrawSurface7_Release
(
surface
);
}
IDirectDraw7_Release
(
ddraw
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -3671,4 +3766,5 @@ START_TEST(ddraw7)
test_fog_special
();
test_lighting_interface_versions
();
test_coop_level_activateapp
();
test_texturemanage
();
}
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