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
5d386622
Commit
5d386622
authored
Jan 02, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10core: Only create unique rasterizer state objects.
parent
4f9814c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
7 deletions
+59
-7
d3d10core_private.h
dlls/d3d10core/d3d10core_private.h
+4
-1
device.c
dlls/d3d10core/device.c
+41
-1
state.c
dlls/d3d10core/state.c
+14
-5
No files found.
dlls/d3d10core/d3d10core_private.h
View file @
5d386622
...
@@ -248,10 +248,12 @@ struct d3d10_rasterizer_state
...
@@ -248,10 +248,12 @@ struct d3d10_rasterizer_state
ID3D10RasterizerState
ID3D10RasterizerState_iface
;
ID3D10RasterizerState
ID3D10RasterizerState_iface
;
LONG
refcount
;
LONG
refcount
;
struct
d3d10_device
*
device
;
D3D10_RASTERIZER_DESC
desc
;
D3D10_RASTERIZER_DESC
desc
;
struct
wine_rb_entry
entry
;
};
};
HRESULT
d3d10_rasterizer_state_init
(
struct
d3d10_rasterizer_state
*
state
,
HRESULT
d3d10_rasterizer_state_init
(
struct
d3d10_rasterizer_state
*
state
,
struct
d3d10_device
*
device
,
const
D3D10_RASTERIZER_DESC
*
desc
)
DECLSPEC_HIDDEN
;
const
D3D10_RASTERIZER_DESC
*
desc
)
DECLSPEC_HIDDEN
;
struct
d3d10_rasterizer_state
*
unsafe_impl_from_ID3D10RasterizerState
(
ID3D10RasterizerState
*
iface
)
DECLSPEC_HIDDEN
;
struct
d3d10_rasterizer_state
*
unsafe_impl_from_ID3D10RasterizerState
(
ID3D10RasterizerState
*
iface
)
DECLSPEC_HIDDEN
;
...
@@ -294,6 +296,7 @@ struct d3d10_device
...
@@ -294,6 +296,7 @@ struct d3d10_device
struct
wine_rb_tree
blend_states
;
struct
wine_rb_tree
blend_states
;
struct
wine_rb_tree
depthstencil_states
;
struct
wine_rb_tree
depthstencil_states
;
struct
wine_rb_tree
rasterizer_states
;
struct
wine_rb_tree
sampler_states
;
struct
wine_rb_tree
sampler_states
;
struct
d3d10_blend_state
*
blend_state
;
struct
d3d10_blend_state
*
blend_state
;
...
...
dlls/d3d10core/device.c
View file @
5d386622
...
@@ -82,6 +82,7 @@ static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
...
@@ -82,6 +82,7 @@ static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
if
(
device
->
wined3d_device
)
if
(
device
->
wined3d_device
)
wined3d_device_decref
(
device
->
wined3d_device
);
wined3d_device_decref
(
device
->
wined3d_device
);
wine_rb_destroy
(
&
device
->
sampler_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
sampler_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
rasterizer_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
depthstencil_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
depthstencil_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
blend_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
blend_states
,
NULL
,
NULL
);
}
}
...
@@ -1475,7 +1476,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Devi
...
@@ -1475,7 +1476,9 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateDepthStencilState(ID3D10Devi
static
HRESULT
STDMETHODCALLTYPE
d3d10_device_CreateRasterizerState
(
ID3D10Device
*
iface
,
static
HRESULT
STDMETHODCALLTYPE
d3d10_device_CreateRasterizerState
(
ID3D10Device
*
iface
,
const
D3D10_RASTERIZER_DESC
*
desc
,
ID3D10RasterizerState
**
rasterizer_state
)
const
D3D10_RASTERIZER_DESC
*
desc
,
ID3D10RasterizerState
**
rasterizer_state
)
{
{
struct
d3d10_device
*
device
=
impl_from_ID3D10Device
(
iface
);
struct
d3d10_rasterizer_state
*
object
;
struct
d3d10_rasterizer_state
*
object
;
struct
wine_rb_entry
*
entry
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"iface %p, desc %p, rasterizer_state %p.
\n
"
,
iface
,
desc
,
rasterizer_state
);
TRACE
(
"iface %p, desc %p, rasterizer_state %p.
\n
"
,
iface
,
desc
,
rasterizer_state
);
...
@@ -1483,6 +1486,18 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device
...
@@ -1483,6 +1486,18 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device
if
(
!
desc
)
if
(
!
desc
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
((
entry
=
wine_rb_get
(
&
device
->
rasterizer_states
,
desc
)))
{
object
=
WINE_RB_ENTRY_VALUE
(
entry
,
struct
d3d10_rasterizer_state
,
entry
);
TRACE
(
"Returning existing rasterizer state %p.
\n
"
,
object
);
*
rasterizer_state
=
&
object
->
ID3D10RasterizerState_iface
;
ID3D10RasterizerState_AddRef
(
*
rasterizer_state
);
return
S_OK
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
if
(
!
object
)
{
{
...
@@ -1490,7 +1505,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device
...
@@ -1490,7 +1505,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateRasterizerState(ID3D10Device
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
if
(
FAILED
(
hr
=
d3d10_rasterizer_state_init
(
object
,
desc
)))
if
(
FAILED
(
hr
=
d3d10_rasterizer_state_init
(
object
,
de
vice
,
de
sc
)))
{
{
WARN
(
"Failed to initialize rasterizer state, hr %#x.
\n
"
,
hr
);
WARN
(
"Failed to initialize rasterizer state, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
...
@@ -2020,6 +2035,22 @@ static const struct wine_rb_functions d3d10_depthstencil_state_rb_ops =
...
@@ -2020,6 +2035,22 @@ static const struct wine_rb_functions d3d10_depthstencil_state_rb_ops =
d3d10_depthstencil_state_compare
,
d3d10_depthstencil_state_compare
,
};
};
static
int
d3d10_rasterizer_state_compare
(
const
void
*
key
,
const
struct
wine_rb_entry
*
entry
)
{
const
D3D10_RASTERIZER_DESC
*
ka
=
key
;
const
D3D10_RASTERIZER_DESC
*
kb
=
&
WINE_RB_ENTRY_VALUE
(
entry
,
const
struct
d3d10_rasterizer_state
,
entry
)
->
desc
;
return
memcmp
(
ka
,
kb
,
sizeof
(
*
ka
));
}
static
const
struct
wine_rb_functions
d3d10_rasterizer_state_rb_ops
=
{
d3d10_rb_alloc
,
d3d10_rb_realloc
,
d3d10_rb_free
,
d3d10_rasterizer_state_compare
,
};
HRESULT
d3d10_device_init
(
struct
d3d10_device
*
device
,
void
*
outer_unknown
)
HRESULT
d3d10_device_init
(
struct
d3d10_device
*
device
,
void
*
outer_unknown
)
{
{
device
->
ID3D10Device_iface
.
lpVtbl
=
&
d3d10_device_vtbl
;
device
->
ID3D10Device_iface
.
lpVtbl
=
&
d3d10_device_vtbl
;
...
@@ -2043,9 +2074,18 @@ HRESULT d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
...
@@ -2043,9 +2074,18 @@ HRESULT d3d10_device_init(struct d3d10_device *device, void *outer_unknown)
return
E_FAIL
;
return
E_FAIL
;
}
}
if
(
wine_rb_init
(
&
device
->
rasterizer_states
,
&
d3d10_rasterizer_state_rb_ops
)
==
-
1
)
{
WARN
(
"Failed to initialize rasterizer state rbtree.
\n
"
);
wine_rb_destroy
(
&
device
->
depthstencil_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
blend_states
,
NULL
,
NULL
);
return
E_FAIL
;
}
if
(
wine_rb_init
(
&
device
->
sampler_states
,
&
d3d10_sampler_state_rb_ops
)
==
-
1
)
if
(
wine_rb_init
(
&
device
->
sampler_states
,
&
d3d10_sampler_state_rb_ops
)
==
-
1
)
{
{
WARN
(
"Failed to initialize sampler state rbtree.
\n
"
);
WARN
(
"Failed to initialize sampler state rbtree.
\n
"
);
wine_rb_destroy
(
&
device
->
rasterizer_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
depthstencil_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
depthstencil_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
blend_states
,
NULL
,
NULL
);
wine_rb_destroy
(
&
device
->
blend_states
,
NULL
,
NULL
);
return
E_FAIL
;
return
E_FAIL
;
...
...
dlls/d3d10core/state.c
View file @
5d386622
...
@@ -341,14 +341,15 @@ static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_AddRef(ID3D10RasterizerSta
...
@@ -341,14 +341,15 @@ static ULONG STDMETHODCALLTYPE d3d10_rasterizer_state_AddRef(ID3D10RasterizerSta
static
ULONG
STDMETHODCALLTYPE
d3d10_rasterizer_state_Release
(
ID3D10RasterizerState
*
iface
)
static
ULONG
STDMETHODCALLTYPE
d3d10_rasterizer_state_Release
(
ID3D10RasterizerState
*
iface
)
{
{
struct
d3d10_rasterizer_state
*
This
=
impl_from_ID3D10RasterizerState
(
iface
);
struct
d3d10_rasterizer_state
*
state
=
impl_from_ID3D10RasterizerState
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
This
->
refcount
);
ULONG
refcount
=
InterlockedDecrement
(
&
state
->
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
This
,
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
state
,
refcount
);
if
(
!
refcount
)
if
(
!
refcount
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
wine_rb_remove
(
&
state
->
device
->
rasterizer_states
,
&
state
->
desc
);
HeapFree
(
GetProcessHeap
(),
0
,
state
);
}
}
return
refcount
;
return
refcount
;
...
@@ -414,12 +415,20 @@ static const struct ID3D10RasterizerStateVtbl d3d10_rasterizer_state_vtbl =
...
@@ -414,12 +415,20 @@ static const struct ID3D10RasterizerStateVtbl d3d10_rasterizer_state_vtbl =
d3d10_rasterizer_state_GetDesc
,
d3d10_rasterizer_state_GetDesc
,
};
};
HRESULT
d3d10_rasterizer_state_init
(
struct
d3d10_rasterizer_state
*
state
,
const
D3D10_RASTERIZER_DESC
*
desc
)
HRESULT
d3d10_rasterizer_state_init
(
struct
d3d10_rasterizer_state
*
state
,
struct
d3d10_device
*
device
,
const
D3D10_RASTERIZER_DESC
*
desc
)
{
{
state
->
ID3D10RasterizerState_iface
.
lpVtbl
=
&
d3d10_rasterizer_state_vtbl
;
state
->
ID3D10RasterizerState_iface
.
lpVtbl
=
&
d3d10_rasterizer_state_vtbl
;
state
->
refcount
=
1
;
state
->
refcount
=
1
;
state
->
device
=
device
;
state
->
desc
=
*
desc
;
state
->
desc
=
*
desc
;
if
(
wine_rb_put
(
&
device
->
rasterizer_states
,
desc
,
&
state
->
entry
)
==
-
1
)
{
ERR
(
"Failed to insert rasterizer state entry.
\n
"
);
return
E_FAIL
;
}
return
S_OK
;
return
S_OK
;
}
}
...
...
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