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
b85fff5a
Commit
b85fff5a
authored
Sep 14, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use dynamic state for rasterizer state if possible.
parent
97048c5f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
adapter_vk.c
dlls/wined3d/adapter_vk.c
+4
-0
context_vk.c
dlls/wined3d/context_vk.c
+37
-7
wined3d_vk.h
dlls/wined3d/wined3d_vk.h
+7
-1
No files found.
dlls/wined3d/adapter_vk.c
View file @
b85fff5a
...
@@ -2391,6 +2391,10 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
...
@@ -2391,6 +2391,10 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
vk_info
->
dynamic_blend_state
=
dynamic_state3
->
extendedDynamicState3ColorBlendEnable
vk_info
->
dynamic_blend_state
=
dynamic_state3
->
extendedDynamicState3ColorBlendEnable
&&
dynamic_state3
->
extendedDynamicState3ColorBlendEquation
&&
dynamic_state3
->
extendedDynamicState3ColorBlendEquation
&&
dynamic_state3
->
extendedDynamicState3ColorWriteMask
;
&&
dynamic_state3
->
extendedDynamicState3ColorWriteMask
;
/* Rasterizer state needs EDS2, for rasterizer discard, and EDS1, for cull mode and front face. */
vk_info
->
dynamic_rasterizer_state
=
dynamic_state3
->
extendedDynamicState3DepthClampEnable
&&
vk_info
->
dynamic_state2
&&
adapter_vk
->
vk_info
.
supported
[
WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE
];
}
}
static
bool
wined3d_adapter_vk_init_device_extensions
(
struct
wined3d_adapter_vk
*
adapter_vk
)
static
bool
wined3d_adapter_vk_init_device_extensions
(
struct
wined3d_adapter_vk
*
adapter_vk
)
...
...
dlls/wined3d/context_vk.c
View file @
b85fff5a
...
@@ -1913,6 +1913,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
...
@@ -1913,6 +1913,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
context_invalidate_state
(
&
context_vk
->
c
,
STATE_BLEND
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_BLEND
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_BLEND_FACTOR
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_BLEND_FACTOR
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_DEPTH_STENCIL
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_DEPTH_STENCIL
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_RASTERIZER
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_STENCIL_REF
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_STENCIL_REF
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_VIEWPORT
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_VIEWPORT
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_SCISSORRECT
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_SCISSORRECT
);
...
@@ -2159,6 +2160,15 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
...
@@ -2159,6 +2160,15 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT
;
}
}
if
(
vk_info
->
dynamic_rasterizer_state
)
{
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_CULL_MODE_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_FRONT_FACE_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT
;
dynamic_states
[
dynamic_state_count
++
]
=
VK_DYNAMIC_STATE_DEPTH_BIAS
;
}
key
=
&
context_vk
->
graphics
.
pipeline_key_vk
;
key
=
&
context_vk
->
graphics
.
pipeline_key_vk
;
memset
(
key
,
0
,
sizeof
(
*
key
));
memset
(
key
,
0
,
sizeof
(
*
key
));
...
@@ -2222,11 +2232,9 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
...
@@ -2222,11 +2232,9 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
key
->
pipeline_desc
.
basePipelineIndex
=
-
1
;
key
->
pipeline_desc
.
basePipelineIndex
=
-
1
;
}
}
static
void
wined3d_context_vk_update_rasterisation_state
(
const
struct
wined3d_context_vk
*
context_vk
,
static
void
rasterizer_state_from_wined3d
(
VkPipelineRasterizationStateCreateInfo
*
desc
,
const
struct
wined3d_state
*
state
,
struct
wined3d_graphics_pipeline_key_vk
*
key
)
const
struct
wined3d_state
*
state
,
const
struct
wined3d_d3d_info
*
d3d_info
)
{
{
const
struct
wined3d_d3d_info
*
d3d_info
=
context_vk
->
c
.
d3d_info
;
VkPipelineRasterizationStateCreateInfo
*
desc
=
&
key
->
rs_desc
;
const
struct
wined3d_rasterizer_state_desc
*
r
;
const
struct
wined3d_rasterizer_state_desc
*
r
;
float
scale_bias
;
float
scale_bias
;
union
union
...
@@ -2291,6 +2299,24 @@ static void wined3d_context_vk_update_rasterisation_state(const struct wined3d_c
...
@@ -2291,6 +2299,24 @@ static void wined3d_context_vk_update_rasterisation_state(const struct wined3d_c
desc
->
depthBiasClamp
=
r
->
depth_bias_clamp
;
desc
->
depthBiasClamp
=
r
->
depth_bias_clamp
;
}
}
static
void
wined3d_context_vk_set_dynamic_rasterizer_state
(
const
struct
wined3d_context_vk
*
context_vk
,
VkCommandBuffer
vk_command_buffer
,
const
struct
wined3d_vk_info
*
vk_info
,
const
struct
wined3d_state
*
state
)
{
VkPipelineRasterizationStateCreateInfo
desc
;
rasterizer_state_from_wined3d
(
&
desc
,
state
,
context_vk
->
c
.
d3d_info
);
VK_CALL
(
vkCmdSetRasterizerDiscardEnableEXT
(
vk_command_buffer
,
desc
.
rasterizerDiscardEnable
));
VK_CALL
(
vkCmdSetDepthClampEnableEXT
(
vk_command_buffer
,
desc
.
depthClampEnable
));
VK_CALL
(
vkCmdSetCullModeEXT
(
vk_command_buffer
,
desc
.
cullMode
));
VK_CALL
(
vkCmdSetFrontFaceEXT
(
vk_command_buffer
,
desc
.
frontFace
));
VK_CALL
(
vkCmdSetDepthBiasEnableEXT
(
vk_command_buffer
,
desc
.
depthBiasEnable
));
if
(
desc
.
depthBiasEnable
)
VK_CALL
(
vkCmdSetDepthBias
(
vk_command_buffer
,
desc
.
depthBiasConstantFactor
,
desc
.
depthBiasClamp
,
desc
.
depthBiasSlopeFactor
));
}
static
void
blend_equation_from_wined3d
(
const
struct
wined3d_context_vk
*
context_vk
,
VkColorBlendEquationEXT
*
eq
,
static
void
blend_equation_from_wined3d
(
const
struct
wined3d_context_vk
*
context_vk
,
VkColorBlendEquationEXT
*
eq
,
const
struct
wined3d_rendertarget_blend_state_desc
*
rt
,
const
struct
wined3d_rendertarget_view
*
rtv
)
const
struct
wined3d_rendertarget_blend_state_desc
*
rt
,
const
struct
wined3d_rendertarget_view
*
rtv
)
{
{
...
@@ -2582,10 +2608,10 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
...
@@ -2582,10 +2608,10 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
update
=
true
;
update
=
true
;
}
}
if
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_RASTERIZER
)
if
(
!
vk_info
->
dynamic_rasterizer_state
&&
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_RASTERIZER
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_SHADER
(
WINED3D_SHADER_TYPE_GEOMETRY
)))
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_SHADER
(
WINED3D_SHADER_TYPE_GEOMETRY
)))
)
{
{
wined3d_context_vk_update_rasterisation_state
(
context_vk
,
state
,
key
);
rasterizer_state_from_wined3d
(
&
key
->
rs_desc
,
state
,
d3d_info
);
update
=
true
;
update
=
true
;
}
}
...
@@ -3955,6 +3981,10 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
...
@@ -3955,6 +3981,10 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
context_vk
->
c
.
update_multisample_state
=
0
;
context_vk
->
c
.
update_multisample_state
=
0
;
}
}
if
(
vk_info
->
dynamic_rasterizer_state
&&
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_RASTERIZER
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_SHADER
(
WINED3D_SHADER_TYPE_GEOMETRY
))))
wined3d_context_vk_set_dynamic_rasterizer_state
(
context_vk
,
vk_command_buffer
,
vk_info
,
state
);
if
(
vk_info
->
dynamic_blend_state
&&
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_BLEND
)
if
(
vk_info
->
dynamic_blend_state
&&
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_BLEND
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_FRAMEBUFFER
)))
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_FRAMEBUFFER
)))
wined3d_context_vk_set_dynamic_blend_state
(
context_vk
,
vk_command_buffer
,
vk_info
,
state
);
wined3d_context_vk_set_dynamic_blend_state
(
context_vk
,
vk_command_buffer
,
vk_info
,
state
);
...
...
dlls/wined3d/wined3d_vk.h
View file @
b85fff5a
...
@@ -194,7 +194,12 @@ struct wined3d_device_vk;
...
@@ -194,7 +194,12 @@ struct wined3d_device_vk;
VK_DEVICE_EXT_PFN(vkCmdSetColorBlendEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetColorBlendEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetColorBlendEquationEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetColorBlendEquationEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetColorWriteMaskEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetColorWriteMaskEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetCullModeEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetDepthBiasEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetDepthClampEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetFrontFaceEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetRasterizationSamplesEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetRasterizationSamplesEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetRasterizerDiscardEnableEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetSampleMaskEXT) \
VK_DEVICE_EXT_PFN(vkCmdSetSampleMaskEXT) \
/* VK_EXT_transform_feedback */
\
/* VK_EXT_transform_feedback */
\
VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) \
VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) \
...
@@ -258,6 +263,7 @@ struct wined3d_vk_info
...
@@ -258,6 +263,7 @@ struct wined3d_vk_info
bool
dynamic_patch_vertex_count
;
bool
dynamic_patch_vertex_count
;
bool
dynamic_multisample_state
;
bool
dynamic_multisample_state
;
bool
dynamic_blend_state
;
bool
dynamic_blend_state
;
bool
dynamic_rasterizer_state
;
};
};
#define VK_CALL(f) (vk_info->vk_ops.f)
#define VK_CALL(f) (vk_info->vk_ops.f)
...
@@ -580,7 +586,7 @@ struct wined3d_context_vk
...
@@ -580,7 +586,7 @@ struct wined3d_context_vk
const
struct
wined3d_vk_info
*
vk_info
;
const
struct
wined3d_vk_info
*
vk_info
;
VkDynamicState
dynamic_states
[
2
0
];
VkDynamicState
dynamic_states
[
2
7
];
uint32_t
update_compute_pipeline
:
1
;
uint32_t
update_compute_pipeline
:
1
;
uint32_t
update_stream_output
:
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