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
76c61cf5
Commit
76c61cf5
authored
Sep 17, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 17, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Add a separate function for texture initialization.
parent
75f005eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
36 deletions
+50
-36
d3d8_private.h
dlls/d3d8/d3d8_private.h
+3
-5
device.c
dlls/d3d8/device.c
+22
-30
texture.c
dlls/d3d8/texture.c
+25
-1
No files found.
dlls/d3d8/d3d8_private.h
View file @
76c61cf5
...
...
@@ -413,11 +413,6 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
/* ----------------- */
/*****************************************************************************
* Predeclare the interface implementation structures
*/
extern
const
IDirect3DTexture8Vtbl
Direct3DTexture8_Vtbl
DECLSPEC_HIDDEN
;
/*****************************************************************************
* IDirect3DTexture8 implementation structure
*/
struct
IDirect3DTexture8Impl
...
...
@@ -433,6 +428,9 @@ struct IDirect3DTexture8Impl
LPDIRECT3DDEVICE8
parentDevice
;
};
HRESULT
texture_init
(
IDirect3DTexture8Impl
*
texture
,
IDirect3DDevice8Impl
*
device
,
UINT
width
,
UINT
height
,
UINT
levels
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
)
DECLSPEC_HIDDEN
;
/* ----------------------- */
/* IDirect3DVolumeTexture8 */
/* ----------------------- */
...
...
dlls/d3d8/device.c
View file @
76c61cf5
...
...
@@ -654,44 +654,36 @@ static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3
wined3d_mutex_unlock
();
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateTexture
(
LPDIRECT3DDEVICE8
iface
,
UINT
Width
,
UINT
Height
,
UINT
Levels
,
DWORD
Usage
,
D3DFORMAT
Format
,
D3DPOOL
Pool
,
IDirect3DTexture8
**
ppTexture
)
{
IDirect3DTexture8Impl
*
object
;
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateTexture
(
IDirect3DDevice8
*
iface
,
UINT
width
,
UINT
height
,
UINT
levels
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
,
IDirect3DTexture8
**
texture
)
{
IDirect3DDevice8Impl
*
This
=
(
IDirect3DDevice8Impl
*
)
iface
;
HRESULT
hrc
=
D3D_OK
;
TRACE
(
"(%p) : W(%d) H(%d), Lvl(%d) d(%d), Fmt(%u), Pool(%d)
\n
"
,
This
,
Width
,
Height
,
Levels
,
Usage
,
Format
,
Pool
);
IDirect3DTexture8Impl
*
object
;
HRESULT
hr
;
/* Allocate the storage for the device */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirect3DTexture8Impl
)
);
TRACE
(
"iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.
\n
"
,
iface
,
width
,
height
,
levels
,
usage
,
format
,
pool
,
texture
);
if
(
NULL
==
object
)
{
FIXME
(
"Allocation of memory failed
\n
"
);
/* *ppTexture = NULL; */
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
if
(
!
object
)
{
ERR
(
"Failed to allocate texture memory.
\n
"
);
return
D3DERR_OUTOFVIDEOMEMORY
;
}
object
->
lpVtbl
=
&
Direct3DTexture8_Vtbl
;
object
->
ref
=
1
;
wined3d_mutex_lock
();
hrc
=
IWineD3DDevice_CreateTexture
(
This
->
WineD3DDevice
,
Width
,
Height
,
Levels
,
Usage
&
WINED3DUSAGE_MASK
,
wined3dformat_from_d3dformat
(
Format
),
Pool
,
&
object
->
wineD3DTexture
,
(
IUnknown
*
)
object
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hrc
))
{
/* free up object */
FIXME
(
"(%p) call to IWineD3DDevice_CreateTexture failed
\n
"
,
This
);
hr
=
texture_init
(
object
,
This
,
width
,
height
,
levels
,
usage
,
format
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize texture, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
/* *ppTexture = NULL; */
}
else
{
IUnknown_AddRef
(
iface
);
object
->
parentDevice
=
iface
;
*
ppTexture
=
(
LPDIRECT3DTEXTURE8
)
object
;
TRACE
(
"(%p) Created Texture %p, %p
\n
"
,
This
,
object
,
object
->
wineD3DTexture
);
}
return
hr
;
}
TRACE
(
"Created texture %p.
\n
"
,
object
);
*
texture
=
(
IDirect3DTexture8
*
)
object
;
return
hrc
;
return
D3D_OK
;
}
static
HRESULT
WINAPI
IDirect3DDevice8Impl_CreateVolumeTexture
(
IDirect3DDevice8
*
iface
,
...
...
dlls/d3d8/texture.c
View file @
76c61cf5
...
...
@@ -285,7 +285,7 @@ static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 ifac
return
hr
;
}
const
IDirect3DTexture8Vtbl
Direct3DTexture8_Vtbl
=
static
const
IDirect3DTexture8Vtbl
Direct3DTexture8_Vtbl
=
{
/* IUnknown */
IDirect3DTexture8Impl_QueryInterface
,
...
...
@@ -311,3 +311,27 @@ const IDirect3DTexture8Vtbl Direct3DTexture8_Vtbl =
IDirect3DTexture8Impl_UnlockRect
,
IDirect3DTexture8Impl_AddDirtyRect
};
HRESULT
texture_init
(
IDirect3DTexture8Impl
*
texture
,
IDirect3DDevice8Impl
*
device
,
UINT
width
,
UINT
height
,
UINT
levels
,
DWORD
usage
,
D3DFORMAT
format
,
D3DPOOL
pool
)
{
HRESULT
hr
;
texture
->
lpVtbl
=
&
Direct3DTexture8_Vtbl
;
texture
->
ref
=
1
;
wined3d_mutex_lock
();
hr
=
IWineD3DDevice_CreateTexture
(
device
->
WineD3DDevice
,
width
,
height
,
levels
,
usage
&
WINED3DUSAGE_MASK
,
wined3dformat_from_d3dformat
(
format
),
pool
,
&
texture
->
wineD3DTexture
,
(
IUnknown
*
)
texture
);
wined3d_mutex_unlock
();
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create wined3d texture, hr %#x.
\n
"
,
hr
);
return
hr
;
}
texture
->
parentDevice
=
(
IDirect3DDevice8
*
)
device
;
IDirect3DDevice8_AddRef
(
texture
->
parentDevice
);
return
D3D_OK
;
}
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