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
e27cf6ff
Commit
e27cf6ff
authored
Dec 20, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Per stream offsets are 4 byte aligned.
parent
8ff517ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
device.c
dlls/d3d9/tests/device.c
+81
-0
device.c
dlls/wined3d/device.c
+3
-0
No files found.
dlls/d3d9/tests/device.c
View file @
e27cf6ff
...
...
@@ -1655,6 +1655,86 @@ static void test_lights(void)
if
(
d3d9
)
IDirect3D9_Release
(
d3d9
);
}
static
void
test_set_stream_source
(
void
)
{
D3DPRESENT_PARAMETERS
present_parameters
;
IDirect3DDevice9
*
device
=
NULL
;
IDirect3D9
*
d3d9
;
HWND
hwnd
;
HRESULT
hr
;
IDirect3DVertexBuffer9
*
pVertexBuffer
;
d3d9
=
pDirect3DCreate9
(
D3D_SDK_VERSION
);
ok
(
d3d9
!=
NULL
,
"Failed to create IDirect3D9 object
\n
"
);
hwnd
=
CreateWindow
(
"static"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
100
,
100
,
160
,
160
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"Failed to create window
\n
"
);
if
(
!
d3d9
||
!
hwnd
)
goto
cleanup
;
ZeroMemory
(
&
present_parameters
,
sizeof
(
present_parameters
));
present_parameters
.
Windowed
=
TRUE
;
present_parameters
.
hDeviceWindow
=
hwnd
;
present_parameters
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
hr
=
IDirect3D9_CreateDevice
(
d3d9
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
hwnd
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"IDirect3D9_CreateDevice failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
device
)
{
hr
=
IDirect3D9_CreateDevice
(
d3d9
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_REF
,
hwnd
,
D3DCREATE_HARDWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"IDirect3D9_CreateDevice failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
device
)
{
skip
(
"Failed to create a d3d device
\n
"
);
goto
cleanup
;
}
}
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
512
,
0
,
0
,
D3DPOOL_DEFAULT
,
&
pVertexBuffer
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Failed to create a vertex buffer, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
pVertexBuffer
,
0
,
32
);
ok
(
hr
==
D3D_OK
,
"Failed to set the stream source, offset 0, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
pVertexBuffer
,
1
,
32
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 1, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
pVertexBuffer
,
2
,
32
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 2, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
pVertexBuffer
,
3
,
32
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 3, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
pVertexBuffer
,
4
,
32
);
ok
(
hr
==
D3D_OK
,
"Failed to set the stream source, offset 4, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
/* Try to set the NULL buffer with an offset and stride 0 */
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
0
,
0
);
ok
(
hr
==
D3D_OK
,
"Failed to set the stream source, offset 0, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
1
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 1, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
2
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 2, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
3
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Unexpected result when setting the stream source, offset 3, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
4
,
0
);
ok
(
hr
==
D3D_OK
,
"Failed to set the stream source, offset 4, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetStreamSource
(
device
,
0
,
NULL
,
0
,
0
);
ok
(
hr
==
D3D_OK
,
"Failed to set the stream source, offset 4, hr = %s
\n
"
,
DXGetErrorString9
(
hr
));
cleanup:
if
(
pVertexBuffer
)
IDirect3DDevice9_Release
(
pVertexBuffer
);
if
(
device
)
IDirect3DDevice9_Release
(
device
);
if
(
d3d9
)
IDirect3D9_Release
(
d3d9
);
}
START_TEST
(
device
)
{
HMODULE
d3d9_handle
=
LoadLibraryA
(
"d3d9.dll"
);
...
...
@@ -1681,5 +1761,6 @@ START_TEST(device)
test_null_stream
();
test_vertex_buffer_alignment
();
test_lights
();
test_set_stream_source
();
}
}
dlls/wined3d/device.c
View file @
e27cf6ff
...
...
@@ -2430,6 +2430,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
if
(
StreamNumber
>=
MAX_STREAMS
)
{
WARN
(
"Stream out of range %d
\n
"
,
StreamNumber
);
return
WINED3DERR_INVALIDCALL
;
}
else
if
(
OffsetInBytes
&
0x3
)
{
WARN
(
"OffsetInBytes is not 4 byte aligned: %d
\n
"
,
OffsetInBytes
);
return
WINED3DERR_INVALIDCALL
;
}
oldSrc
=
This
->
updateStateBlock
->
streamSource
[
StreamNumber
];
...
...
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