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
7c03f2c2
Commit
7c03f2c2
authored
Mar 03, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 03, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10: Store the shader's input signature.
parent
78afd873
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
1 deletion
+105
-1
d3d10_private.h
dlls/d3d10/d3d10_private.h
+7
-0
effect.c
dlls/d3d10/effect.c
+98
-1
No files found.
dlls/d3d10/d3d10_private.h
View file @
7c03f2c2
...
...
@@ -42,6 +42,13 @@ struct d3d10_effect_variable
{
enum
d3d10_effect_variable_type
type
;
DWORD
idx_offset
;
void
*
data
;
};
struct
d3d10_effect_shader_variable
{
char
*
input_signature
;
UINT
input_signature_size
;
};
/* ID3D10EffectPass */
...
...
dlls/d3d10/effect.c
View file @
7c03f2c2
...
...
@@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_FX10 MAKE_TAG('F', 'X', '1', '0')
#define TAG_ISGN MAKE_TAG('I', 'S', 'G', 'N')
static
const
struct
ID3D10EffectTechniqueVtbl
d3d10_effect_technique_vtbl
;
static
const
struct
ID3D10EffectPassVtbl
d3d10_effect_pass_vtbl
;
...
...
@@ -52,6 +53,18 @@ static inline void skip_dword_unknown(const char **ptr, unsigned int count)
}
}
static
inline
void
write_dword
(
char
**
ptr
,
DWORD
d
)
{
memcpy
(
*
ptr
,
&
d
,
sizeof
(
d
));
*
ptr
+=
sizeof
(
d
);
}
static
inline
void
write_dword_unknown
(
char
**
ptr
,
DWORD
d
)
{
FIXME
(
"Writing unknown DWORD 0x%08x
\n
"
,
d
);
write_dword
(
ptr
,
d
);
}
static
inline
void
read_tag
(
const
char
**
ptr
,
DWORD
*
t
,
char
t_str
[
5
])
{
read_dword
(
ptr
,
t
);
...
...
@@ -179,6 +192,8 @@ static HRESULT parse_fx10_technique_index(struct d3d10_effect_technique *t, cons
static
HRESULT
shader_chunk_handler
(
const
char
*
data
,
DWORD
data_size
,
DWORD
tag
,
void
*
ctx
)
{
struct
d3d10_effect_variable
*
v
=
ctx
;
struct
d3d10_effect_shader_variable
*
s
=
v
->
data
;
char
tag_str
[
5
];
memcpy
(
tag_str
,
&
tag
,
4
);
...
...
@@ -189,6 +204,49 @@ static HRESULT shader_chunk_handler(const char *data, DWORD data_size, DWORD tag
switch
(
tag
)
{
case
TAG_ISGN
:
{
/* 32 (DXBC header) + 1 * 4 (chunk index) + 2 * 4 (chunk header) + data_size (chunk data) */
UINT
size
=
44
+
data_size
;
char
*
ptr
;
s
->
input_signature
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
);
if
(
!
s
->
input_signature
)
{
ERR
(
"Failed to allocate input signature data
\n
"
);
return
E_OUTOFMEMORY
;
}
s
->
input_signature_size
=
size
;
ptr
=
s
->
input_signature
;
write_dword
(
&
ptr
,
TAG_DXBC
);
/* signature(?) */
write_dword_unknown
(
&
ptr
,
0
);
write_dword_unknown
(
&
ptr
,
0
);
write_dword_unknown
(
&
ptr
,
0
);
write_dword_unknown
(
&
ptr
,
0
);
/* seems to be always 1 */
write_dword_unknown
(
&
ptr
,
1
);
/* DXBC size */
write_dword
(
&
ptr
,
size
);
/* chunk count */
write_dword
(
&
ptr
,
1
);
/* chunk index */
write_dword
(
&
ptr
,
(
ptr
-
s
->
input_signature
)
+
4
);
/* chunk */
write_dword
(
&
ptr
,
TAG_ISGN
);
write_dword
(
&
ptr
,
data_size
);
memcpy
(
ptr
,
data
,
data_size
);
break
;
}
default:
FIXME
(
"Unhandled chunk %s
\n
"
,
tag_str
);
break
;
...
...
@@ -202,6 +260,13 @@ static HRESULT parse_shader(struct d3d10_effect_variable *v, const char *data)
const
char
*
ptr
=
data
;
DWORD
dxbc_size
;
v
->
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
d3d10_effect_shader_variable
));
if
(
!
v
->
data
)
{
ERR
(
"Failed to allocate shader variable memory
\n
"
);
return
E_OUTOFMEMORY
;
}
read_dword
(
&
ptr
,
&
dxbc_size
);
TRACE
(
"dxbc size: %#x
\n
"
,
dxbc_size
);
...
...
@@ -424,14 +489,46 @@ HRESULT d3d10_effect_parse(struct d3d10_effect *This, const void *data, SIZE_T d
return
parse_dxbc
(
data
,
data_size
,
fx10_chunk_handler
,
This
);
}
static
void
d3d10_effect_variable_destroy
(
struct
d3d10_effect_variable
*
v
)
{
TRACE
(
"variable %p
\n
"
,
v
);
if
(
!
v
->
data
)
return
;
switch
(
v
->
type
)
{
case
D3D10_EVT_VERTEXSHADER
:
case
D3D10_EVT_PIXELSHADER
:
case
D3D10_EVT_GEOMETRYSHADER
:
HeapFree
(
GetProcessHeap
(),
0
,
((
struct
d3d10_effect_shader_variable
*
)
v
->
data
)
->
input_signature
);
break
;
default:
break
;
}
HeapFree
(
GetProcessHeap
(),
0
,
v
->
data
);
}
static
void
d3d10_effect_pass_destroy
(
struct
d3d10_effect_pass
*
p
)
{
TRACE
(
"pass %p
\n
"
,
p
);
HeapFree
(
GetProcessHeap
(),
0
,
p
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
p
->
variables
);
if
(
p
->
variables
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
p
->
variable_count
;
++
i
)
{
d3d10_effect_variable_destroy
(
&
p
->
variables
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
p
->
variables
);
}
}
static
void
d3d10_effect_technique_destroy
(
struct
d3d10_effect_technique
*
t
)
{
TRACE
(
"technique %p
\n
"
,
t
);
HeapFree
(
GetProcessHeap
(),
0
,
t
->
name
);
if
(
t
->
passes
)
{
...
...
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