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
20dc9729
Commit
20dc9729
authored
Apr 11, 2011
by
Rico Schüller
Committed by
Alexandre Julliard
Apr 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Parse effect parameter type definition.
parent
9c09f142
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
223 additions
and
5 deletions
+223
-5
d3dx9_36_private.h
dlls/d3dx9_36/d3dx9_36_private.h
+4
-0
effect.c
dlls/d3dx9_36/effect.c
+168
-5
util.c
dlls/d3dx9_36/util.c
+51
-0
No files found.
dlls/d3dx9_36/d3dx9_36_private.h
View file @
20dc9729
...
@@ -50,4 +50,8 @@ HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer,
...
@@ -50,4 +50,8 @@ HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, LPVOID *buffer,
const
PixelFormatDesc
*
get_format_info
(
D3DFORMAT
format
);
const
PixelFormatDesc
*
get_format_info
(
D3DFORMAT
format
);
const
PixelFormatDesc
*
get_format_info_idx
(
int
idx
);
const
PixelFormatDesc
*
get_format_info_idx
(
int
idx
);
/* debug helpers */
const
char
*
debug_d3dxparameter_class
(
D3DXPARAMETER_CLASS
c
);
const
char
*
debug_d3dxparameter_type
(
D3DXPARAMETER_TYPE
t
);
#endif
/* __WINE_D3DX9_36_PRIVATE_H */
#endif
/* __WINE_D3DX9_36_PRIVATE_H */
dlls/d3dx9_36/effect.c
View file @
20dc9729
...
@@ -34,10 +34,18 @@ struct d3dx_parameter
...
@@ -34,10 +34,18 @@ struct d3dx_parameter
{
{
struct
ID3DXBaseEffectImpl
*
base
;
struct
ID3DXBaseEffectImpl
*
base
;
D3DXPARAMETER_CLASS
class
;
D3DXPARAMETER_TYPE
type
;
UINT
rows
;
UINT
columns
;
UINT
element_count
;
UINT
annotation_count
;
UINT
annotation_count
;
UINT
member_count
;
DWORD
flags
;
DWORD
flags
;
UINT
bytes
;
D3DXHANDLE
*
annotation_handles
;
D3DXHANDLE
*
annotation_handles
;
D3DXHANDLE
*
member_handles
;
};
};
struct
ID3DXBaseEffectImpl
struct
ID3DXBaseEffectImpl
...
@@ -122,6 +130,15 @@ static void free_parameter(D3DXHANDLE handle)
...
@@ -122,6 +130,15 @@ static void free_parameter(D3DXHANDLE handle)
HeapFree
(
GetProcessHeap
(),
0
,
param
->
annotation_handles
);
HeapFree
(
GetProcessHeap
(),
0
,
param
->
annotation_handles
);
}
}
if
(
param
->
member_handles
)
{
for
(
i
=
0
;
i
<
param
->
element_count
;
++
i
)
{
free_parameter
(
param
->
member_handles
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
param
->
member_handles
);
}
HeapFree
(
GetProcessHeap
(),
0
,
param
);
HeapFree
(
GetProcessHeap
(),
0
,
param
);
}
}
...
@@ -2375,20 +2392,157 @@ static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
...
@@ -2375,20 +2392,157 @@ static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
ID3DXEffectCompilerImpl_CompileShader
,
ID3DXEffectCompilerImpl_CompileShader
,
};
};
static
HRESULT
d3dx9_parse_effect_typedef
(
struct
d3dx_parameter
*
param
,
const
char
*
data
,
const
char
**
ptr
,
struct
d3dx_parameter
*
parent
)
{
DWORD
offset
;
HRESULT
hr
;
D3DXHANDLE
*
member_handles
=
NULL
;
UINT
i
;
if
(
!
parent
)
{
read_dword
(
ptr
,
&
param
->
type
);
TRACE
(
"Type: %s
\n
"
,
debug_d3dxparameter_type
(
param
->
type
));
read_dword
(
ptr
,
&
param
->
class
);
TRACE
(
"Class: %s
\n
"
,
debug_d3dxparameter_class
(
param
->
class
));
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Type name offset: %#x
\n
"
,
offset
);
/* todo: Parse name */
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Type semantic offset: %#x
\n
"
,
offset
);
/* todo: Parse semantic */
read_dword
(
ptr
,
&
param
->
element_count
);
TRACE
(
"Elements: %u
\n
"
,
param
->
element_count
);
switch
(
param
->
class
)
{
case
D3DXPC_VECTOR
:
read_dword
(
ptr
,
&
param
->
columns
);
TRACE
(
"Columns: %u
\n
"
,
param
->
columns
);
read_dword
(
ptr
,
&
param
->
rows
);
TRACE
(
"Rows: %u
\n
"
,
param
->
rows
);
/* sizeof(DWORD) * rows * columns */
param
->
bytes
=
4
*
param
->
rows
*
param
->
columns
;
break
;
case
D3DXPC_SCALAR
:
case
D3DXPC_MATRIX_ROWS
:
case
D3DXPC_MATRIX_COLUMNS
:
read_dword
(
ptr
,
&
param
->
rows
);
TRACE
(
"Rows: %u
\n
"
,
param
->
rows
);
read_dword
(
ptr
,
&
param
->
columns
);
TRACE
(
"Columns: %u
\n
"
,
param
->
columns
);
/* sizeof(DWORD) * rows * columns */
param
->
bytes
=
4
*
param
->
rows
*
param
->
columns
;
break
;
default:
FIXME
(
"Unhandled class %s
\n
"
,
debug_d3dxparameter_class
(
param
->
class
));
break
;
}
}
else
{
/* elements */
param
->
type
=
parent
->
type
;
param
->
class
=
parent
->
class
;
param
->
element_count
=
0
;
param
->
annotation_count
=
0
;
param
->
member_count
=
parent
->
member_count
;
param
->
bytes
=
parent
->
bytes
;
param
->
flags
=
parent
->
flags
;
param
->
rows
=
parent
->
rows
;
param
->
columns
=
parent
->
columns
;
}
if
(
param
->
element_count
)
{
unsigned
int
param_bytes
=
0
;
member_handles
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
member_handles
)
*
param
->
element_count
);
if
(
!
member_handles
)
{
ERR
(
"Out of memory
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err_out
;
}
for
(
i
=
0
;
i
<
param
->
element_count
;
++
i
)
{
struct
d3dx_parameter
*
member
;
member
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
member
));
if
(
!
member
)
{
ERR
(
"Out of memory
\n
"
);
hr
=
E_OUTOFMEMORY
;
goto
err_out
;
}
member_handles
[
i
]
=
get_parameter_handle
(
member
);
member
->
base
=
param
->
base
;
hr
=
d3dx9_parse_effect_typedef
(
member
,
data
,
ptr
,
param
);
if
(
hr
!=
D3D_OK
)
{
WARN
(
"Failed to parse member
\n
"
);
goto
err_out
;
}
param_bytes
+=
member
->
bytes
;
}
param
->
bytes
=
param_bytes
;
}
param
->
member_handles
=
member_handles
;
return
D3D_OK
;
err_out:
if
(
member_handles
)
{
for
(
i
=
0
;
i
<
param
->
element_count
;
++
i
)
{
free_parameter
(
member_handles
[
i
]);
}
HeapFree
(
GetProcessHeap
(),
0
,
member_handles
);
}
return
hr
;
}
static
HRESULT
d3dx9_parse_effect_annotation
(
struct
d3dx_parameter
*
anno
,
const
char
*
data
,
const
char
**
ptr
)
static
HRESULT
d3dx9_parse_effect_annotation
(
struct
d3dx_parameter
*
anno
,
const
char
*
data
,
const
char
**
ptr
)
{
{
DWORD
offset
;
DWORD
offset
;
const
char
*
ptr2
;
HRESULT
hr
;
anno
->
flags
=
D3DX_PARAMETER_ANNOTATION
;
read_dword
(
ptr
,
&
offset
);
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Typedef offset: %#x
\n
"
,
offset
);
TRACE
(
"Typedef offset: %#x
\n
"
,
offset
);
/* todo: Parse typedef */
ptr2
=
data
+
offset
;
hr
=
d3dx9_parse_effect_typedef
(
anno
,
data
,
&
ptr2
,
NULL
);
if
(
hr
!=
D3D_OK
)
{
WARN
(
"Failed to parse type definition
\n
"
);
return
hr
;
}
read_dword
(
ptr
,
&
offset
);
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Value offset: %#x
\n
"
,
offset
);
TRACE
(
"Value offset: %#x
\n
"
,
offset
);
/* todo: Parse value */
/* todo: Parse value */
anno
->
flags
&=
D3DX_PARAMETER_ANNOTATION
;
return
D3D_OK
;
return
D3D_OK
;
}
}
...
@@ -2398,14 +2552,14 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const
...
@@ -2398,14 +2552,14 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const
HRESULT
hr
;
HRESULT
hr
;
unsigned
int
i
;
unsigned
int
i
;
D3DXHANDLE
*
annotation_handles
=
NULL
;
D3DXHANDLE
*
annotation_handles
=
NULL
;
const
char
*
ptr2
;
read_dword
(
ptr
,
&
offset
);
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Typedef offset: %#x
\n
"
,
offset
);
TRACE
(
"Typedef offset: %#x
\n
"
,
offset
);
/* todo: Parse typedef */
ptr2
=
data
+
offset
;
read_dword
(
ptr
,
&
offset
);
read_dword
(
ptr
,
&
offset
);
TRACE
(
"Value offset: %#x
\n
"
,
offset
);
TRACE
(
"Value offset: %#x
\n
"
,
offset
);
/* todo: Parse value */
read_dword
(
ptr
,
&
param
->
flags
);
read_dword
(
ptr
,
&
param
->
flags
);
TRACE
(
"Flags: %#x
\n
"
,
param
->
flags
);
TRACE
(
"Flags: %#x
\n
"
,
param
->
flags
);
...
@@ -2413,6 +2567,15 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const
...
@@ -2413,6 +2567,15 @@ static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const
read_dword
(
ptr
,
&
param
->
annotation_count
);
read_dword
(
ptr
,
&
param
->
annotation_count
);
TRACE
(
"Annotation count: %u
\n
"
,
param
->
annotation_count
);
TRACE
(
"Annotation count: %u
\n
"
,
param
->
annotation_count
);
hr
=
d3dx9_parse_effect_typedef
(
param
,
data
,
&
ptr2
,
NULL
);
if
(
hr
!=
D3D_OK
)
{
WARN
(
"Failed to parse type definition
\n
"
);
return
hr
;
}
/* todo: Parse value */
if
(
param
->
annotation_count
)
if
(
param
->
annotation_count
)
{
{
annotation_handles
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
annotation_handles
)
*
param
->
annotation_count
);
annotation_handles
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
annotation_handles
)
*
param
->
annotation_count
);
...
...
dlls/d3dx9_36/util.c
View file @
20dc9729
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "wine/debug.h"
#include "wine/debug.h"
#include "d3dx9_36_private.h"
#include "d3dx9_36_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
/************************************************************
/************************************************************
* pixel format table providing info about number of bytes per pixel,
* pixel format table providing info about number of bytes per pixel,
...
@@ -161,3 +162,53 @@ const PixelFormatDesc *get_format_info_idx(int idx)
...
@@ -161,3 +162,53 @@ const PixelFormatDesc *get_format_info_idx(int idx)
return
NULL
;
return
NULL
;
return
&
formats
[
idx
];
return
&
formats
[
idx
];
}
}
#define WINE_D3DX_TO_STR(x) case x: return #x
const
char
*
debug_d3dxparameter_class
(
D3DXPARAMETER_CLASS
c
)
{
switch
(
c
)
{
WINE_D3DX_TO_STR
(
D3DXPC_SCALAR
);
WINE_D3DX_TO_STR
(
D3DXPC_VECTOR
);
WINE_D3DX_TO_STR
(
D3DXPC_MATRIX_ROWS
);
WINE_D3DX_TO_STR
(
D3DXPC_MATRIX_COLUMNS
);
WINE_D3DX_TO_STR
(
D3DXPC_OBJECT
);
WINE_D3DX_TO_STR
(
D3DXPC_STRUCT
);
default:
FIXME
(
"Unrecognized D3DXPARAMETER_CLASS %#x.
\n
"
,
c
);
return
"unrecognized"
;
}
}
const
char
*
debug_d3dxparameter_type
(
D3DXPARAMETER_TYPE
t
)
{
switch
(
t
)
{
WINE_D3DX_TO_STR
(
D3DXPT_VOID
);
WINE_D3DX_TO_STR
(
D3DXPT_BOOL
);
WINE_D3DX_TO_STR
(
D3DXPT_INT
);
WINE_D3DX_TO_STR
(
D3DXPT_FLOAT
);
WINE_D3DX_TO_STR
(
D3DXPT_STRING
);
WINE_D3DX_TO_STR
(
D3DXPT_TEXTURE
);
WINE_D3DX_TO_STR
(
D3DXPT_TEXTURE1D
);
WINE_D3DX_TO_STR
(
D3DXPT_TEXTURE2D
);
WINE_D3DX_TO_STR
(
D3DXPT_TEXTURE3D
);
WINE_D3DX_TO_STR
(
D3DXPT_TEXTURECUBE
);
WINE_D3DX_TO_STR
(
D3DXPT_SAMPLER
);
WINE_D3DX_TO_STR
(
D3DXPT_SAMPLER1D
);
WINE_D3DX_TO_STR
(
D3DXPT_SAMPLER2D
);
WINE_D3DX_TO_STR
(
D3DXPT_SAMPLER3D
);
WINE_D3DX_TO_STR
(
D3DXPT_SAMPLERCUBE
);
WINE_D3DX_TO_STR
(
D3DXPT_PIXELSHADER
);
WINE_D3DX_TO_STR
(
D3DXPT_VERTEXSHADER
);
WINE_D3DX_TO_STR
(
D3DXPT_PIXELFRAGMENT
);
WINE_D3DX_TO_STR
(
D3DXPT_VERTEXFRAGMENT
);
WINE_D3DX_TO_STR
(
D3DXPT_UNSUPPORTED
);
default:
FIXME
(
"Unrecognized D3DXPARAMETER_TYP %#x.
\n
"
,
t
);
return
"unrecognized"
;
}
}
#undef WINE_D3DX_TO_STR
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