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
79a20453
Commit
79a20453
authored
Dec 18, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: NULL vertex declarations are captured, but not applied.
parent
8e1bd0c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
4 deletions
+172
-4
stateblock.c
dlls/d3d9/tests/stateblock.c
+170
-0
stateblock.c
dlls/wined3d/stateblock.c
+2
-4
No files found.
dlls/d3d9/tests/stateblock.c
View file @
79a20453
...
...
@@ -2271,6 +2271,175 @@ static void test_shader_constant_apply(IDirect3DDevice9 *device)
IDirect3DStateBlock9_Release
(
stateblock
);
}
static
void
test_vdecl_apply
(
IDirect3DDevice9
*
device
)
{
static
const
D3DVERTEXELEMENT9
decl1
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_D3DCOLOR
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_COLOR
,
0
},
D3DDECL_END
(),
};
static
const
D3DVERTEXELEMENT9
decl2
[]
=
{
{
0
,
0
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_POSITION
,
0
},
{
0
,
12
,
D3DDECLTYPE_D3DCOLOR
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_COLOR
,
0
},
{
0
,
16
,
D3DDECLTYPE_FLOAT3
,
D3DDECLMETHOD_DEFAULT
,
D3DDECLUSAGE_NORMAL
,
0
},
D3DDECL_END
(),
};
IDirect3DVertexDeclaration9
*
declaration
,
*
declaration1
,
*
declaration2
;
IDirect3DStateBlock9
*
stateblock
;
HRESULT
hr
;
hr
=
IDirect3DDevice9_CreateVertexDeclaration
(
device
,
decl1
,
&
declaration1
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateVertexDeclaration
(
device
,
decl2
,
&
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"CreateVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_BeginStateBlock
(
device
);
ok
(
SUCCEEDED
(
hr
),
"BeginStateBlock failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration1
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndStateBlock
(
device
,
&
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"EndStateBlock failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration1
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration1
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
NULL
,
"Expected vertex declaration %p, received %p.
\n
"
,
NULL
,
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
IDirect3DStateBlock9_Release
(
stateblock
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration1
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_CreateStateBlock
(
device
,
D3DSBT_VERTEXSTATE
,
&
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"CreateStateBlock failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration1
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration1
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
NULL
,
"Expected vertex declaration %p, received %p.
\n
"
,
NULL
,
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
declaration2
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Capture
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Capture failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DStateBlock9_Apply
(
stateblock
);
ok
(
SUCCEEDED
(
hr
),
"Apply failed, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexDeclaration
(
device
,
&
declaration
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
ok
(
declaration
==
declaration2
,
"Expected vertex declaration %p, received %p.
\n
"
,
declaration2
,
declaration
);
IDirect3DVertexDeclaration9_Release
(
declaration
);
hr
=
IDirect3DDevice9_SetVertexDeclaration
(
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"SetVertexDeclaration failed, hr %#x.
\n
"
,
hr
);
IDirect3DVertexDeclaration9_Release
(
declaration1
);
IDirect3DVertexDeclaration9_Release
(
declaration2
);
IDirect3DStateBlock9_Release
(
stateblock
);
}
START_TEST
(
stateblock
)
{
IDirect3DDevice9
*
device_ptr
=
NULL
;
...
...
@@ -2291,6 +2460,7 @@ START_TEST(stateblock)
test_begin_end_state_block
(
device_ptr
);
test_state_management
(
device_ptr
,
&
device_pparams
);
test_shader_constant_apply
(
device_ptr
);
test_vdecl_apply
(
device_ptr
);
refcount
=
IDirect3DDevice9_Release
(
device_ptr
);
ok
(
!
refcount
,
"Device has %u references left
\n
"
,
refcount
);
...
...
dlls/wined3d/stateblock.c
View file @
79a20453
...
...
@@ -718,9 +718,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This
->
IndexFmt
=
targetStateBlock
->
IndexFmt
;
}
if
(
This
->
changed
.
vertexDecl
&&
This
->
vertexDecl
!=
targetStateBlock
->
vertexDecl
&&
(
This
->
blockType
!=
WINED3DSBT_RECORDED
||
((
IWineD3DImpl
*
)
This
->
device
->
wined3d
)
->
dxVersion
!=
9
))
if
(
This
->
changed
.
vertexDecl
&&
This
->
vertexDecl
!=
targetStateBlock
->
vertexDecl
)
{
TRACE
(
"Updating vertex declaration from %p to %p.
\n
"
,
This
->
vertexDecl
,
targetStateBlock
->
vertexDecl
);
...
...
@@ -971,7 +969,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
IWineD3DDevice_SetBaseVertexIndex
(
pDevice
,
This
->
baseVertexIndex
);
}
if
(
This
->
changed
.
vertexDecl
)
if
(
This
->
changed
.
vertexDecl
&&
This
->
vertexDecl
)
{
IWineD3DDevice_SetVertexDeclaration
(
pDevice
,
This
->
vertexDecl
);
}
...
...
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