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
e6e0c227
Commit
e6e0c227
authored
Jan 05, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 05, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Set WINED3D_BUFFER_DOUBLEBUFFER for managed buffers as well.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6862fc1d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
1 deletion
+156
-1
device.c
dlls/d3d8/tests/device.c
+77
-0
device.c
dlls/d3d9/tests/device.c
+78
-0
buffer.c
dlls/wined3d/buffer.c
+1
-1
No files found.
dlls/d3d8/tests/device.c
View file @
e6e0c227
...
...
@@ -5577,6 +5577,82 @@ static void test_swvp_buffer(void)
DestroyWindow
(
window
);
}
static
void
test_managed_buffer
(
void
)
{
static
const
unsigned
int
vertex_count
=
1024
;
IDirect3DVertexBuffer8
*
buffer
;
D3DVERTEXBUFFER_DESC
desc
;
IDirect3DDevice8
*
device
;
struct
vec3
*
ptr
,
*
ptr2
;
IDirect3D8
*
d3d8
;
unsigned
int
i
;
UINT
refcount
;
HWND
window
;
HRESULT
hr
;
window
=
CreateWindowA
(
"static"
,
"d3d8_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
d3d8
=
Direct3DCreate8
(
D3D_SDK_VERSION
);
ok
(
!!
d3d8
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d8
,
window
,
NULL
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D8_Release
(
d3d8
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice8_CreateVertexBuffer
(
device
,
vertex_count
*
sizeof
(
*
ptr
),
0
,
0
,
D3DPOOL_MANAGED
,
&
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_GetDesc
(
buffer
,
&
desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get desc, hr %#x.
\n
"
,
hr
);
ok
(
desc
.
Pool
==
D3DPOOL_MANAGED
,
"Got unexpected pool %#x.
\n
"
,
desc
.
Pool
);
ok
(
!
desc
.
Usage
,
"Got unexpected usage %#x.
\n
"
,
desc
.
Usage
);
hr
=
IDirect3DVertexBuffer8_Lock
(
buffer
,
0
,
vertex_count
*
sizeof
(
*
ptr
),
(
BYTE
**
)
&
ptr
,
D3DLOCK_DISCARD
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock buffer, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
vertex_count
;
++
i
)
{
ptr
[
i
].
x
=
i
*
1
.
0
f
;
ptr
[
i
].
y
=
i
*
2
.
0
f
;
ptr
[
i
].
z
=
i
*
3
.
0
f
;
}
hr
=
IDirect3DVertexBuffer8_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set fvf, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetStreamSource
(
device
,
0
,
buffer
,
sizeof
(
*
ptr
));
ok
(
SUCCEEDED
(
hr
),
"Failed to set stream source, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitive
(
device
,
D3DPT_TRIANGLELIST
,
0
,
2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer8_Lock
(
buffer
,
0
,
vertex_count
*
sizeof
(
*
ptr2
),
(
BYTE
**
)
&
ptr2
,
D3DLOCK_DISCARD
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock buffer, hr %#x.
\n
"
,
hr
);
ok
(
ptr2
==
ptr
,
"Got unexpected ptr2 %p, expected %p.
\n
"
,
ptr2
,
ptr
);
for
(
i
=
0
;
i
<
vertex_count
;
++
i
)
{
if
(
ptr2
[
i
].
x
!=
i
*
1
.
0
f
||
ptr2
[
i
].
y
!=
i
*
2
.
0
f
||
ptr2
[
i
].
z
!=
i
*
3
.
0
f
)
{
ok
(
FALSE
,
"Got unexpected vertex %u {%.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e}.
\n
"
,
i
,
ptr2
[
i
].
x
,
ptr2
[
i
].
y
,
ptr2
[
i
].
z
,
i
*
1
.
0
f
,
i
*
2
.
0
f
,
i
*
3
.
0
f
);
break
;
}
}
hr
=
IDirect3DVertexBuffer8_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock buffer, hr %#x.
\n
"
,
hr
);
IDirect3DVertexBuffer8_Release
(
buffer
);
refcount
=
IDirect3DDevice8_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D8_Release
(
d3d8
);
DestroyWindow
(
window
);
}
static
void
test_npot_textures
(
void
)
{
IDirect3DDevice8
*
device
=
NULL
;
...
...
@@ -7530,6 +7606,7 @@ START_TEST(device)
test_surface_blocks
();
test_set_palette
();
test_swvp_buffer
();
test_managed_buffer
();
test_npot_textures
();
test_volume_locking
();
test_update_volumetexture
();
...
...
dlls/d3d9/tests/device.c
View file @
e6e0c227
...
...
@@ -8102,6 +8102,83 @@ static void test_swvp_buffer(void)
DestroyWindow
(
window
);
}
static
void
test_managed_buffer
(
void
)
{
static
const
unsigned
int
vertex_count
=
1024
;
IDirect3DVertexBuffer9
*
buffer
;
D3DVERTEXBUFFER_DESC
desc
;
IDirect3DDevice9
*
device
;
struct
vec3
*
ptr
,
*
ptr2
;
IDirect3D9
*
d3d9
;
unsigned
int
i
;
UINT
refcount
;
HWND
window
;
HRESULT
hr
;
window
=
CreateWindowA
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
640
,
480
,
0
,
0
,
0
,
0
);
d3d9
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
ok
(
!!
d3d9
,
"Failed to create a D3D object.
\n
"
);
if
(
!
(
device
=
create_device
(
d3d9
,
window
,
NULL
)))
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
return
;
}
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
vertex_count
*
sizeof
(
*
ptr
),
0
,
0
,
D3DPOOL_MANAGED
,
&
buffer
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_GetDesc
(
buffer
,
&
desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get desc, hr %#x.
\n
"
,
hr
);
ok
(
desc
.
Pool
==
D3DPOOL_MANAGED
,
"Got unexpected pool %#x.
\n
"
,
desc
.
Pool
);
ok
(
!
desc
.
Usage
,
"Got unexpected usage %#x.
\n
"
,
desc
.
Usage
);
hr
=
IDirect3DVertexBuffer9_Lock
(
buffer
,
0
,
vertex_count
*
sizeof
(
*
ptr
),
(
void
**
)
&
ptr
,
D3DLOCK_DISCARD
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock buffer, hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
vertex_count
;
++
i
)
{
ptr
[
i
].
x
=
i
*
1
.
0
f
;
ptr
[
i
].
y
=
i
*
2
.
0
f
;
ptr
[
i
].
z
=
i
*
3
.
0
f
;
}
hr
=
IDirect3DVertexBuffer9_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock buffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set fvf, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
buffer
,
0
,
sizeof
(
*
ptr
));
ok
(
SUCCEEDED
(
hr
),
"Failed to set stream source, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to begin scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawPrimitive
(
device
,
D3DPT_TRIANGLELIST
,
0
,
2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to draw, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
SUCCEEDED
(
hr
),
"Failed to end scene, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DVertexBuffer9_Lock
(
buffer
,
0
,
vertex_count
*
sizeof
(
*
ptr2
),
(
void
**
)
&
ptr2
,
D3DLOCK_DISCARD
);
ok
(
SUCCEEDED
(
hr
),
"Failed to lock buffer, hr %#x.
\n
"
,
hr
);
ok
(
ptr2
==
ptr
,
"Got unexpected ptr2 %p, expected %p.
\n
"
,
ptr2
,
ptr
);
for
(
i
=
0
;
i
<
vertex_count
;
++
i
)
{
if
(
ptr2
[
i
].
x
!=
i
*
1
.
0
f
||
ptr2
[
i
].
y
!=
i
*
2
.
0
f
||
ptr2
[
i
].
z
!=
i
*
3
.
0
f
)
{
ok
(
FALSE
,
"Got unexpected vertex %u {%.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e}.
\n
"
,
i
,
ptr2
[
i
].
x
,
ptr2
[
i
].
y
,
ptr2
[
i
].
z
,
i
*
1
.
0
f
,
i
*
2
.
0
f
,
i
*
3
.
0
f
);
break
;
}
}
hr
=
IDirect3DVertexBuffer9_Unlock
(
buffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to unlock buffer, hr %#x.
\n
"
,
hr
);
IDirect3DVertexBuffer9_Release
(
buffer
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
IDirect3D9_Release
(
d3d9
);
DestroyWindow
(
window
);
}
static
void
test_npot_textures
(
void
)
{
IDirect3DDevice9
*
device
=
NULL
;
...
...
@@ -10446,6 +10523,7 @@ START_TEST(device)
test_surface_blocks
();
test_set_palette
();
test_swvp_buffer
();
test_managed_buffer
();
test_npot_textures
();
test_vidmem_accounting
();
test_volume_locking
();
...
...
dlls/wined3d/buffer.c
View file @
e6e0c227
...
...
@@ -1230,7 +1230,7 @@ static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device
TRACE
(
"size %#x, usage %#x, format %s, memory @ %p, iface @ %p.
\n
"
,
buffer
->
resource
.
size
,
buffer
->
resource
.
usage
,
debug_d3dformat
(
buffer
->
resource
.
format
->
id
),
buffer
->
resource
.
heap_memory
,
buffer
);
if
(
device
->
create_parms
.
flags
&
WINED3DCREATE_SOFTWARE_VERTEXPROCESSING
)
if
(
device
->
create_parms
.
flags
&
WINED3DCREATE_SOFTWARE_VERTEXPROCESSING
||
pool
==
WINED3D_POOL_MANAGED
)
{
/* SWvp always returns the same pointer in buffer maps and retains data in DISCARD maps.
* Keep a system memory copy of the buffer to provide the same behavior to the application.
...
...
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