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
acf890e2
Commit
acf890e2
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
d3d9/tests: Add a test for D3DUSAGE_WRITEONLY.
This test seeks to demonstrate that readbacks of WRITEONLY resources still work, even after a resource has been used for rendering.
parent
39092157
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
device.c
dlls/d3d9/tests/device.c
+80
-0
No files found.
dlls/d3d9/tests/device.c
View file @
acf890e2
...
...
@@ -26,6 +26,11 @@
#include <d3d9.h>
#include "wine/test.h"
struct
vec3
{
float
x
,
y
,
z
;
};
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
...
...
@@ -8741,6 +8746,80 @@ static void test_mipmap_lock(void)
DestroyWindow
(
window
);
}
static
void
test_writeonly_resource
(
void
)
{
IDirect3D9
*
d3d
;
IDirect3DDevice9
*
device
;
IDirect3DVertexBuffer9
*
buffer
;
ULONG
refcount
;
HWND
window
;
HRESULT
hr
;
void
*
ptr
;
static
const
struct
{
struct
vec3
pos
;
}
quad
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
}},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
}},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
}}
};
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d
,
window
,
window
,
TRUE
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
sizeof
(
quad
),
D3DUSAGE_DYNAMIC
|
D3DUSAGE_WRITEONLY
,
0
,
D3DPOOL_DEFAULT
,
&
buffer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_Lock
(
buffer
,
0
,
0
,
&
ptr
,
D3DLOCK_DISCARD
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock vertex buffer, hr %#x.
\n
"
,
hr
);
memcpy
(
ptr
,
quad
,
sizeof
(
quad
));
hr
=
IDirect3DVertexBuffer9_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
buffer
,
0
,
sizeof
(
*
quad
));
ok
(
SUCCEEDED
(
hr
),
"Failed to set stream source, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set FVF, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene %#x
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitive
(
device
,
D3DPT_TRIANGLESTRIP
,
0
,
2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene %#x
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_Lock
(
buffer
,
0
,
0
,
&
ptr
,
0
);
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
=
IDirect3DVertexBuffer9_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_Lock
(
buffer
,
0
,
0
,
&
ptr
,
D3DLOCK_READONLY
);
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
=
IDirect3DVertexBuffer9_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock vertex buffer, hr %#x.
\n
"
,
hr
);
refcount
=
IDirect3DVertexBuffer9_Release
(
buffer
);
ok
(
!
refcount
,
"Vertex buffer has %u references left.
\n
"
,
refcount
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
window
);
}
START_TEST
(
device
)
{
WNDCLASSA
wc
=
{
0
};
...
...
@@ -8838,6 +8917,7 @@ START_TEST(device)
test_vdecl_apply
();
test_resource_type
();
test_mipmap_lock
();
test_writeonly_resource
();
UnregisterClassA
(
"d3d9_test_wc"
,
GetModuleHandleA
(
NULL
));
}
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