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
6f6ef6cd
Commit
6f6ef6cd
authored
Sep 11, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Mar 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use dynamic state for primitive type if possible.
parent
48d68e0c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
9 deletions
+78
-9
adapter_vk.c
dlls/wined3d/adapter_vk.c
+1
-0
context.c
dlls/wined3d/context.c
+2
-0
context_vk.c
dlls/wined3d/context_vk.c
+65
-6
cs.c
dlls/wined3d/cs.c
+2
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
wined3d_vk.h
dlls/wined3d/wined3d_vk.h
+6
-2
No files found.
dlls/wined3d/adapter_vk.c
View file @
6f6ef6cd
...
...
@@ -2349,6 +2349,7 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
d3d_info
->
multisample_draw_location
=
WINED3D_LOCATION_TEXTURE_RGB
;
vk_info
->
multiple_viewports
=
device_info
.
features2
.
features
.
multiViewport
;
vk_info
->
dynamic_state2
=
device_info
.
dynamic_state2_features
.
extendedDynamicState2
;
}
static
bool
wined3d_adapter_vk_init_device_extensions
(
struct
wined3d_adapter_vk
*
adapter_vk
)
...
...
dlls/wined3d/context.c
View file @
6f6ef6cd
...
...
@@ -113,6 +113,8 @@ void wined3d_context_init(struct wined3d_context *context, struct wined3d_swapch
|
(
1u
<<
WINED3D_SHADER_TYPE_HULL
)
|
(
1u
<<
WINED3D_SHADER_TYPE_DOMAIN
)
|
(
1u
<<
WINED3D_SHADER_TYPE_COMPUTE
);
context
->
update_primitive_type
=
1
;
}
HRESULT
wined3d_context_no3d_init
(
struct
wined3d_context
*
context_no3d
,
struct
wined3d_swapchain
*
swapchain
)
...
...
dlls/wined3d/context_vk.c
View file @
6f6ef6cd
...
...
@@ -216,6 +216,36 @@ static VkPrimitiveTopology vk_topology_from_wined3d(enum wined3d_primitive_type
}
}
static
VkPrimitiveTopology
vk_topology_class_from_wined3d
(
enum
wined3d_primitive_type
t
)
{
switch
(
t
)
{
case
WINED3D_PT_POINTLIST
:
return
VK_PRIMITIVE_TOPOLOGY_POINT_LIST
;
case
WINED3D_PT_LINELIST
:
case
WINED3D_PT_LINELIST_ADJ
:
case
WINED3D_PT_LINESTRIP
:
case
WINED3D_PT_LINESTRIP_ADJ
:
return
VK_PRIMITIVE_TOPOLOGY_LINE_LIST
;
case
WINED3D_PT_TRIANGLEFAN
:
case
WINED3D_PT_TRIANGLELIST
:
case
WINED3D_PT_TRIANGLELIST_ADJ
:
case
WINED3D_PT_TRIANGLESTRIP
:
case
WINED3D_PT_TRIANGLESTRIP_ADJ
:
return
VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST
;
case
WINED3D_PT_PATCH
:
return
VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
;
default:
FIXME
(
"Unhandled primitive type %s.
\n
"
,
debug_d3dprimitivetype
(
t
));
case
WINED3D_PT_UNDEFINED
:
return
~
0u
;
}
}
static
VkStencilOp
vk_stencil_op_from_wined3d
(
enum
wined3d_stencil_op
op
)
{
switch
(
op
)
...
...
@@ -1875,6 +1905,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
context_vk
->
c
.
update_compute_shader_resource_bindings
=
1
;
context_vk
->
c
.
update_unordered_access_view_bindings
=
1
;
context_vk
->
c
.
update_compute_unordered_access_view_bindings
=
1
;
context_vk
->
c
.
update_primitive_type
=
1
;
context_invalidate_state
(
&
context_vk
->
c
,
STATE_STREAMSRC
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_INDEXBUFFER
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_BLEND_FACTOR
);
...
...
@@ -2105,6 +2136,12 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
;
}
if
(
vk_info
->
dynamic_state2
)
{
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT
;
if
(
!
(
context_vk
->
c
.
d3d_info
->
wined3d_creation_flags
&
WINED3D_NO_PRIMITIVE_RESTART
))
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT
;
}
key
=
&
context_vk
->
graphics
.
pipeline_key_vk
;
memset
(
key
,
0
,
sizeof
(
*
key
));
...
...
@@ -2449,14 +2486,26 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
update
=
true
;
}
vk_topology
=
vk_topology_from_wined3d
(
state
->
primitive_type
);
if
(
key
->
ia_desc
.
topology
!=
vk_topology
)
if
(
vk_info
->
dynamic_state2
)
{
key
->
ia_desc
.
topology
=
vk_topology
;
key
->
ia_desc
.
primitiveRestartEnable
=
!
(
d3d_info
->
wined3d_creation_flags
&
WINED3D_NO_PRIMITIVE_RESTART
)
&&
!
wined3d_primitive_type_is_list
(
state
->
primitive_type
);
vk_topology
=
vk_topology_class_from_wined3d
(
state
->
primitive_type
);
if
(
key
->
ia_desc
.
topology
!=
vk_topology
)
{
key
->
ia_desc
.
topology
=
vk_topology
;
update
=
true
;
}
}
else
{
vk_topology
=
vk_topology_from_wined3d
(
state
->
primitive_type
);
if
(
key
->
ia_desc
.
topology
!=
vk_topology
)
{
key
->
ia_desc
.
topology
=
vk_topology
;
key
->
ia_desc
.
primitiveRestartEnable
=
!
(
d3d_info
->
wined3d_creation_flags
&
WINED3D_NO_PRIMITIVE_RESTART
)
&&
!
wined3d_primitive_type_is_list
(
state
->
primitive_type
);
update
=
true
;
update
=
true
;
}
}
if
(
key
->
ts_desc
.
patchControlPoints
!=
state
->
patch_vertex_count
)
...
...
@@ -3539,6 +3588,7 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
const
struct
wined3d_state
*
state
,
struct
wined3d_buffer_vk
*
indirect_vk
,
bool
indexed
)
{
struct
wined3d_device_vk
*
device_vk
=
wined3d_device_vk
(
context_vk
->
c
.
device
);
const
struct
wined3d_d3d_info
*
d3d_info
=
context_vk
->
c
.
d3d_info
;
const
struct
wined3d_vk_info
*
vk_info
=
context_vk
->
vk_info
;
const
struct
wined3d_blend_state
*
b
=
state
->
blend_state
;
bool
dual_source_blend
=
b
&&
b
->
dual_source
;
...
...
@@ -3809,6 +3859,15 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
VK_CALL
(
vkCmdSetScissor
(
vk_command_buffer
,
0
,
viewport_count
,
scissors
));
}
if
(
vk_info
->
dynamic_state2
&&
context_vk
->
c
.
update_primitive_type
)
{
VK_CALL
(
vkCmdSetPrimitiveTopologyEXT
(
vk_command_buffer
,
vk_topology_from_wined3d
(
state
->
primitive_type
)));
if
(
!
(
d3d_info
->
wined3d_creation_flags
&
WINED3D_NO_PRIMITIVE_RESTART
))
VK_CALL
(
vkCmdSetPrimitiveRestartEnableEXT
(
vk_command_buffer
,
!
wined3d_primitive_type_is_list
(
state
->
primitive_type
)));
context_vk
->
c
.
update_primitive_type
=
0
;
}
if
(
vk_info
->
supported
[
WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE
]
&&
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_DEPTH_STENCIL
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_FRAMEBUFFER
)))
...
...
dlls/wined3d/cs.c
View file @
6f6ef6cd
...
...
@@ -1044,6 +1044,8 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data)
if
(
state
->
primitive_type
==
WINED3D_PT_POINTLIST
||
op
->
primitive_type
==
WINED3D_PT_POINTLIST
)
device_invalidate_state
(
cs
->
c
.
device
,
STATE_POINT_ENABLE
);
state
->
primitive_type
=
op
->
primitive_type
;
for
(
i
=
0
;
i
<
device
->
context_count
;
++
i
)
device
->
contexts
[
i
]
->
update_primitive_type
=
1
;
}
state
->
patch_vertex_count
=
op
->
patch_vertex_count
;
...
...
dlls/wined3d/wined3d_private.h
View file @
6f6ef6cd
...
...
@@ -1967,7 +1967,8 @@ struct wined3d_context
DWORD
destroyed
:
1
;
DWORD
destroy_delayed
:
1
;
DWORD
namedArraysLoaded
:
1
;
DWORD
padding
:
5
;
DWORD
update_primitive_type
:
1
;
DWORD
padding
:
4
;
DWORD
clip_distance_mask
:
8
;
/* WINED3D_MAX_CLIP_DISTANCES, 8 */
...
...
dlls/wined3d/wined3d_vk.h
View file @
6f6ef6cd
...
...
@@ -183,8 +183,11 @@ struct wined3d_device_vk;
VK_DEVICE_EXT_PFN(vkCmdSetDepthCompareOpEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetDepthTestEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetDepthWriteEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetPrimitiveTopologyEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetStencilOpEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetStencilTestEnableEXT) \
/* VK_EXT_extended_dynamic_state2 */
\
VK_DEVICE_EXT_PFN(vkCmdSetPrimitiveRestartEnableEXT) \
/* VK_EXT_transform_feedback */
\
VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) \
VK_DEVICE_EXT_PFN(vkCmdBeginTransformFeedbackEXT) \
...
...
@@ -242,7 +245,8 @@ struct wined3d_vk_info
BOOL
supported
[
WINED3D_VK_EXT_COUNT
];
HMODULE
vulkan_lib
;
unsigned
int
multiple_viewports
:
1
;
bool
multiple_viewports
;
bool
dynamic_state2
;
};
#define VK_CALL(f) (vk_info->vk_ops.f)
...
...
@@ -565,7 +569,7 @@ struct wined3d_context_vk
const
struct
wined3d_vk_info
*
vk_info
;
VkDynamicState
dynamic_states
[
1
1
];
VkDynamicState
dynamic_states
[
1
3
];
uint32_t
update_compute_pipeline
:
1
;
uint32_t
update_stream_output
:
1
;
...
...
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