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
aef52a1d
Commit
aef52a1d
authored
Mar 17, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Mar 18, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Create shaders and strings.
parent
73288e11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
9 deletions
+59
-9
effect.c
dlls/d3dx9_36/effect.c
+59
-9
No files found.
dlls/d3dx9_36/effect.c
View file @
aef52a1d
...
...
@@ -4939,12 +4939,55 @@ err_out:
return
hr
;
}
static
HRESULT
d3dx9_create_object
(
struct
d3dx9_base_effect
*
base
,
struct
d3dx_object
*
object
)
{
struct
d3dx_parameter
*
param
=
object
->
param
;
struct
IDirect3DDevice9
*
device
=
base
->
effect
->
device
;
HRESULT
hr
;
if
(
*
(
char
**
)
param
->
data
)
ERR
(
"Parameter data already allocated.
\n
"
);
switch
(
param
->
type
)
{
case
D3DXPT_STRING
:
*
(
char
**
)
param
->
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
object
->
size
);
if
(
!*
(
char
**
)
param
->
data
)
{
ERR
(
"Out of memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
memcpy
(
*
(
char
**
)
param
->
data
,
object
->
data
,
object
->
size
);
break
;
case
D3DXPT_VERTEXSHADER
:
if
(
FAILED
(
hr
=
IDirect3DDevice9_CreateVertexShader
(
device
,
object
->
data
,
(
IDirect3DVertexShader9
**
)
param
->
data
)))
{
WARN
(
"Failed to create vertex shader.
\n
"
);
return
hr
;
}
break
;
case
D3DXPT_PIXELSHADER
:
if
(
FAILED
(
hr
=
IDirect3DDevice9_CreatePixelShader
(
device
,
object
->
data
,
(
IDirect3DPixelShader9
**
)
param
->
data
)))
{
WARN
(
"Failed to create pixel shader.
\n
"
);
return
hr
;
}
break
;
default:
break
;
}
return
D3D_OK
;
}
static
HRESULT
d3dx9_parse_resource
(
struct
d3dx9_base_effect
*
base
,
const
char
*
data
,
const
char
**
ptr
)
{
DWORD
technique_index
;
DWORD
index
,
state_index
,
usage
,
element_index
;
struct
d3dx_state
*
state
;
struct
d3dx_parameter
*
param
;
struct
d3dx_object
*
object
;
HRESULT
hr
=
E_FAIL
;
read_dword
(
ptr
,
&
technique_index
);
...
...
@@ -5022,21 +5065,26 @@ static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char *
state
=
&
pass
->
states
[
state_index
];
}
TRACE
(
"State operation %#x (%s).
\n
"
,
state
->
operation
,
state_table
[
state
->
operation
].
name
);
param
=
&
state
->
parameter
;
TRACE
(
"Using object id %u.
\n
"
,
param
->
object_id
);
object
=
&
base
->
objects
[
param
->
object_id
];
/*
* TODO: Do we need to create the shader/string here or later when we access them?
*/
switch
(
usage
)
{
case
0
:
TRACE
(
"usage 0: type %s
\n
"
,
debug_d3dxparameter_type
(
param
->
type
));
TRACE
(
"usage 0: class %s type %s.
\n
"
,
debug_d3dxparameter_class
(
param
->
class
),
debug_d3dxparameter_type
(
param
->
type
));
switch
(
param
->
type
)
{
case
D3DXPT_VERTEXSHADER
:
case
D3DXPT_PIXELSHADER
:
state
->
type
=
ST_CONSTANT
;
hr
=
d3dx9_copy_data
(
&
base
->
objects
[
param
->
object_id
],
ptr
);
if
(
FAILED
(
hr
=
d3dx9_copy_data
(
&
base
->
objects
[
param
->
object_id
],
ptr
)))
return
hr
;
if
(
object
->
data
)
hr
=
d3dx9_create_object
(
base
,
object
);
break
;
case
D3DXPT_BOOL
:
...
...
@@ -5153,11 +5201,13 @@ static HRESULT d3dx9_parse_effect(struct d3dx9_base_effect *base, const char *da
read_dword
(
&
ptr
,
&
id
);
TRACE
(
"Id: %u
\n
"
,
id
);
hr
=
d3dx9_copy_data
(
&
base
->
objects
[
id
],
&
ptr
);
if
(
hr
!=
D3D_OK
)
{
WARN
(
"Failed to parse data %u
\n
"
,
i
);
if
(
FAILED
(
hr
=
d3dx9_copy_data
(
&
base
->
objects
[
id
],
&
ptr
)))
goto
err_out
;
if
(
base
->
objects
[
id
].
data
)
{
if
(
FAILED
(
hr
=
d3dx9_create_object
(
base
,
&
base
->
objects
[
id
])))
goto
err_out
;
}
}
...
...
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