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
e0ab89b8
Commit
e0ab89b8
authored
Aug 02, 2023
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Keep effect shader objects at device level.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
9e4ee3e4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
58 deletions
+59
-58
d2d1_private.h
dlls/d2d1/d2d1_private.h
+15
-10
device.c
dlls/d2d1/device.c
+36
-0
effect.c
dlls/d2d1/effect.c
+8
-46
d2d1.c
dlls/d2d1/tests/d2d1.c
+0
-2
No files found.
dlls/d2d1/d2d1_private.h
View file @
e0ab89b8
...
...
@@ -592,22 +592,31 @@ HRESULT d2d_geometry_group_init(struct d2d_geometry *geometry, ID2D1Factory *fac
D2D1_FILL_MODE
fill_mode
,
ID2D1Geometry
**
src_geometries
,
unsigned
int
geometry_count
);
struct
d2d_geometry
*
unsafe_impl_from_ID2D1Geometry
(
ID2D1Geometry
*
iface
);
struct
d2d_shader
{
GUID
id
;
IUnknown
*
shader
;
};
struct
d2d_device
{
ID2D1Device1
ID2D1Device1_iface
;
LONG
refcount
;
ID2D1Factory1
*
factory
;
IDXGIDevice
*
dxgi_device
;
struct
{
struct
d2d_shader
*
objects
;
size_t
size
;
size_t
count
;
}
shaders
;
};
void
d2d_device_init
(
struct
d2d_device
*
device
,
ID2D1Factory1
*
factory
,
IDXGIDevice
*
dxgi_device
);
struct
d2d_device
*
unsafe_impl_from_ID2D1Device
(
ID2D1Device1
*
iface
);
struct
d2d_shader
{
GUID
id
;
IUnknown
*
shader
;
};
HRESULT
d2d_device_add_shader
(
struct
d2d_device
*
device
,
REFGUID
shader_id
,
IUnknown
*
shader
);
BOOL
d2d_device_is_shader_loaded
(
struct
d2d_device
*
device
,
REFGUID
shader_id
);
struct
d2d_effect_context
{
...
...
@@ -615,10 +624,6 @@ struct d2d_effect_context
LONG
refcount
;
struct
d2d_device_context
*
device_context
;
struct
d2d_shader
*
shaders
;
size_t
shaders_size
;
size_t
shader_count
;
};
void
d2d_effect_context_init
(
struct
d2d_effect_context
*
effect_context
,
...
...
dlls/d2d1/device.c
View file @
e0ab89b8
...
...
@@ -4528,6 +4528,7 @@ static ULONG WINAPI d2d_device_Release(ID2D1Device1 *iface)
{
struct
d2d_device
*
device
=
impl_from_ID2D1Device
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
device
->
refcount
);
size_t
i
;
TRACE
(
"%p decreasing refcount to %lu.
\n
"
,
iface
,
refcount
);
...
...
@@ -4535,6 +4536,9 @@ static ULONG WINAPI d2d_device_Release(ID2D1Device1 *iface)
{
IDXGIDevice_Release
(
device
->
dxgi_device
);
ID2D1Factory1_Release
(
device
->
factory
);
for
(
i
=
0
;
i
<
device
->
shaders
.
count
;
++
i
)
IUnknown_Release
(
device
->
shaders
.
objects
[
i
].
shader
);
free
(
device
->
shaders
.
objects
);
free
(
device
);
}
...
...
@@ -4670,3 +4674,35 @@ void d2d_device_init(struct d2d_device *device, ID2D1Factory1 *iface, IDXGIDevic
device
->
dxgi_device
=
dxgi_device
;
IDXGIDevice_AddRef
(
device
->
dxgi_device
);
}
HRESULT
d2d_device_add_shader
(
struct
d2d_device
*
device
,
REFGUID
shader_id
,
IUnknown
*
shader
)
{
struct
d2d_shader
*
entry
;
if
(
!
d2d_array_reserve
((
void
**
)
&
device
->
shaders
.
objects
,
&
device
->
shaders
.
size
,
device
->
shaders
.
count
+
1
,
sizeof
(
*
device
->
shaders
.
objects
)))
{
WARN
(
"Failed to resize shaders array.
\n
"
);
return
E_OUTOFMEMORY
;
}
entry
=
&
device
->
shaders
.
objects
[
device
->
shaders
.
count
++
];
entry
->
id
=
*
shader_id
;
entry
->
shader
=
shader
;
IUnknown_AddRef
(
entry
->
shader
);
return
S_OK
;
}
BOOL
d2d_device_is_shader_loaded
(
struct
d2d_device
*
device
,
REFGUID
shader_id
)
{
size_t
i
;
for
(
i
=
0
;
i
<
device
->
shaders
.
count
;
++
i
)
{
if
(
IsEqualGUID
(
shader_id
,
&
device
->
shaders
.
objects
[
i
].
id
))
return
TRUE
;
}
return
FALSE
;
}
dlls/d2d1/effect.c
View file @
e0ab89b8
...
...
@@ -624,37 +624,6 @@ static inline struct d2d_effect_context *impl_from_ID2D1EffectContext(ID2D1Effec
return
CONTAINING_RECORD
(
iface
,
struct
d2d_effect_context
,
ID2D1EffectContext_iface
);
}
static
void
d2d_effect_context_cleanup
(
struct
d2d_effect_context
*
effect_context
)
{
size_t
i
;
for
(
i
=
0
;
i
<
effect_context
->
shader_count
;
++
i
)
IUnknown_Release
(
effect_context
->
shaders
[
i
].
shader
);
free
(
effect_context
->
shaders
);
ID2D1DeviceContext1_Release
(
&
effect_context
->
device_context
->
ID2D1DeviceContext1_iface
);
}
static
HRESULT
d2d_effect_context_add_shader
(
struct
d2d_effect_context
*
effect_context
,
REFGUID
shader_id
,
void
*
shader
)
{
struct
d2d_shader
*
entry
;
if
(
!
d2d_array_reserve
((
void
**
)
&
effect_context
->
shaders
,
&
effect_context
->
shaders_size
,
effect_context
->
shader_count
+
1
,
sizeof
(
*
effect_context
->
shaders
)))
{
WARN
(
"Failed to resize shaders array.
\n
"
);
return
E_OUTOFMEMORY
;
}
entry
=
&
effect_context
->
shaders
[
effect_context
->
shader_count
++
];
entry
->
id
=
*
shader_id
;
entry
->
shader
=
shader
;
IUnknown_AddRef
(
entry
->
shader
);
return
S_OK
;
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_context_QueryInterface
(
ID2D1EffectContext
*
iface
,
REFIID
iid
,
void
**
out
)
{
TRACE
(
"iface %p, iid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
...
...
@@ -692,7 +661,7 @@ static ULONG STDMETHODCALLTYPE d2d_effect_context_Release(ID2D1EffectContext *if
if
(
!
refcount
)
{
d2d_effect_context_cleanup
(
effect_context
);
ID2D1DeviceContext1_Release
(
&
effect_context
->
device_context
->
ID2D1DeviceContext1_iface
);
free
(
effect_context
);
}
...
...
@@ -787,7 +756,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadPixelShader(ID2D1EffectC
return
hr
;
}
hr
=
d2d_
effect_context_add_shader
(
effect_context
,
shader_id
,
shader
);
hr
=
d2d_
device_add_shader
(
effect_context
->
device_context
->
device
,
shader_id
,
(
IUnknown
*
)
shader
);
ID3D11PixelShader_Release
(
shader
);
return
hr
;
...
...
@@ -797,7 +766,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadVertexShader(ID2D1Effect
REFGUID
shader_id
,
const
BYTE
*
buffer
,
UINT32
buffer_size
)
{
struct
d2d_effect_context
*
effect_context
=
impl_from_ID2D1EffectContext
(
iface
);
ID3D11VertexShader
*
vertex_
shader
;
ID3D11VertexShader
*
shader
;
HRESULT
hr
;
TRACE
(
"iface %p, shader_id %s, buffer %p, buffer_size %u.
\n
"
,
...
...
@@ -807,14 +776,14 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadVertexShader(ID2D1Effect
return
S_OK
;
if
(
FAILED
(
hr
=
ID3D11Device1_CreateVertexShader
(
effect_context
->
device_context
->
d3d_device
,
buffer
,
buffer_size
,
NULL
,
&
vertex_
shader
)))
buffer
,
buffer_size
,
NULL
,
&
shader
)))
{
WARN
(
"Failed to create vertex shader, hr %#lx.
\n
"
,
hr
);
return
hr
;
}
hr
=
d2d_
effect_context_add_shader
(
effect_context
,
shader_id
,
vertex_
shader
);
ID3D11VertexShader_Release
(
vertex_
shader
);
hr
=
d2d_
device_add_shader
(
effect_context
->
device_context
->
device
,
shader_id
,
(
IUnknown
*
)
shader
);
ID3D11VertexShader_Release
(
shader
);
return
hr
;
}
...
...
@@ -839,7 +808,7 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadComputeShader(ID2D1Effec
return
hr
;
}
hr
=
d2d_
effect_context_add_shader
(
effect_context
,
shader_id
,
shader
);
hr
=
d2d_
device_add_shader
(
effect_context
->
device_context
->
device
,
shader_id
,
(
IUnknown
*
)
shader
);
ID3D11ComputeShader_Release
(
shader
);
return
hr
;
...
...
@@ -848,17 +817,10 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_context_LoadComputeShader(ID2D1Effec
static
BOOL
STDMETHODCALLTYPE
d2d_effect_context_IsShaderLoaded
(
ID2D1EffectContext
*
iface
,
REFGUID
shader_id
)
{
struct
d2d_effect_context
*
effect_context
=
impl_from_ID2D1EffectContext
(
iface
);
size_t
i
;
TRACE
(
"iface %p, shader_id %s.
\n
"
,
iface
,
debugstr_guid
(
shader_id
));
for
(
i
=
0
;
i
<
effect_context
->
shader_count
;
++
i
)
{
if
(
IsEqualGUID
(
shader_id
,
&
effect_context
->
shaders
[
i
].
id
))
return
TRUE
;
}
return
FALSE
;
return
d2d_device_is_shader_loaded
(
effect_context
->
device_context
->
device
,
shader_id
);
}
static
HRESULT
STDMETHODCALLTYPE
d2d_effect_context_CreateResourceTexture
(
ID2D1EffectContext
*
iface
,
...
...
dlls/d2d1/tests/d2d1.c
View file @
e0ab89b8
...
...
@@ -11483,7 +11483,6 @@ static void test_effect_context(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
loaded
=
ID2D1EffectContext_IsShaderLoaded
(
effect_context2
,
&
GUID_TestPixelShader
);
todo_wine
ok
(
loaded
,
"Unexpected shader loaded state.
\n
"
);
ID2D1Effect_Release
(
effect2
);
...
...
@@ -11524,7 +11523,6 @@ static void test_effect_context(BOOL d3d11)
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
loaded
=
ID2D1EffectContext_IsShaderLoaded
(
effect_context
,
&
GUID_TestPixelShader
);
todo_wine
ok
(
loaded
,
"Unexpected shader loaded state.
\n
"
);
ID2D1Effect_Release
(
effect
);
...
...
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