Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
55ab59af
Commit
55ab59af
authored
Apr 04, 2023
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Use vkd3d_shader_parse_dxbc() in d3dcompiler_shader_reflection_init().
parent
372dc31e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
148 deletions
+11
-148
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+0
-12
reflection.c
dlls/d3dcompiler_43/reflection.c
+11
-10
utils.c
dlls/d3dcompiler_43/utils.c
+0
-126
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
55ab59af
...
...
@@ -553,16 +553,4 @@ void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN;
#define TAG_XNAP MAKE_TAG('X', 'N', 'A', 'P')
#define TAG_XNAS MAKE_TAG('X', 'N', 'A', 'S')
struct
dxbc
{
UINT
size
;
UINT
count
;
struct
vkd3d_shader_dxbc_section_desc
*
sections
;
};
void
dxbc_destroy
(
struct
dxbc
*
dxbc
)
DECLSPEC_HIDDEN
;
HRESULT
dxbc_parse
(
const
char
*
data
,
SIZE_T
data_size
,
struct
dxbc
*
dxbc
)
DECLSPEC_HIDDEN
;
HRESULT
dxbc_add_section
(
struct
dxbc
*
dxbc
,
DWORD
tag
,
const
char
*
data
,
size_t
data_size
)
DECLSPEC_HIDDEN
;
HRESULT
dxbc_init
(
struct
dxbc
*
dxbc
,
unsigned
int
size
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_D3DCOMPILER_PRIVATE_H */
dlls/d3dcompiler_43/reflection.c
View file @
55ab59af
...
...
@@ -1862,22 +1862,23 @@ static HRESULT d3dcompiler_parse_shdr(struct d3dcompiler_shader_reflection *r, c
static
HRESULT
d3dcompiler_shader_reflection_init
(
struct
d3dcompiler_shader_reflection
*
reflection
,
const
void
*
data
,
SIZE_T
data_size
)
{
struct
dxbc
src_dxbc
;
HRESULT
hr
;
const
struct
vkd3d_shader_code
src_dxbc
=
{.
code
=
data
,
.
size
=
data_size
};
struct
vkd3d_shader_dxbc_desc
src_dxbc_desc
;
HRESULT
hr
=
S_OK
;
unsigned
int
i
;
int
ret
;
wine_rb_init
(
&
reflection
->
types
,
d3dcompiler_shader_reflection_type_compare
);
hr
=
dxbc_parse
(
data
,
data_size
,
&
src_dxbc
);
if
(
FAILED
(
hr
))
if
((
ret
=
vkd3d_shader_parse_dxbc
(
&
src_dxbc
,
0
,
&
src_dxbc_desc
,
NULL
))
<
0
)
{
WARN
(
"Failed to parse reflection
\n
"
);
return
hr
;
WARN
(
"Failed to parse reflection
, ret %d.
\n
"
,
ret
);
return
E_FAIL
;
}
for
(
i
=
0
;
i
<
src_dxbc
.
count
;
++
i
)
for
(
i
=
0
;
i
<
src_dxbc
_desc
.
section_
count
;
++
i
)
{
const
struct
vkd3d_shader_dxbc_section_desc
*
section
=
&
src_dxbc
.
sections
[
i
];
const
struct
vkd3d_shader_dxbc_section_desc
*
section
=
&
src_dxbc
_desc
.
sections
[
i
];
switch
(
section
->
tag
)
{
...
...
@@ -1967,13 +1968,13 @@ static HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_refl
}
}
dxbc_destroy
(
&
src_dxb
c
);
vkd3d_shader_free_dxbc
(
&
src_dxbc_des
c
);
return
hr
;
err_out:
reflection_cleanup
(
reflection
);
dxbc_destroy
(
&
src_dxb
c
);
vkd3d_shader_free_dxbc
(
&
src_dxbc_des
c
);
return
hr
;
}
...
...
dlls/d3dcompiler_43/utils.c
View file @
55ab59af
...
...
@@ -526,132 +526,6 @@ void skip_u32_unknown(const char **ptr, unsigned int count)
}
}
HRESULT
dxbc_add_section
(
struct
dxbc
*
dxbc
,
DWORD
tag
,
const
char
*
data
,
size_t
data_size
)
{
TRACE
(
"dxbc %p, tag %s, size %#Ix.
\n
"
,
dxbc
,
debugstr_an
((
const
char
*
)
&
tag
,
4
),
data_size
);
if
(
dxbc
->
count
>=
dxbc
->
size
)
{
struct
vkd3d_shader_dxbc_section_desc
*
new_sections
;
DWORD
new_size
=
dxbc
->
size
<<
1
;
new_sections
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
dxbc
->
sections
,
new_size
*
sizeof
(
*
dxbc
->
sections
));
if
(
!
new_sections
)
{
ERR
(
"Failed to allocate dxbc section memory
\n
"
);
return
E_OUTOFMEMORY
;
}
dxbc
->
sections
=
new_sections
;
dxbc
->
size
=
new_size
;
}
dxbc
->
sections
[
dxbc
->
count
].
tag
=
tag
;
dxbc
->
sections
[
dxbc
->
count
].
data
.
size
=
data_size
;
dxbc
->
sections
[
dxbc
->
count
].
data
.
code
=
data
;
++
dxbc
->
count
;
return
S_OK
;
}
HRESULT
dxbc_init
(
struct
dxbc
*
dxbc
,
unsigned
int
size
)
{
TRACE
(
"dxbc %p, size %u.
\n
"
,
dxbc
,
size
);
/* use a good starting value for the size if none specified */
if
(
!
size
)
size
=
2
;
dxbc
->
sections
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
*
sizeof
(
*
dxbc
->
sections
));
if
(
!
dxbc
->
sections
)
{
ERR
(
"Failed to allocate dxbc section memory
\n
"
);
return
E_OUTOFMEMORY
;
}
dxbc
->
size
=
size
;
dxbc
->
count
=
0
;
return
S_OK
;
}
HRESULT
dxbc_parse
(
const
char
*
data
,
SIZE_T
data_size
,
struct
dxbc
*
dxbc
)
{
uint32_t
tag
,
total_size
,
chunk_count
;
const
char
*
ptr
=
data
;
unsigned
int
i
;
HRESULT
hr
;
if
(
!
data
)
{
WARN
(
"No data supplied.
\n
"
);
return
E_FAIL
;
}
tag
=
read_u32
(
&
ptr
);
TRACE
(
"tag: %s.
\n
"
,
debugstr_an
((
const
char
*
)
&
tag
,
4
));
if
(
tag
!=
TAG_DXBC
)
{
WARN
(
"Wrong tag.
\n
"
);
return
E_FAIL
;
}
/* checksum? */
skip_u32_unknown
(
&
ptr
,
4
);
skip_u32_unknown
(
&
ptr
,
1
);
total_size
=
read_u32
(
&
ptr
);
TRACE
(
"total size: %#x
\n
"
,
total_size
);
if
(
data_size
!=
total_size
)
{
WARN
(
"Wrong size supplied.
\n
"
);
return
D3DERR_INVALIDCALL
;
}
chunk_count
=
read_u32
(
&
ptr
);
TRACE
(
"chunk count: %#x
\n
"
,
chunk_count
);
hr
=
dxbc_init
(
dxbc
,
chunk_count
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to init dxbc
\n
"
);
return
hr
;
}
for
(
i
=
0
;
i
<
chunk_count
;
++
i
)
{
uint32_t
chunk_tag
,
chunk_size
;
const
char
*
chunk_ptr
;
uint32_t
chunk_offset
;
chunk_offset
=
read_u32
(
&
ptr
);
TRACE
(
"chunk %u at offset %#x
\n
"
,
i
,
chunk_offset
);
chunk_ptr
=
data
+
chunk_offset
;
chunk_tag
=
read_u32
(
&
chunk_ptr
);
chunk_size
=
read_u32
(
&
chunk_ptr
);
hr
=
dxbc_add_section
(
dxbc
,
chunk_tag
,
chunk_ptr
,
chunk_size
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to add section to dxbc
\n
"
);
return
hr
;
}
}
return
hr
;
}
void
dxbc_destroy
(
struct
dxbc
*
dxbc
)
{
TRACE
(
"dxbc %p.
\n
"
,
dxbc
);
HeapFree
(
GetProcessHeap
(),
0
,
dxbc
->
sections
);
}
void
compilation_message
(
struct
compilation_messages
*
msg
,
const
char
*
fmt
,
va_list
args
)
{
char
*
buffer
;
...
...
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