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
e7163c80
Commit
e7163c80
authored
Jun 03, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw/tests: Test D3DVBCAPS_WRITEONLY.
parent
af733f04
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
0 deletions
+140
-0
ddraw4.c
dlls/ddraw/tests/ddraw4.c
+70
-0
ddraw7.c
dlls/ddraw/tests/ddraw7.c
+70
-0
No files found.
dlls/ddraw/tests/ddraw4.c
View file @
e7163c80
...
...
@@ -7438,6 +7438,75 @@ static void test_palette_alpha(void)
DestroyWindow
(
window
);
}
static
void
test_vb_writeonly
(
void
)
{
IDirect3DDevice3
*
device
;
IDirect3D3
*
d3d
;
IDirect3DVertexBuffer
*
buffer
;
HWND
window
;
HRESULT
hr
;
D3DVERTEXBUFFERDESC
desc
;
void
*
ptr
;
static
const
struct
vec4
quad
[]
=
{
{
0
.
0
f
,
480
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
640
.
0
f
,
480
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
640
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice3_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
memset
(
&
desc
,
0
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwCaps
=
D3DVBCAPS_WRITEONLY
;
desc
.
dwFVF
=
D3DFVF_XYZRHW
;
desc
.
dwNumVertices
=
sizeof
(
quad
)
/
sizeof
(
*
quad
);
hr
=
IDirect3D3_CreateVertexBuffer
(
d3d
,
&
desc
,
&
buffer
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer_Lock
(
buffer
,
DDLOCK_DISCARDCONTENTS
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
memcpy
(
ptr
,
quad
,
sizeof
(
quad
));
hr
=
IDirect3DVertexBuffer_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_DrawPrimitiveVB
(
device
,
D3DPT_TRIANGLESTRIP
,
buffer
,
0
,
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice3_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer_Lock
(
buffer
,
0
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
ok
(
!
memcmp
(
ptr
,
quad
,
sizeof
(
quad
)),
"Got unexpected vertex buffer data.
\n
"
);
hr
=
IDirect3DVertexBuffer_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer_Lock
(
buffer
,
DDLOCK_READONLY
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
ok
(
!
memcmp
(
ptr
,
quad
,
sizeof
(
quad
)),
"Got unexpected vertex buffer data.
\n
"
);
hr
=
IDirect3DVertexBuffer_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
IDirect3DVertexBuffer_Release
(
buffer
);
IDirect3D3_Release
(
d3d
);
IDirect3DDevice3_Release
(
device
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw4
)
{
IDirectDraw4
*
ddraw
;
...
...
@@ -7500,4 +7569,5 @@ START_TEST(ddraw4)
test_material
();
test_palette_gdi
();
test_palette_alpha
();
test_vb_writeonly
();
}
dlls/ddraw/tests/ddraw7.c
View file @
e7163c80
...
...
@@ -7160,6 +7160,75 @@ static void test_palette_alpha(void)
DestroyWindow
(
window
);
}
static
void
test_vb_writeonly
(
void
)
{
IDirect3DDevice7
*
device
;
IDirect3D7
*
d3d
;
IDirect3DVertexBuffer7
*
buffer
;
HWND
window
;
HRESULT
hr
;
D3DVERTEXBUFFERDESC
desc
;
void
*
ptr
;
static
const
struct
vec4
quad
[]
=
{
{
0
.
0
f
,
480
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
640
.
0
f
,
480
.
0
f
,
0
.
0
f
,
1
.
0
f
},
{
640
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
};
window
=
CreateWindowA
(
"static"
,
"ddraw_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
if
(
!
(
device
=
create_device
(
window
,
DDSCL_NORMAL
)))
{
skip
(
"Failed to create a 3D device, skipping test.
\n
"
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice7_GetDirect3D
(
device
,
&
d3d
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get d3d interface, hr %#x.
\n
"
,
hr
);
memset
(
&
desc
,
0
,
sizeof
(
desc
));
desc
.
dwSize
=
sizeof
(
desc
);
desc
.
dwCaps
=
D3DVBCAPS_WRITEONLY
;
desc
.
dwFVF
=
D3DFVF_XYZRHW
;
desc
.
dwNumVertices
=
sizeof
(
quad
)
/
sizeof
(
*
quad
);
hr
=
IDirect3D7_CreateVertexBuffer
(
d3d
,
&
desc
,
&
buffer
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer7_Lock
(
buffer
,
DDLOCK_DISCARDCONTENTS
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
memcpy
(
ptr
,
quad
,
sizeof
(
quad
));
hr
=
IDirect3DVertexBuffer7_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_DrawPrimitiveVB
(
device
,
D3DPT_TRIANGLESTRIP
,
buffer
,
0
,
4
,
0
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice7_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer7_Lock
(
buffer
,
0
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
ok
(
!
memcmp
(
ptr
,
quad
,
sizeof
(
quad
)),
"Got unexpected vertex buffer data.
\n
"
);
hr
=
IDirect3DVertexBuffer7_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer7_Lock
(
buffer
,
DDLOCK_READONLY
,
&
ptr
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
ok
(
!
memcmp
(
ptr
,
quad
,
sizeof
(
quad
)),
"Got unexpected vertex buffer data.
\n
"
);
hr
=
IDirect3DVertexBuffer7_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
IDirect3DVertexBuffer7_Release
(
buffer
);
IDirect3D7_Release
(
d3d
);
IDirect3DDevice7_Release
(
device
);
DestroyWindow
(
window
);
}
START_TEST
(
ddraw7
)
{
HMODULE
module
=
GetModuleHandleA
(
"ddraw.dll"
);
...
...
@@ -7229,4 +7298,5 @@ START_TEST(ddraw7)
test_material
();
test_palette_gdi
();
test_palette_alpha
();
test_vb_writeonly
();
}
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