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
a40185f1
Commit
a40185f1
authored
Mar 23, 2008
by
Kolbjørn Fredheim
Committed by
Alexandre Julliard
Mar 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Don't clear the return value anymore, we fill the fields anyway, also a…
ddraw: Don't clear the return value anymore, we fill the fields anyway, also a test for the behaviour.
parent
3e30e298
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
6 deletions
+62
-6
d3d.c
dlls/ddraw/tests/d3d.c
+62
-0
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+0
-6
No files found.
dlls/ddraw/tests/d3d.c
View file @
a40185f1
...
...
@@ -1530,6 +1530,67 @@ static void TextureLoadTest(void)
if
(
Texture2
)
IDirect3DTexture_Release
(
Texture2
);
}
static
void
VertexBufferDescTest
(
void
)
{
HRESULT
rc
;
D3DVERTEXBUFFERDESC
desc
;
union
mem_t
{
D3DVERTEXBUFFERDESC
desc2
;
unsigned
char
buffer
[
512
];
}
mem
;
memset
(
&
desc
,
0
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwCaps
=
0
;
desc
.
dwFVF
=
D3DFVF_XYZ
;
desc
.
dwNumVertices
=
1
;
rc
=
IDirect3D7_CreateVertexBuffer
(
lpD3D
,
&
desc
,
&
lpVBufSrc
,
0
);
ok
(
rc
==
D3D_OK
||
rc
==
E_OUTOFMEMORY
,
"CreateVertexBuffer returned: %x
\n
"
,
rc
);
if
(
!
lpVBufSrc
)
{
trace
(
"IDirect3D7::CreateVertexBuffer() failed with an error %x
\n
"
,
rc
);
goto
out
;
}
memset
(
mem
.
buffer
,
0x12
,
sizeof
(
mem
.
buffer
));
mem
.
desc2
.
dwSize
=
sizeof
(
D3DVERTEXBUFFERDESC
)
*
2
;
rc
=
IDirect3DVertexBuffer7_GetVertexBufferDesc
(
lpVBufSrc
,
&
mem
.
desc2
);
if
(
rc
!=
D3D_OK
)
skip
(
"GetVertexBuffer Failed!
\n
"
);
ok
(
mem
.
desc2
.
dwSize
==
sizeof
(
D3DVERTEXBUFFERDESC
)
*
2
,
"Size returned from GetVertexBufferDesc does not match the value put in
\n
"
);
ok
(
mem
.
buffer
[
sizeof
(
D3DVERTEXBUFFERDESC
)]
==
0x12
,
"GetVertexBufferDesc cleared outside of the struct! (dwSize was double the size of the struct)
\n
"
);
ok
(
mem
.
desc2
.
dwCaps
==
desc
.
dwCaps
,
"dwCaps returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwCaps
,
desc
.
dwCaps
);
ok
(
mem
.
desc2
.
dwFVF
==
desc
.
dwFVF
,
"dwFVF returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwFVF
,
desc
.
dwFVF
);
ok
(
mem
.
desc2
.
dwNumVertices
==
desc
.
dwNumVertices
,
"dwNumVertices returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwNumVertices
,
desc
.
dwNumVertices
);
memset
(
mem
.
buffer
,
0x12
,
sizeof
(
mem
.
buffer
));
mem
.
desc2
.
dwSize
=
0
;
rc
=
IDirect3DVertexBuffer7_GetVertexBufferDesc
(
lpVBufSrc
,
&
mem
.
desc2
);
if
(
rc
!=
D3D_OK
)
skip
(
"GetVertexBuffer Failed!
\n
"
);
ok
(
mem
.
desc2
.
dwSize
==
0
,
"Size returned from GetVertexBufferDesc does not match the value put in
\n
"
);
ok
(
mem
.
buffer
[
sizeof
(
D3DVERTEXBUFFERDESC
)]
==
0x12
,
"GetVertexBufferDesc cleared outside of the struct! (dwSize was 0)
\n
"
);
ok
(
mem
.
desc2
.
dwCaps
==
desc
.
dwCaps
,
"dwCaps returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwCaps
,
desc
.
dwCaps
);
ok
(
mem
.
desc2
.
dwFVF
==
desc
.
dwFVF
,
"dwFVF returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwFVF
,
desc
.
dwFVF
);
ok
(
mem
.
desc2
.
dwNumVertices
==
desc
.
dwNumVertices
,
"dwNumVertices returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwNumVertices
,
desc
.
dwNumVertices
);
memset
(
mem
.
buffer
,
0x12
,
sizeof
(
mem
.
buffer
));
mem
.
desc2
.
dwSize
=
sizeof
(
D3DVERTEXBUFFERDESC
);
rc
=
IDirect3DVertexBuffer7_GetVertexBufferDesc
(
lpVBufSrc
,
&
mem
.
desc2
);
if
(
rc
!=
D3D_OK
)
skip
(
"GetVertexBuffer Failed!
\n
"
);
ok
(
mem
.
desc2
.
dwSize
==
sizeof
(
D3DVERTEXBUFFERDESC
),
"Size returned from GetVertexBufferDesc does not match the value put in
\n
"
);
ok
(
mem
.
buffer
[
sizeof
(
D3DVERTEXBUFFERDESC
)]
==
0x12
,
"GetVertexBufferDesc cleared outside of the struct! (dwSize was the size of the struct)
\n
"
);
ok
(
mem
.
desc2
.
dwCaps
==
desc
.
dwCaps
,
"dwCaps returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwCaps
,
desc
.
dwCaps
);
ok
(
mem
.
desc2
.
dwFVF
==
desc
.
dwFVF
,
"dwFVF returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwFVF
,
desc
.
dwFVF
);
ok
(
mem
.
desc2
.
dwNumVertices
==
desc
.
dwNumVertices
,
"dwNumVertices returned differs. Got %x, expected %x
\n
"
,
mem
.
desc2
.
dwNumVertices
,
desc
.
dwNumVertices
);
out:
IDirect3DVertexBuffer7_Release
(
lpVBufSrc
);
}
START_TEST
(
d3d
)
{
init_function_pointers
();
...
...
@@ -1548,6 +1609,7 @@ START_TEST(d3d)
LimitTest
();
D3D7EnumTest
();
CapsTest
();
VertexBufferDescTest
();
ReleaseDirect3D
();
}
...
...
dlls/ddraw/vertexbuffer.c
View file @
a40185f1
...
...
@@ -454,7 +454,6 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
ICOM_THIS_FROM
(
IDirect3DVertexBufferImpl
,
IDirect3DVertexBuffer7
,
iface
);
WINED3DVERTEXBUFFER_DESC
WDesc
;
HRESULT
hr
;
DWORD
size
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
Desc
);
if
(
!
Desc
)
return
DDERR_INVALIDPARAMS
;
...
...
@@ -469,12 +468,7 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface,
return
hr
;
}
/* Clear the return value of garbage */
size
=
Desc
->
dwSize
;
memset
(
Desc
,
0
,
size
);
/* Now fill the Desc structure */
Desc
->
dwSize
=
size
;
Desc
->
dwCaps
=
This
->
Caps
;
Desc
->
dwFVF
=
WDesc
.
FVF
;
Desc
->
dwNumVertices
=
WDesc
.
Size
/
get_flexible_vertex_size
(
WDesc
.
FVF
);
...
...
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