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
1f366058
Commit
1f366058
authored
Dec 03, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 03, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: SetSurfaceDesc is not allowed on managed textures.
parent
eb361e9e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
175 additions
and
93 deletions
+175
-93
surface.c
dlls/ddraw/surface.c
+2
-1
ddraw2.c
dlls/ddraw/tests/ddraw2.c
+58
-33
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+57
-29
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+58
-30
No files found.
dlls/ddraw/surface.c
View file @
1f366058
...
...
@@ -4245,7 +4245,8 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
WARN
(
"Flags is %x, returning DDERR_INVALIDPARAMS
\n
"
,
Flags
);
return
DDERR_INVALIDPARAMS
;
}
if
(
!
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_SYSTEMMEMORY
))
if
(
!
(
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_SYSTEMMEMORY
)
||
This
->
surface_desc
.
ddsCaps
.
dwCaps2
&
(
DDSCAPS2_TEXTUREMANAGE
|
DDSCAPS2_D3DTEXTUREMANAGE
))
{
WARN
(
"Surface is not in system memory, returning DDERR_INVALIDSURFACETYPE.
\n
"
);
return
DDERR_INVALIDSURFACETYPE
;
...
...
dlls/ddraw/tests/ddraw2.c
View file @
1f366058
...
...
@@ -4414,6 +4414,18 @@ static void test_set_surface_desc(void)
IDirectDrawSurface3
*
surface3
;
BYTE
data
[
16
*
16
*
4
];
ULONG
ref
;
unsigned
int
i
;
static
const
struct
{
DWORD
caps
;
BOOL
supported
;
const
char
*
name
;
}
invalid_caps_tests
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
FALSE
,
"videomemory plain"
},
{
DDSCAPS_TEXTURE
|
DDSCAPS_SYSTEMMEMORY
,
TRUE
,
"systemmemory texture"
},
};
if
(
!
(
ddraw
=
create_ddraw
()))
{
...
...
@@ -4611,44 +4623,57 @@ static void test_set_surface_desc(void)
IDirectDrawSurface3_Release
(
surface3
);
/*
Need
systemmemory surfaces.
/*
SetSurfaceDesc needs
systemmemory surfaces.
*
* As a sidenote, fourcc surfaces aren't allowed in sysmem, thus testing DDSD_LINEARSIZE is moot. */
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_VIDEOMEMORY
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
for
(
i
=
0
;
i
<
sizeof
(
invalid_caps_tests
)
/
sizeof
(
*
invalid_caps_tests
);
i
++
)
{
skip
(
"Cannot create a video memory surface, skipping vidmem SetSurfaceDesc test.
\n
"
);
goto
done
;
}
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface3
,
(
void
**
)
&
surface3
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get IDirectDrawSurface3 interface, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
surface
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface3_SetSurfaceDesc
(
surface3
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
invalid_caps_tests
[
i
].
caps
;
hr
=
IDirectDraw_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Cannot create a %s surface, skipping vidmem SetSurfaceDesc test.
\n
"
,
invalid_caps_tests
[
i
].
name
);
goto
done
;
}
hr
=
IDirectDrawSurface_QueryInterface
(
surface
,
&
IID_IDirectDrawSurface3
,
(
void
**
)
&
surface3
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get IDirectDrawSurface3 interface, hr %#x.
\n
"
,
hr
);
IDirectDrawSurface_Release
(
surface
);
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface3_SetSurfaceDesc
(
surface3
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface3_SetSurfaceDesc
(
surface3
,
&
ddsd
,
0
);
if
(
invalid_caps_tests
[
i
].
supported
)
{
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
}
else
{
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface3_SetSurfaceDesc
(
surface3
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
}
IDirectDrawSurface3_Release
(
surface3
);
IDirectDrawSurface3_Release
(
surface3
);
}
done:
ref
=
IDirectDraw2_Release
(
ddraw
);
...
...
dlls/ddraw/tests/ddraw4.c
View file @
1f366058
...
...
@@ -5017,6 +5017,20 @@ static void test_set_surface_desc(void)
IDirectDrawSurface4
*
surface
;
BYTE
data
[
16
*
16
*
4
];
ULONG
ref
;
unsigned
int
i
;
static
const
struct
{
DWORD
caps
,
caps2
;
BOOL
supported
;
const
char
*
name
;
}
invalid_caps_tests
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
FALSE
,
"videomemory plain"
},
{
DDSCAPS_TEXTURE
|
DDSCAPS_SYSTEMMEMORY
,
0
,
TRUE
,
"systemmemory texture"
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_D3DTEXTUREMANAGE
,
FALSE
,
"managed texture"
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
FALSE
,
"managed texture"
},
};
if
(
!
(
ddraw
=
create_ddraw
()))
{
...
...
@@ -5210,41 +5224,55 @@ static void test_set_surface_desc(void)
IDirectDrawSurface4_Release
(
surface
);
/*
Need
systemmemory surfaces.
/*
SetSurfaceDesc needs
systemmemory surfaces.
*
* As a sidenote, fourcc surfaces aren't allowed in sysmem, thus testing DDSD_LINEARSIZE is moot. */
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_VIDEOMEMORY
;
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
for
(
i
=
0
;
i
<
sizeof
(
invalid_caps_tests
)
/
sizeof
(
*
invalid_caps_tests
);
i
++
)
{
skip
(
"Cannot create a video memory surface, skipping vidmem SetSurfaceDesc test.
\n
"
);
goto
done
;
}
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
invalid_caps_tests
[
i
].
caps
;
ddsd
.
ddsCaps
.
dwCaps2
=
invalid_caps_tests
[
i
].
caps2
;
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface4_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
hr
=
IDirectDraw4_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Cannot create a %s surface, skipping vidmem SetSurfaceDesc test.
\n
"
,
invalid_caps_tests
[
i
].
name
);
goto
done
;
}
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface4_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface4_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
if
(
invalid_caps_tests
[
i
].
supported
)
{
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
}
else
{
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface4_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
}
IDirectDrawSurface4_Release
(
surface
);
IDirectDrawSurface4_Release
(
surface
);
}
done:
ref
=
IDirectDraw4_Release
(
ddraw
);
...
...
dlls/ddraw/tests/ddraw7.c
View file @
1f366058
...
...
@@ -4904,6 +4904,20 @@ static void test_set_surface_desc(void)
IDirectDrawSurface7
*
surface
;
BYTE
data
[
16
*
16
*
4
];
ULONG
ref
;
unsigned
int
i
;
static
const
struct
{
DWORD
caps
,
caps2
;
BOOL
supported
;
const
char
*
name
;
}
invalid_caps_tests
[]
=
{
{
DDSCAPS_VIDEOMEMORY
,
0
,
FALSE
,
"videomemory plain"
},
{
DDSCAPS_TEXTURE
|
DDSCAPS_SYSTEMMEMORY
,
0
,
TRUE
,
"systemmemory texture"
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_D3DTEXTUREMANAGE
,
FALSE
,
"managed texture"
},
{
DDSCAPS_TEXTURE
,
DDSCAPS2_TEXTUREMANAGE
,
FALSE
,
"managed texture"
},
};
if
(
!
(
ddraw
=
create_ddraw
()))
{
...
...
@@ -5097,41 +5111,55 @@ static void test_set_surface_desc(void)
IDirectDrawSurface7_Release
(
surface
);
/*
Need
systemmemory surfaces.
/*
SetSurfaceDesc needs
systemmemory surfaces.
*
* As a sidenote, fourcc surfaces aren't allowed in sysmem, thus testing DDSD_LINEARSIZE is moot. */
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_VIDEOMEMORY
;
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Cannot create a video memory surface, skipping vidmem SetSurfaceDesc test.
\n
"
);
goto
done
;
}
for
(
i
=
0
;
i
<
sizeof
(
invalid_caps_tests
)
/
sizeof
(
*
invalid_caps_tests
);
i
++
)
{
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_WIDTH
|
DDSD_HEIGHT
|
DDSD_CAPS
|
DDSD_PIXELFORMAT
;
ddsd
.
dwWidth
=
8
;
ddsd
.
dwHeight
=
8
;
ddsd
.
ddpfPixelFormat
.
dwSize
=
sizeof
(
ddsd
.
ddpfPixelFormat
);
ddsd
.
ddpfPixelFormat
.
dwFlags
=
DDPF_RGB
;
U1
(
ddsd
.
ddpfPixelFormat
).
dwRGBBitCount
=
32
;
U2
(
ddsd
.
ddpfPixelFormat
).
dwRBitMask
=
0x00ff0000
;
U3
(
ddsd
.
ddpfPixelFormat
).
dwGBitMask
=
0x0000ff00
;
U4
(
ddsd
.
ddpfPixelFormat
).
dwBBitMask
=
0x000000ff
;
ddsd
.
ddsCaps
.
dwCaps
=
invalid_caps_tests
[
i
].
caps
;
ddsd
.
ddsCaps
.
dwCaps2
=
invalid_caps_tests
[
i
].
caps2
;
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface7_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
hr
=
IDirectDraw7_CreateSurface
(
ddraw
,
&
ddsd
,
&
surface
,
NULL
);
ok
(
SUCCEEDED
(
hr
)
||
hr
==
DDERR_NODIRECTDRAWHW
,
"Failed to create surface, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Cannot create a %s surface, skipping vidmem SetSurfaceDesc test.
\n
"
,
invalid_caps_tests
[
i
].
name
);
goto
done
;
}
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface7_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a vidmem surface returned %#x.
\n
"
,
hr
);
reset_ddsd
(
&
ddsd
);
ddsd
.
dwFlags
=
DDSD_LPSURFACE
;
ddsd
.
lpSurface
=
data
;
hr
=
IDirectDrawSurface7_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
if
(
invalid_caps_tests
[
i
].
supported
)
{
ok
(
SUCCEEDED
(
hr
),
"Failed to set surface desc, hr %#x.
\n
"
,
hr
);
}
else
{
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
/* Check priority of error conditions. */
ddsd
.
dwFlags
=
DDSD_WIDTH
;
hr
=
IDirectDrawSurface7_SetSurfaceDesc
(
surface
,
&
ddsd
,
0
);
ok
(
hr
==
DDERR_INVALIDSURFACETYPE
,
"SetSurfaceDesc on a %s surface returned %#x.
\n
"
,
invalid_caps_tests
[
i
].
name
,
hr
);
}
IDirectDrawSurface7_Release
(
surface
);
IDirectDrawSurface7_Release
(
surface
);
}
done:
ref
=
IDirectDraw7_Release
(
ddraw
);
...
...
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