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
465fe54a
Commit
465fe54a
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d-shader: Implement vkd3d_shader_compile_dxbc().
parent
1f65d4cc
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-shader/vkd3d_shader_main.c
+57
-2
57 additions, 2 deletions
libs/vkd3d-shader/vkd3d_shader_main.c
with
57 additions
and
2 deletions
libs/vkd3d-shader/vkd3d_shader_main.c
+
57
−
2
View file @
465fe54a
...
...
@@ -21,9 +21,64 @@
HRESULT
vkd3d_shader_compile_dxbc
(
const
struct
vkd3d_shader_code
*
dxbc
,
struct
vkd3d_shader_code
*
spirv
,
uint32_t
compiler_options
)
{
FIXME
(
"Not implemented!
\n
"
);
struct
vkd3d_dxbc_compiler
*
spirv_compiler
;
struct
vkd3d_shader_version
shader_version
;
struct
vkd3d_shader_desc
shader_desc
;
struct
vkd3d_shader_instruction
ins
;
void
*
parser_data
;
const
DWORD
*
ptr
;
HRESULT
hr
;
bool
ret
;
return
E_NOTIMPL
;
TRACE
(
"dxbc {%p, %zu}, spirv %p, compiler_options %#x.
\n
"
,
dxbc
->
code
,
dxbc
->
size
,
spirv
,
compiler_options
);
if
(
FAILED
(
hr
=
shader_extract_from_dxbc
(
dxbc
->
code
,
dxbc
->
size
,
&
shader_desc
)))
{
WARN
(
"Failed to extract shader, hr %#x.
\n
"
,
hr
);
return
hr
;
}
if
(
!
(
parser_data
=
shader_sm4_init
(
shader_desc
.
byte_code
,
shader_desc
.
byte_code_size
,
&
shader_desc
.
output_signature
)))
{
WARN
(
"Failed to initialize shader parser, hr %#x.
\n
"
,
hr
);
free_shader_desc
(
&
shader_desc
);
return
hr
;
}
shader_sm4_read_header
(
parser_data
,
&
ptr
,
&
shader_version
);
if
(
!
(
spirv_compiler
=
vkd3d_dxbc_compiler_create
(
&
shader_version
,
compiler_options
)))
{
ERR
(
"Failed to create DXBC compiler.
\n
"
);
shader_sm4_free
(
parser_data
);
free_shader_desc
(
&
shader_desc
);
return
hr
;
}
while
(
!
shader_sm4_is_end
(
parser_data
,
&
ptr
))
{
shader_sm4_read_instruction
(
parser_data
,
&
ptr
,
&
ins
);
if
(
ins
.
handler_idx
==
VKD3DSIH_TABLE_SIZE
)
{
WARN
(
"Encountered unrecognized or invalid instruction.
\n
"
);
shader_sm4_free
(
parser_data
);
free_shader_desc
(
&
shader_desc
);
vkd3d_dxbc_compiler_destroy
(
spirv_compiler
);
return
E_FAIL
;
}
vkd3d_dxbc_compiler_handle_instruction
(
spirv_compiler
,
&
ins
);
}
ret
=
vkd3d_dxbc_compiler_generate_spirv
(
spirv_compiler
,
spirv
);
vkd3d_dxbc_compiler_destroy
(
spirv_compiler
);
shader_sm4_free
(
parser_data
);
free_shader_desc
(
&
shader_desc
);
return
ret
?
S_OK
:
E_FAIL
;
}
void
vkd3d_shader_free_shader_code
(
struct
vkd3d_shader_code
*
shader_code
)
...
...
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