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
0e8d142e
Commit
0e8d142e
authored
Feb 20, 2011
by
Rico Schüller
Committed by
Alexandre Julliard
Feb 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Parse reflection variables.
parent
c6ec32ae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
169 additions
and
2 deletions
+169
-2
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+13
-0
reflection.c
dlls/d3dcompiler_43/reflection.c
+156
-2
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
0e8d142e
...
...
@@ -64,6 +64,17 @@ struct d3dcompiler_shader_signature
char
*
string_data
;
};
struct
d3dcompiler_shader_reflection_variable
{
ID3D11ShaderReflectionVariable
ID3D11ShaderReflectionVariable_iface
;
char
*
name
;
UINT
start_offset
;
UINT
size
;
UINT
flags
;
LPVOID
default_value
;
};
struct
d3dcompiler_shader_reflection_constant_buffer
{
ID3D11ShaderReflectionConstantBuffer
ID3D11ShaderReflectionConstantBuffer_iface
;
...
...
@@ -75,6 +86,8 @@ struct d3dcompiler_shader_reflection_constant_buffer
UINT
variable_count
;
UINT
size
;
UINT
flags
;
struct
d3dcompiler_shader_reflection_variable
*
variables
;
};
/* ID3D11ShaderReflection */
...
...
dlls/d3dcompiler_43/reflection.c
View file @
0e8d142e
...
...
@@ -60,6 +60,22 @@ static BOOL copy_name(const char *ptr, char **name)
return
TRUE
;
}
static
BOOL
copy_value
(
const
char
*
ptr
,
void
**
value
,
DWORD
size
)
{
if
(
!
ptr
||
!
size
)
return
TRUE
;
*
value
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
!*
value
)
{
ERR
(
"Failed to allocate vlaue memory.
\n
"
);
return
FALSE
;
}
memcpy
(
*
value
,
ptr
,
size
);
return
TRUE
;
}
static
void
free_signature
(
struct
d3dcompiler_shader_signature
*
sig
)
{
TRACE
(
"Free signature %p
\n
"
,
sig
);
...
...
@@ -68,8 +84,28 @@ static void free_signature(struct d3dcompiler_shader_signature *sig)
HeapFree
(
GetProcessHeap
(),
0
,
sig
->
string_data
);
}
static
void
free_variable
(
struct
d3dcompiler_shader_reflection_variable
*
var
)
{
if
(
var
)
{
HeapFree
(
GetProcessHeap
(),
0
,
var
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
var
->
default_value
);
}
}
static
void
free_constant_buffer
(
struct
d3dcompiler_shader_reflection_constant_buffer
*
cb
)
{
if
(
cb
->
variables
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
cb
->
variable_count
;
++
i
)
{
free_variable
(
&
cb
->
variables
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
cb
->
variables
);
}
HeapFree
(
GetProcessHeap
(),
0
,
cb
->
name
);
}
...
...
@@ -537,6 +573,49 @@ const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflect
d3dcompiler_shader_reflection_constant_buffer_GetVariableByName
,
};
/* ID3D11ShaderReflectionVariable methods */
static
HRESULT
STDMETHODCALLTYPE
d3dcompiler_shader_reflection_variable_GetDesc
(
ID3D11ShaderReflectionVariable
*
iface
,
D3D11_SHADER_VARIABLE_DESC
*
desc
)
{
FIXME
(
"iface %p, desc %p stub!
\n
"
,
iface
,
desc
);
return
E_NOTIMPL
;
}
static
ID3D11ShaderReflectionType
*
STDMETHODCALLTYPE
d3dcompiler_shader_reflection_variable_GetType
(
ID3D11ShaderReflectionVariable
*
iface
)
{
FIXME
(
"iface %p stub!
\n
"
,
iface
);
return
NULL
;
}
static
ID3D11ShaderReflectionConstantBuffer
*
STDMETHODCALLTYPE
d3dcompiler_shader_reflection_variable_GetBuffer
(
ID3D11ShaderReflectionVariable
*
iface
)
{
FIXME
(
"iface %p stub!
\n
"
,
iface
);
return
NULL
;
}
static
UINT
STDMETHODCALLTYPE
d3dcompiler_shader_reflection_variable_GetInterfaceSlot
(
ID3D11ShaderReflectionVariable
*
iface
,
UINT
index
)
{
FIXME
(
"iface %p, index %u stub!
\n
"
,
iface
,
index
);
return
0
;
}
const
struct
ID3D11ShaderReflectionVariableVtbl
d3dcompiler_shader_reflection_variable_vtbl
=
{
/* ID3D11ShaderReflectionVariable methods */
d3dcompiler_shader_reflection_variable_GetDesc
,
d3dcompiler_shader_reflection_variable_GetType
,
d3dcompiler_shader_reflection_variable_GetBuffer
,
d3dcompiler_shader_reflection_variable_GetInterfaceSlot
,
};
static
HRESULT
d3dcompiler_parse_stat
(
struct
d3dcompiler_shader_reflection
*
r
,
const
char
*
data
,
DWORD
data_size
)
{
const
char
*
ptr
=
data
;
...
...
@@ -647,6 +726,75 @@ static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, c
return
E_FAIL
;
}
static
HRESULT
d3dcompiler_parse_variables
(
struct
d3dcompiler_shader_reflection_constant_buffer
*
cb
,
const
char
*
data
,
DWORD
data_size
,
const
char
*
ptr
)
{
struct
d3dcompiler_shader_reflection_variable
*
variables
;
unsigned
int
i
;
HRESULT
hr
;
variables
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
cb
->
variable_count
*
sizeof
(
*
variables
));
if
(
!
variables
)
{
ERR
(
"Failed to allocate variables memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
cb
->
variable_count
;
i
++
)
{
struct
d3dcompiler_shader_reflection_variable
*
v
=
&
variables
[
i
];
DWORD
offset
;
v
->
ID3D11ShaderReflectionVariable_iface
.
lpVtbl
=
&
d3dcompiler_shader_reflection_variable_vtbl
;
read_dword
(
&
ptr
,
&
offset
);
if
(
!
copy_name
(
data
+
offset
,
&
v
->
name
))
{
ERR
(
"Failed to copy name.
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err_out
;
}
TRACE
(
"Variable name: %s.
\n
"
,
debugstr_a
(
v
->
name
));
read_dword
(
&
ptr
,
&
v
->
start_offset
);
TRACE
(
"Variable offset: %u
\n
"
,
v
->
start_offset
);
read_dword
(
&
ptr
,
&
v
->
size
);
TRACE
(
"Variable size: %u
\n
"
,
v
->
size
);
read_dword
(
&
ptr
,
&
v
->
flags
);
TRACE
(
"Variable flags: %u
\n
"
,
v
->
flags
);
/* todo: Parse types */
read_dword
(
&
ptr
,
&
offset
);
FIXME
(
"Variable type offset: %x
\n
"
,
offset
);
read_dword
(
&
ptr
,
&
offset
);
TRACE
(
"Variable default value offset: %x
\n
"
,
offset
);
if
(
!
copy_value
(
data
+
offset
,
&
v
->
default_value
,
offset
?
v
->
size
:
0
))
{
ERR
(
"Failed to copy name.
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err_out
;
}
if
((
cb
->
reflection
->
target
&
0xffff
)
>=
0x500
)
skip_dword_unknown
(
&
ptr
,
4
);
}
cb
->
variables
=
variables
;
return
S_OK
;
err_out:
for
(
i
=
0
;
i
<
cb
->
variable_count
;
i
++
)
{
free_variable
(
&
variables
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
variables
);
return
hr
;
}
static
HRESULT
d3dcompiler_parse_rdef
(
struct
d3dcompiler_shader_reflection
*
r
,
const
char
*
data
,
DWORD
data_size
)
{
const
char
*
ptr
=
data
;
...
...
@@ -779,9 +927,15 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
read_dword
(
&
ptr
,
&
cb
->
variable_count
);
TRACE
(
"Variable count: %u
\n
"
,
cb
->
variable_count
);
/* todo: Parse variables */
read_dword
(
&
ptr
,
&
offset
);
FIXME
(
"Variable offset: %x
\n
"
,
offset
);
TRACE
(
"Variable offset: %x
\n
"
,
offset
);
hr
=
d3dcompiler_parse_variables
(
cb
,
data
,
data_size
,
data
+
offset
);
if
(
hr
!=
S_OK
)
{
FIXME
(
"Failed to parse variables."
);
goto
err_out
;
}
read_dword
(
&
ptr
,
&
cb
->
size
);
TRACE
(
"Cbuffer size: %u
\n
"
,
cb
->
size
);
...
...
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