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
e8a2f816
Commit
e8a2f816
authored
Jun 27, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Make the viewport state dynamic.
parent
3b59be59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
27 deletions
+43
-27
context_vk.c
dlls/wined3d/context_vk.c
+43
-26
wined3d_vk.h
dlls/wined3d/wined3d_vk.h
+0
-1
No files found.
dlls/wined3d/context_vk.c
View file @
e8a2f816
...
@@ -1879,6 +1879,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
...
@@ -1879,6 +1879,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context
context_invalidate_state
(
&
context_vk
->
c
,
STATE_INDEXBUFFER
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_INDEXBUFFER
);
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_STENCIL_REF
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_STENCIL_REF
);
context_invalidate_state
(
&
context_vk
->
c
,
STATE_VIEWPORT
);
VK_CALL
(
vkEndCommandBuffer
(
buffer
->
vk_command_buffer
));
VK_CALL
(
vkEndCommandBuffer
(
buffer
->
vk_command_buffer
));
...
@@ -2037,8 +2038,6 @@ static int wined3d_graphics_pipeline_vk_compare(const void *key, const struct wi
...
@@ -2037,8 +2038,6 @@ static int wined3d_graphics_pipeline_vk_compare(const void *key, const struct wi
if
((
ret
=
wined3d_uint32_compare
(
a
->
ts_desc
.
patchControlPoints
,
b
->
ts_desc
.
patchControlPoints
)))
if
((
ret
=
wined3d_uint32_compare
(
a
->
ts_desc
.
patchControlPoints
,
b
->
ts_desc
.
patchControlPoints
)))
return
ret
;
return
ret
;
if
((
ret
=
memcmp
(
a
->
viewports
,
b
->
viewports
,
sizeof
(
a
->
viewports
))))
return
ret
;
if
((
ret
=
memcmp
(
a
->
scissors
,
b
->
scissors
,
sizeof
(
a
->
scissors
))))
if
((
ret
=
memcmp
(
a
->
scissors
,
b
->
scissors
,
sizeof
(
a
->
scissors
))))
return
ret
;
return
ret
;
...
@@ -2093,6 +2092,7 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
...
@@ -2093,6 +2092,7 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
{
{
VK_DYNAMIC_STATE_BLEND_CONSTANTS
,
VK_DYNAMIC_STATE_BLEND_CONSTANTS
,
VK_DYNAMIC_STATE_STENCIL_REFERENCE
,
VK_DYNAMIC_STATE_STENCIL_REFERENCE
,
VK_DYNAMIC_STATE_VIEWPORT
,
};
};
key
=
&
context_vk
->
graphics
.
pipeline_key_vk
;
key
=
&
context_vk
->
graphics
.
pipeline_key_vk
;
...
@@ -2117,7 +2117,6 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
...
@@ -2117,7 +2117,6 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context
key
->
ts_desc
.
sType
=
VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
;
key
->
ts_desc
.
sType
=
VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO
;
key
->
vp_desc
.
sType
=
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
;
key
->
vp_desc
.
sType
=
VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO
;
key
->
vp_desc
.
pViewports
=
key
->
viewports
;
key
->
vp_desc
.
pScissors
=
key
->
scissors
;
key
->
vp_desc
.
pScissors
=
key
->
scissors
;
key
->
vp_desc
.
viewportCount
=
(
context_vk
->
vk_info
->
multiple_viewports
?
WINED3D_MAX_VIEWPORTS
:
1
);
key
->
vp_desc
.
viewportCount
=
(
context_vk
->
vk_info
->
multiple_viewports
?
WINED3D_MAX_VIEWPORTS
:
1
);
key
->
vp_desc
.
scissorCount
=
key
->
vp_desc
.
viewportCount
;
key
->
vp_desc
.
scissorCount
=
key
->
vp_desc
.
viewportCount
;
...
@@ -2456,36 +2455,20 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
...
@@ -2456,36 +2455,20 @@ 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_VIEWPORT
)
if
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_SCISSORRECT
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_SCISSORRECT
)
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_RASTERIZER
))
||
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_RASTERIZER
))
{
{
for
(
i
=
0
;
i
<
key
->
vp_desc
.
viewportCount
;
++
i
)
for
(
i
=
0
;
i
<
key
->
vp_desc
.
viewportCount
;
++
i
)
{
{
const
struct
wined3d_viewport
*
src_viewport
=
&
state
->
viewports
[
i
];
const
struct
wined3d_viewport
*
src_viewport
=
&
state
->
viewports
[
i
];
VkViewport
*
viewport
=
&
key
->
viewports
[
i
];
VkRect2D
*
scissor
=
&
key
->
scissors
[
i
];
VkRect2D
*
scissor
=
&
key
->
scissors
[
i
];
if
(
i
>=
state
->
viewport_count
)
if
(
i
>=
state
->
viewport_count
)
{
{
viewport
->
x
=
0
.
0
f
;
viewport
->
y
=
0
.
0
f
;
viewport
->
width
=
1
.
0
f
;
viewport
->
height
=
1
.
0
f
;
viewport
->
minDepth
=
0
.
0
f
;
viewport
->
maxDepth
=
0
.
0
f
;
memset
(
scissor
,
0
,
sizeof
(
*
scissor
));
memset
(
scissor
,
0
,
sizeof
(
*
scissor
));
continue
;
continue
;
}
}
viewport
->
x
=
src_viewport
->
x
;
viewport
->
y
=
src_viewport
->
y
;
viewport
->
width
=
src_viewport
->
width
;
viewport
->
height
=
src_viewport
->
height
;
viewport
->
minDepth
=
src_viewport
->
min_z
;
viewport
->
maxDepth
=
src_viewport
->
max_z
;
if
(
state
->
rasterizer_state
&&
state
->
rasterizer_state
->
desc
.
scissor
)
if
(
state
->
rasterizer_state
&&
state
->
rasterizer_state
->
desc
.
scissor
)
{
{
const
RECT
*
r
=
&
state
->
scissor_rects
[
i
];
const
RECT
*
r
=
&
state
->
scissor_rects
[
i
];
...
@@ -2503,18 +2486,16 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
...
@@ -2503,18 +2486,16 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
}
}
else
else
{
{
scissor
->
offset
.
x
=
viewport
->
x
;
scissor
->
offset
.
x
=
src_
viewport
->
x
;
scissor
->
offset
.
y
=
viewport
->
y
;
scissor
->
offset
.
y
=
src_
viewport
->
y
;
scissor
->
extent
.
width
=
viewport
->
width
;
scissor
->
extent
.
width
=
src_
viewport
->
width
;
scissor
->
extent
.
height
=
viewport
->
height
;
scissor
->
extent
.
height
=
src_
viewport
->
height
;
}
}
/* Scissor offsets need to be non-negative (VUID-VkPipelineViewportStateCreateInfo-x-02821) */
/* Scissor offsets need to be non-negative (VUID-VkPipelineViewportStateCreateInfo-x-02821) */
if
(
scissor
->
offset
.
x
<
0
)
if
(
scissor
->
offset
.
x
<
0
)
scissor
->
offset
.
x
=
0
;
scissor
->
offset
.
x
=
0
;
if
(
scissor
->
offset
.
y
<
0
)
if
(
scissor
->
offset
.
y
<
0
)
scissor
->
offset
.
y
=
0
;
scissor
->
offset
.
y
=
0
;
viewport
->
y
+=
viewport
->
height
;
viewport
->
height
=
-
viewport
->
height
;
}
}
update
=
true
;
update
=
true
;
...
@@ -3792,6 +3773,42 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
...
@@ -3792,6 +3773,42 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c
if
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_BLEND_FACTOR
))
if
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_BLEND_FACTOR
))
VK_CALL
(
vkCmdSetBlendConstants
(
vk_command_buffer
,
&
state
->
blend_factor
.
r
));
VK_CALL
(
vkCmdSetBlendConstants
(
vk_command_buffer
,
&
state
->
blend_factor
.
r
));
if
(
wined3d_context_is_graphics_state_dirty
(
&
context_vk
->
c
,
STATE_VIEWPORT
))
{
unsigned
int
viewport_count
=
(
context_vk
->
vk_info
->
multiple_viewports
?
WINED3D_MAX_VIEWPORTS
:
1
);
VkViewport
viewports
[
WINED3D_MAX_VIEWPORTS
];
unsigned
int
i
;
for
(
i
=
0
;
i
<
viewport_count
;
++
i
)
{
const
struct
wined3d_viewport
*
src_viewport
=
&
state
->
viewports
[
i
];
VkViewport
*
viewport
=
&
viewports
[
i
];
if
(
i
>=
state
->
viewport_count
)
{
viewport
->
x
=
0
.
0
f
;
viewport
->
y
=
0
.
0
f
;
viewport
->
width
=
1
.
0
f
;
viewport
->
height
=
1
.
0
f
;
viewport
->
minDepth
=
0
.
0
f
;
viewport
->
maxDepth
=
0
.
0
f
;
continue
;
}
viewport
->
x
=
src_viewport
->
x
;
viewport
->
y
=
src_viewport
->
y
;
viewport
->
width
=
src_viewport
->
width
;
viewport
->
height
=
src_viewport
->
height
;
viewport
->
minDepth
=
src_viewport
->
min_z
;
viewport
->
maxDepth
=
src_viewport
->
max_z
;
viewport
->
y
+=
viewport
->
height
;
viewport
->
height
=
-
viewport
->
height
;
}
VK_CALL
(
vkCmdSetViewport
(
vk_command_buffer
,
0
,
viewport_count
,
viewports
));
}
memset
(
context_vk
->
c
.
dirty_graphics_states
,
0
,
sizeof
(
context_vk
->
c
.
dirty_graphics_states
));
memset
(
context_vk
->
c
.
dirty_graphics_states
,
0
,
sizeof
(
context_vk
->
c
.
dirty_graphics_states
));
context_vk
->
c
.
shader_update_mask
&=
1u
<<
WINED3D_SHADER_TYPE_COMPUTE
;
context_vk
->
c
.
shader_update_mask
&=
1u
<<
WINED3D_SHADER_TYPE_COMPUTE
;
...
...
dlls/wined3d/wined3d_vk.h
View file @
e8a2f816
...
@@ -497,7 +497,6 @@ struct wined3d_graphics_pipeline_key_vk
...
@@ -497,7 +497,6 @@ struct wined3d_graphics_pipeline_key_vk
VkVertexInputBindingDivisorDescriptionEXT
divisors
[
MAX_ATTRIBS
];
VkVertexInputBindingDivisorDescriptionEXT
divisors
[
MAX_ATTRIBS
];
VkVertexInputAttributeDescription
attributes
[
MAX_ATTRIBS
];
VkVertexInputAttributeDescription
attributes
[
MAX_ATTRIBS
];
VkVertexInputBindingDescription
bindings
[
MAX_ATTRIBS
];
VkVertexInputBindingDescription
bindings
[
MAX_ATTRIBS
];
VkViewport
viewports
[
WINED3D_MAX_VIEWPORTS
];
VkRect2D
scissors
[
WINED3D_MAX_VIEWPORTS
];
VkRect2D
scissors
[
WINED3D_MAX_VIEWPORTS
];
VkSampleMask
sample_mask
;
VkSampleMask
sample_mask
;
VkPipelineColorBlendAttachmentState
blend_attachments
[
WINED3D_MAX_RENDER_TARGETS
];
VkPipelineColorBlendAttachmentState
blend_attachments
[
WINED3D_MAX_RENDER_TARGETS
];
...
...
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