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
22157c3d
Commit
22157c3d
authored
1 year ago
by
Conor McCarthy
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/dxil: Validate the module format version.
parent
eca4b62c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!259
vkd3d-shader/dxil: Read the DXIL module.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libs/vkd3d-shader/dxil.c
+56
-0
56 additions, 0 deletions
libs/vkd3d-shader/dxil.c
libs/vkd3d-shader/vkd3d_shader_private.h
+1
-0
1 addition, 0 deletions
libs/vkd3d-shader/vkd3d_shader_private.h
with
57 additions
and
0 deletions
libs/vkd3d-shader/dxil.c
+
56
−
0
View file @
22157c3d
...
...
@@ -70,6 +70,13 @@ enum bitcode_address_space
ADDRESS_SPACE_GROUPSHARED
,
};
enum
bitcode_module_code
{
MODULE_CODE_VERSION
=
1
,
MODULE_CODE_GLOBALVAR
=
7
,
MODULE_CODE_FUNCTION
=
8
,
};
enum
bitcode_type_code
{
TYPE_CODE_NUMENTRY
=
1
,
...
...
@@ -1201,6 +1208,49 @@ static enum vkd3d_result sm6_parser_symtab_init(struct sm6_parser *sm6)
return
VKD3D_OK
;
}
static
enum
vkd3d_result
sm6_parser_globals_init
(
struct
sm6_parser
*
sm6
)
{
const
struct
dxil_block
*
block
=
&
sm6
->
root_block
;
const
struct
dxil_record
*
record
;
uint64_t
version
;
size_t
i
;
sm6
->
p
.
location
.
line
=
block
->
id
;
sm6
->
p
.
location
.
column
=
0
;
for
(
i
=
0
;
i
<
block
->
record_count
;
++
i
)
{
sm6
->
p
.
location
.
column
=
i
;
record
=
block
->
records
[
i
];
switch
(
record
->
code
)
{
case
MODULE_CODE_FUNCTION
:
FIXME
(
"Functions are not implemented yet.
\n
"
);
break
;
case
MODULE_CODE_GLOBALVAR
:
FIXME
(
"Global variables are not implemented yet.
\n
"
);
break
;
case
MODULE_CODE_VERSION
:
dxil_record_validate_operand_count
(
record
,
1
,
1
,
sm6
);
if
((
version
=
record
->
operands
[
0
])
!=
1
)
{
FIXME
(
"Unsupported format version %#"
PRIx64
".
\n
"
,
version
);
vkd3d_shader_parser_error
(
&
sm6
->
p
,
VKD3D_SHADER_ERROR_DXIL_UNSUPPORTED_BITCODE_FORMAT
,
"Bitcode format version %#"
PRIx64
" is unsupported."
,
version
);
return
VKD3D_ERROR_INVALID_SHADER
;
}
break
;
default:
break
;
}
}
return
VKD3D_OK
;
}
static
void
sm6_type_table_cleanup
(
struct
sm6_type
*
types
,
size_t
count
)
{
size_t
i
;
...
...
@@ -1411,6 +1461,12 @@ static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, const uint32_t
return
ret
;
}
if
((
ret
=
sm6_parser_globals_init
(
sm6
))
<
0
)
{
WARN
(
"Failed to load global declarations.
\n
"
);
return
ret
;
}
dxil_block_destroy
(
&
sm6
->
root_block
);
return
VKD3D_OK
;
...
...
This diff is collapsed.
Click to expand it.
libs/vkd3d-shader/vkd3d_shader_private.h
+
1
−
0
View file @
22157c3d
...
...
@@ -158,6 +158,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND_COUNT
=
8005
,
VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_TABLE
=
8006
,
VKD3D_SHADER_ERROR_DXIL_INVALID_VALUE_SYMTAB
=
8007
,
VKD3D_SHADER_ERROR_DXIL_UNSUPPORTED_BITCODE_FORMAT
=
8008
,
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER
=
8300
,
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE
=
8301
,
...
...
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