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
fd823fc2
Commit
fd823fc2
authored
Apr 07, 2008
by
Chris Robinson
Committed by
Alexandre Julliard
Apr 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Check for NULL vertex declarations.
parent
d9a4299b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
device.c
dlls/d3d9/tests/device.c
+10
-2
device.c
dlls/wined3d/device.c
+20
-0
No files found.
dlls/d3d9/tests/device.c
View file @
fd823fc2
...
...
@@ -1505,7 +1505,7 @@ static void test_draw_indexed(void)
hr
=
IDirect3DDevice9_CreateVertexDeclaration
(
device
,
decl_elements
,
&
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexDeclaration failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
vertex_declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateVertexBuffer
(
device
,
sizeof
(
quad
),
0
,
0
,
D3DPOOL_DEFAULT
,
&
vertex_buffer
,
NULL
);
...
...
@@ -1538,11 +1538,19 @@ static void test_draw_indexed(void)
ok
(
hr
==
D3DERR_INVALIDCALL
,
"DrawIndexedPrimitive returned 0x%08x, expected D3DERR_INVALIDCALL (0x%08x)
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* Valid index buffer
. Should succeed
*/
/* Valid index buffer
, NULL vertex declaration. Should fail
*/
hr
=
IDirect3DDevice9_SetIndices
(
device
,
index_buffer
);
ok
(
SUCCEEDED
(
hr
),
"SetIndices failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitive
(
device
,
D3DPT_TRIANGLELIST
,
0
/* BaseVertexIndex */
,
0
/* MinIndex */
,
4
/* NumVerts */
,
0
/* StartIndex */
,
2
/*PrimCount */
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"DrawIndexedPrimitive returned 0x%08x, expected D3DERR_INVALIDCALL (0x%08x)
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* Valid index buffer and vertex declaration. Should succeed */
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
vertex_declaration
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_DrawIndexedPrimitive
(
device
,
D3DPT_TRIANGLELIST
,
0
/* BaseVertexIndex */
,
0
/* MinIndex */
,
4
/* NumVerts */
,
0
/* StartIndex */
,
2
/*PrimCount */
);
ok
(
SUCCEEDED
(
hr
),
"DrawIndexedPrimitive failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
...
...
dlls/wined3d/device.c
View file @
fd823fc2
...
...
@@ -5165,6 +5165,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, WI
debug_d3dprimitivetype
(
PrimitiveType
),
StartVertex
,
PrimitiveCount
);
if
(
!
This
->
stateBlock
->
vertexDecl
)
{
WARN
(
"(%p) : Called without a valid vertex declaration set
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
/* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */
if
(
This
->
stateBlock
->
streamIsUP
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
...
...
@@ -5202,6 +5207,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
This
->
stateBlock
->
vertexDecl
)
{
WARN
(
"(%p) : Called without a valid vertex declaration set
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
This
->
stateBlock
->
streamIsUP
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_INDEXBUFFER
);
This
->
stateBlock
->
streamIsUP
=
FALSE
;
...
...
@@ -5240,6 +5250,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface,
debug_d3dprimitivetype
(
PrimitiveType
),
PrimitiveCount
,
pVertexStreamZeroData
,
VertexStreamZeroStride
);
if
(
!
This
->
stateBlock
->
vertexDecl
)
{
WARN
(
"(%p) : Called without a valid vertex declaration set
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
vb
=
This
->
stateBlock
->
streamSource
[
0
];
This
->
stateBlock
->
streamSource
[
0
]
=
(
IWineD3DVertexBuffer
*
)
pVertexStreamZeroData
;
...
...
@@ -5280,6 +5295,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *
MinVertexIndex
,
NumVertices
,
PrimitiveCount
,
pIndexData
,
IndexDataFormat
,
pVertexStreamZeroData
,
VertexStreamZeroStride
);
if
(
!
This
->
stateBlock
->
vertexDecl
)
{
WARN
(
"(%p) : Called without a valid vertex declaration set
\n
"
,
This
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
IndexDataFormat
==
WINED3DFMT_INDEX16
)
{
idxStride
=
2
;
}
else
{
...
...
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