Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
2425e293
Commit
2425e293
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d: Match input layout elements with vertex shader inputs.
parent
b19fe742
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/vkd3d/state.c
+25
-8
25 additions, 8 deletions
libs/vkd3d/state.c
with
25 additions
and
8 deletions
libs/vkd3d/state.c
+
25
−
8
View file @
2425e293
...
...
@@ -1709,12 +1709,13 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
uint32_t
aligned_offsets
[
D3D12_VS_INPUT_REGISTER_COUNT
];
const
struct
d3d12_root_signature
*
root_signature
;
struct
vkd3d_shader_interface
shader_interface
;
struct
vkd3d_shader_signature
input_signature
;
struct
VkSubpassDescription
sub_pass_desc
;
struct
VkRenderPassCreateInfo
pass_desc
;
const
struct
vkd3d_format
*
format
;
enum
VkVertexInputRate
input_rate
;
unsigned
int
i
,
j
;
size_t
rt_count
;
unsigned
int
i
;
uint32_t
mask
;
VkResult
vr
;
HRESULT
hr
;
...
...
@@ -1755,6 +1756,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
shader_interface
.
uav_counters
=
NULL
;
shader_interface
.
uav_counter_count
=
0
;
memset
(
&
input_signature
,
0
,
sizeof
(
input_signature
));
for
(
i
=
0
,
graphics
->
stage_count
=
0
;
i
<
ARRAY_SIZE
(
shader_stages
);
++
i
)
{
const
D3D12_SHADER_BYTECODE
*
b
=
(
const
void
*
)((
uintptr_t
)
desc
+
shader_stages
[
i
].
offset
);
...
...
@@ -1777,6 +1779,10 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
shader_stages
[
i
].
stage
,
b
,
&
shader_interface
)))
goto
fail
;
if
(
shader_stages
[
i
].
stage
==
VK_SHADER_STAGE_VERTEX_BIT
&&
FAILED
(
hr
=
vkd3d_shader_parse_input_signature
(
&
dxbc
,
&
input_signature
)))
goto
fail
;
++
graphics
->
stage_count
;
}
...
...
@@ -1792,9 +1798,10 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
&&
FAILED
(
hr
=
compute_input_layout_offsets
(
&
desc
->
InputLayout
,
aligned_offsets
)))
goto
fail
;
for
(
i
=
0
,
mask
=
0
;
i
<
graphics
->
attribute_count
;
++
i
)
for
(
i
=
0
,
j
=
0
,
mask
=
0
;
i
<
graphics
->
attribute_count
;
++
i
)
{
const
D3D12_INPUT_ELEMENT_DESC
*
e
=
&
desc
->
InputLayout
.
pInputElementDescs
[
i
];
const
struct
vkd3d_shader_signature_element
*
signature_element
;
if
(
!
(
format
=
vkd3d_get_format
(
e
->
Format
,
false
)))
{
...
...
@@ -1810,14 +1817,21 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
goto
fail
;
}
/* FIXME: Assign locations based on the vertex shader input signature. */
graphics
->
attributes
[
i
].
location
=
i
;
graphics
->
attributes
[
i
].
binding
=
e
->
InputSlot
;
graphics
->
attributes
[
i
].
format
=
format
->
vk_format
;
if
(
!
(
signature_element
=
vkd3d_shader_find_signature_element
(
&
input_signature
,
e
->
SemanticName
,
e
->
SemanticIndex
,
0
)))
{
WARN
(
"Unused input element %u.
\n
"
,
i
);
continue
;
}
graphics
->
attributes
[
j
].
location
=
signature_element
->
register_index
;
graphics
->
attributes
[
j
].
binding
=
e
->
InputSlot
;
graphics
->
attributes
[
j
].
format
=
format
->
vk_format
;
if
(
e
->
AlignedByteOffset
!=
D3D12_APPEND_ALIGNED_ELEMENT
)
graphics
->
attributes
[
i
].
offset
=
e
->
AlignedByteOffset
;
graphics
->
attributes
[
j
].
offset
=
e
->
AlignedByteOffset
;
else
graphics
->
attributes
[
i
].
offset
=
aligned_offsets
[
i
];
graphics
->
attributes
[
j
].
offset
=
aligned_offsets
[
i
];
++
j
;
switch
(
e
->
InputSlotClass
)
{
...
...
@@ -1847,6 +1861,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
graphics
->
input_rates
[
e
->
InputSlot
]
=
input_rate
;
mask
|=
1u
<<
e
->
InputSlot
;
}
graphics
->
attribute_count
=
j
;
vkd3d_shader_free_shader_signature
(
&
input_signature
);
rt_count
=
desc
->
NumRenderTargets
;
if
(
rt_count
>
ARRAY_SIZE
(
graphics
->
attachments
)
-
1
)
...
...
@@ -1983,6 +1999,7 @@ fail:
{
VK_CALL
(
vkDestroyShaderModule
(
device
->
vk_device
,
state
->
u
.
graphics
.
stages
[
i
].
module
,
NULL
));
}
vkd3d_shader_free_shader_signature
(
&
input_signature
);
return
hr
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment