Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a61e58db
Commit
a61e58db
authored
Apr 24, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 30, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Add a test for surface attachments.
parent
9e3e799c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
2 deletions
+110
-2
surface.c
dlls/ddraw/surface.c
+10
-2
dsurface.c
dlls/ddraw/tests/dsurface.c
+100
-0
No files found.
dlls/ddraw/surface.c
View file @
a61e58db
...
...
@@ -794,8 +794,16 @@ IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurface7 *iface,
if
(
Surf
==
This
)
return
DDERR_CANNOTATTACHSURFACE
;
/* unchecked */
/* TODO MSDN: "You can attach only z-buffer surfaces with this method."
* But apparently backbuffers and mipmaps can be attached too. */
/* MSDN: Only Z buffer surfaces can be attached. An old comment said that apparently
* mipmaps and back buffers can be attached too, although our tests say no.
*/
if
(
!
(
Surf
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_ZBUFFER
))
{
/* Write a fixme until we know for sure what is going on */
FIXME
(
"Application tries to attach a non Z buffer surface. caps %08x
\n
"
,
Surf
->
surface_desc
.
ddsCaps
.
dwCaps
);
return
DDERR_CANNOTATTACHSURFACE
;
}
/* Set MIPMAPSUBLEVEL if this seems to be one */
if
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
...
...
dlls/ddraw/tests/dsurface.c
View file @
a61e58db
...
...
@@ -943,6 +943,105 @@ static void EnumTest(void)
IDirectDrawSurface_Release
(
surface
);
}
HRESULT
WINAPI
SurfaceCounter
(
IDirectDrawSurface7
*
surface
,
DDSURFACEDESC2
*
desc
,
void
*
context
)
{
UINT
*
num
=
context
;
(
*
num
)
++
;
IDirectDrawSurface_Release
(
surface
);
return
DDENUMRET_OK
;
}
static
void
AttachmentTest
(
void
)
{
HRESULT
hr
;
IDirectDraw7
*
dd7
;
IDirectDrawSurface7
*
surface1
,
*
surface2
,
*
surface3
;
DDSURFACEDESC2
ddsd
;
UINT
num
;
DDSCAPS2
caps
=
{
DDSCAPS_TEXTURE
,
0
,
0
,
0
};
HWND
window
=
CreateWindow
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirectDraw_QueryInterface
(
lpDD
,
&
IID_IDirectDraw7
,
(
void
**
)
&
dd7
);
ok
(
hr
==
DD_OK
,
"IDirectDraw_QueryInterface returned %08x
\n
"
,
hr
);
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_MIPMAPCOUNT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
|
DDSCAPS_COMPLEX
|
DDSCAPS_MIPMAP
;
U2
(
ddsd
).
dwMipMapCount
=
3
;
/* Will create 128x128, 64x64, 32x32 */
ddsd
.
dwWidth
=
128
;
ddsd
.
dwHeight
=
128
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
/* ROOT */
num
=
0
;
IDirectDrawSurface7_EnumAttachedSurfaces
(
surface1
,
&
num
,
SurfaceCounter
);
ok
(
num
==
1
,
"Mipmap root has %d surfaces attached, expected 1
\n
"
,
num
);
/* DONE ROOT */
/* LEVEL 1 */
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
surface1
,
&
caps
,
&
surface2
);
ok
(
hr
==
DD_OK
,
"GetAttachedSurface returned %08x
\n
"
,
hr
);
num
=
0
;
IDirectDrawSurface7_EnumAttachedSurfaces
(
surface2
,
&
num
,
SurfaceCounter
);
ok
(
num
==
1
,
"First mip level has %d surfaces attached, expected 1
\n
"
,
num
);
/* DONE LEVEL 1 */
/* LEVEL 2 */
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
surface2
,
&
caps
,
&
surface3
);
ok
(
hr
==
DD_OK
,
"GetAttachedSurface returned %08x
\n
"
,
hr
);
IDirectDrawSurface7_Release
(
surface2
);
num
=
0
;
IDirectDrawSurface7_EnumAttachedSurfaces
(
surface3
,
&
num
,
SurfaceCounter
);
ok
(
num
==
0
,
"Secound mip level has %d surfaces attached, expected 1
\n
"
,
num
);
/* Done level 2 */
/* Mip level 3 is still needed */
/* Try to attach a 16x16 miplevel - Should not work as far I can see */
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_TEXTURE
;
ddsd
.
dwWidth
=
16
;
ddsd
.
dwHeight
=
16
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface2
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface1
,
surface2
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a 16x16 surface to a 128x128 texture root returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface2
,
surface1
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a 128x128 texture root to a 16x16 texture returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface3
,
surface2
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a 16x16 surface to a 32x32 texture mip level returned %08x
\n
"
,
hr
);
hr
=
IDirectDrawSurface7_AddAttachedSurface
(
surface2
,
surface3
);
ok
(
hr
==
DDERR_CANNOTATTACHSURFACE
,
"Attaching a 32x32 texture mip level to a 16x16 surface returned %08x
\n
"
,
hr
);
IDirectDrawSurface7_Release
(
surface3
);
IDirectDrawSurface7_Release
(
surface2
);
IDirectDrawSurface7_Release
(
surface1
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
dd7
,
window
,
DDSCL_EXCLUSIVE
|
DDSCL_FULLSCREEN
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_BACKBUFFERCOUNT
|
DDSD_CAPS
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_COMPLEX
|
DDSCAPS_FLIP
;
U2
(
ddsd
).
dwBackBufferCount
=
2
;
hr
=
IDirectDraw7_CreateSurface
(
dd7
,
&
ddsd
,
&
surface1
,
NULL
);
ok
(
hr
==
DD_OK
,
"CreateSurface returned: %x
\n
"
,
hr
);
num
=
0
;
IDirectDrawSurface7_EnumAttachedSurfaces
(
surface1
,
&
num
,
SurfaceCounter
);
ok
(
num
==
1
,
"Primary surface has %d surfaces attached, expected 1
\n
"
,
num
);
IDirectDrawSurface7_Release
(
surface1
);
hr
=
IDirectDraw7_SetCooperativeLevel
(
dd7
,
NULL
,
DDSCL_NORMAL
);
ok
(
hr
==
DD_OK
,
"SetCooperativeLevel returned %08x
\n
"
,
hr
);
IDirectDraw7_Release
(
dd7
);
}
START_TEST
(
dsurface
)
{
if
(
!
CreateDirectDraw
())
...
...
@@ -955,5 +1054,6 @@ START_TEST(dsurface)
GetDDInterface_4
();
GetDDInterface_7
();
EnumTest
();
AttachmentTest
();
ReleaseDirectDraw
();
}
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