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
0241fefa
Commit
0241fefa
authored
Sep 23, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a separate function for vertex declaration initialization.
parent
cc68900d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
47 deletions
+61
-47
d3d9_private.h
dlls/d3d9/d3d9_private.h
+2
-2
device.c
dlls/d3d9/device.c
+36
-0
vertexdeclaration.c
dlls/d3d9/vertexdeclaration.c
+23
-45
No files found.
dlls/d3d9/d3d9_private.h
View file @
0241fefa
...
...
@@ -202,8 +202,6 @@ extern HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(IDirect3DDevice9Ex *
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_BeginStateBlock
(
IDirect3DDevice9Ex
*
iface
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_EndStateBlock
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DStateBlock9
**
ppSB
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
const
D3DVERTEXELEMENT9
*
pVertexElements
,
IDirect3DVertexDeclaration9
**
ppDecl
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_SetVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
IDirect3DVertexDeclaration9
*
pDecl
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirect3DDevice9Impl_GetVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
...
...
@@ -508,6 +506,8 @@ typedef struct IDirect3DVertexDeclaration9Impl {
}
IDirect3DVertexDeclaration9Impl
;
void
IDirect3DVertexDeclaration9Impl_Destroy
(
LPDIRECT3DVERTEXDECLARATION9
iface
)
DECLSPEC_HIDDEN
;
HRESULT
vertexdeclaration_init
(
IDirect3DVertexDeclaration9Impl
*
declaration
,
IDirect3DDevice9Impl
*
device
,
const
D3DVERTEXELEMENT9
*
elements
)
DECLSPEC_HIDDEN
;
/* ---------------------- */
/* IDirect3DVertexShader9 */
...
...
dlls/d3d9/device.c
View file @
0241fefa
...
...
@@ -1678,6 +1678,42 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9EX
return
hr
;
}
static
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
const
D3DVERTEXELEMENT9
*
elements
,
IDirect3DVertexDeclaration9
**
declaration
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DVertexDeclaration9Impl
*
object
;
HRESULT
hr
;
TRACE
(
"iface %p, elements %p, declaration %p.
\n
"
,
iface
,
elements
,
declaration
);
if
(
!
declaration
)
{
WARN
(
"Caller passed a NULL declaration, returning D3DERR_INVALIDCALL.
\n
"
);
return
D3DERR_INVALIDCALL
;
}
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate vertex declaration memory.
\n
"
);
return
E_OUTOFMEMORY
;
}
hr
=
vertexdeclaration_init
(
object
,
This
,
elements
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize vertex declaration, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
return
hr
;
}
TRACE
(
"Created vertex declaration %p.
\n
"
,
object
);
*
declaration
=
(
IDirect3DVertexDeclaration9
*
)
object
;
return
D3D_OK
;
}
static
IDirect3DVertexDeclaration9
*
getConvertedDecl
(
IDirect3DDevice9Impl
*
This
,
DWORD
fvf
)
{
HRESULT
hr
;
D3DVERTEXELEMENT9
*
elements
=
NULL
;
...
...
dlls/d3d9/vertexdeclaration.c
View file @
0241fefa
...
...
@@ -349,72 +349,50 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elem
return
D3D_OK
;
}
/* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */
HRESULT
WINAPI
IDirect3DDevice9Impl_CreateVertexDeclaration
(
IDirect3DDevice9Ex
*
iface
,
const
D3DVERTEXELEMENT9
*
pVertexElements
,
IDirect3DVertexDeclaration9
**
ppDecl
)
HRESULT
vertexdeclaration_init
(
IDirect3DVertexDeclaration9Impl
*
declaration
,
IDirect3DDevice9Impl
*
device
,
const
D3DVERTEXELEMENT9
*
elements
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
IDirect3DVertexDeclaration9Impl
*
object
=
NULL
;
WINED3DVERTEXELEMENT
*
wined3d_elements
;
WINED3DVERTEXELEMENT
*
wined3d_elements
;
UINT
wined3d_element_count
;
UINT
element_count
;
HRESULT
hr
;
TRACE
(
"(%p) : Relay
\n
"
,
iface
);
if
(
NULL
==
ppDecl
)
{
WARN
(
"(%p) : Caller passed NULL As ppDecl, returning D3DERR_INVALIDCALL
\n
"
,
This
);
return
D3DERR_INVALIDCALL
;
}
hr
=
convert_to_wined3d_declaration
(
pVertexElements
,
&
wined3d_elements
,
&
wined3d_element_count
);
hr
=
convert_to_wined3d_declaration
(
elements
,
&
wined3d_elements
,
&
wined3d_element_count
);
if
(
FAILED
(
hr
))
{
WARN
(
"
(%p) : Error parsing vertex declaration
\n
"
,
This
);
WARN
(
"
Failed to create wined3d vertex declaration elements, hr %#x.
\n
"
,
hr
);
return
hr
;
}
/* Allocate the storage for the device */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DVertexDeclaration9Impl
));
if
(
NULL
==
object
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_elements
);
FIXME
(
"Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY
\n
"
);
return
D3DERR_OUTOFVIDEOMEMORY
;
}
object
->
lpVtbl
=
&
Direct3DVertexDeclaration9_Vtbl
;
object
->
ref
=
0
;
declaration
->
lpVtbl
=
&
Direct3DVertexDeclaration9_Vtbl
;
declaration
->
ref
=
1
;
element_count
=
wined3d_element_count
+
1
;
object
->
elements
=
HeapAlloc
(
GetProcessHeap
(),
0
,
element_count
*
sizeof
(
D3DVERTEXELEMENT9
));
if
(
!
object
->
elements
)
{
declaration
->
elements
=
HeapAlloc
(
GetProcessHeap
(),
0
,
element_count
*
sizeof
(
*
declaration
->
elements
));
if
(
!
declaration
->
elements
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_elements
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
ERR
(
"Memory allocation failed
\n
"
);
ERR
(
"Failed to allocate vertex declaration elements memory.
\n
"
);
return
D3DERR_OUTOFVIDEOMEMORY
;
}
CopyMemory
(
object
->
elements
,
pVertexElements
,
element_count
*
sizeof
(
D3DVERTEXELEMENT9
));
object
->
element_count
=
element_count
;
memcpy
(
declaration
->
elements
,
elements
,
element_count
*
sizeof
(
*
elements
));
declaration
->
element_count
=
element_count
;
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreateVertexDeclaration
(
This
->
WineD3DDevice
,
&
object
->
wineD3DVertexDeclaration
,
(
IUnknown
*
)
object
,
wined3d_elements
,
wined3d_element_count
);
hr
=
IWineD3DDevice_CreateVertexDeclaration
(
device
->
WineD3DDevice
,
&
declaration
->
wineD3DVertexDeclaration
,
(
IUnknown
*
)
declaration
,
wined3d_elements
,
wined3d_element_count
);
wined3d_mutex_unlock
();
HeapFree
(
GetProcessHeap
(),
0
,
wined3d_elements
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d vertex declaration, hr %#x.
\n
"
,
hr
);
return
hr
;
}
if
(
FAILED
(
hr
))
{
declaration
->
parentDevice
=
(
IDirect3DDevice9Ex
*
)
device
;
IDirect3DDevice9Ex_AddRef
(
declaration
->
parentDevice
);
/* free up object */
WARN
(
"(%p) call to IWineD3DDevice_CreateVertexDeclaration failed
\n
"
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
object
->
elements
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
}
else
{
object
->
parentDevice
=
iface
;
*
ppDecl
=
(
LPDIRECT3DVERTEXDECLARATION9
)
object
;
IDirect3DVertexDeclaration9_AddRef
(
*
ppDecl
);
TRACE
(
"(%p) : Created vertex declaration %p
\n
"
,
This
,
object
);
}
return
hr
;
return
D3D_OK
;
}
HRESULT
WINAPI
IDirect3DDevice9Impl_SetVertexDeclaration
(
LPDIRECT3DDEVICE9EX
iface
,
IDirect3DVertexDeclaration9
*
pDecl
)
{
...
...
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