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
56545447
Commit
56545447
authored
May 29, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
May 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add device resources from resource_init().
This is consistent with removing them from resource_cleanup().
parent
5e0f5416
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
32 deletions
+19
-32
device.c
dlls/wined3d/device.c
+12
-30
resource.c
dlls/wined3d/resource.c
+5
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
No files found.
dlls/wined3d/device.c
View file @
56545447
...
...
@@ -51,9 +51,6 @@ const WINED3DLIGHT WINED3D_default_light = {
0
.
0
/* Phi */
};
/* static function declarations */
static
void
IWineD3DDeviceImpl_AddResource
(
IWineD3DDevice
*
iface
,
IWineD3DResource
*
resource
);
/**********************************************************
* Global variable / Constants follow
**********************************************************/
...
...
@@ -458,7 +455,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
FIXME
(
"Ignoring access flags (pool)
\n
"
);
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_BUFFER
,
This
,
desc
->
byte_width
,
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_BUFFER
,
This
,
desc
->
byte_width
,
desc
->
usage
,
format_desc
,
WINED3DPOOL_MANAGED
,
parent
);
if
(
FAILED
(
hr
))
{
...
...
@@ -470,8 +467,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface,
TRACE
(
"Created resource %p
\n
"
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
TRACE
(
"size %#x, usage=%#x, format %s, memory @ %p, iface @ %p
\n
"
,
object
->
resource
.
size
,
object
->
resource
.
usage
,
debug_d3dformat
(
object
->
resource
.
format_desc
->
format
),
object
->
resource
.
allocatedMemory
,
object
);
...
...
@@ -536,7 +531,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
}
object
->
vtbl
=
&
wined3d_buffer_vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_BUFFER
,
This
,
Size
,
Usage
,
format_desc
,
Pool
,
parent
);
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_BUFFER
,
This
,
Size
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -548,8 +543,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
TRACE
(
"(%p) : Size=%d, Usage=0x%08x, FVF=%x, Pool=%d - Memory@%p, Iface@%p
\n
"
,
This
,
Size
,
Usage
,
FVF
,
Pool
,
object
->
resource
.
allocatedMemory
,
object
);
*
ppVertexBuffer
=
(
IWineD3DBuffer
*
)
object
;
...
...
@@ -603,7 +596,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
}
object
->
vtbl
=
&
wined3d_buffer_vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_BUFFER
,
This
,
Length
,
Usage
,
format_desc
,
Pool
,
parent
);
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_BUFFER
,
This
,
Length
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -615,8 +608,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
if
(
Pool
!=
WINED3DPOOL_SYSTEMMEM
&&
!
(
Usage
&
WINED3DUSAGE_DYNAMIC
)
&&
GL_SUPPORT
(
ARB_VERTEX_BUFFER_OBJECT
))
{
object
->
flags
|=
WINED3D_BUFFER_CREATEBO
;
}
...
...
@@ -979,7 +970,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface,
return
WINED3DERR_INVALIDCALL
;
}
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_SURFACE
,
This
,
Size
,
Usage
,
glDesc
,
Pool
,
parent
);
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_SURFACE
,
This
,
Size
,
Usage
,
glDesc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -990,8 +981,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface,
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
*
ppSurface
=
(
IWineD3DSurface
*
)
object
;
/* "Standalone" surface */
...
...
@@ -1170,7 +1159,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
}
object
->
lpVtbl
=
&
IWineD3DTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_TEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_TEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1181,8 +1170,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
*
ppTexture
=
(
IWineD3DTexture
*
)
object
;
basetexture_init
(
&
object
->
baseTexture
,
Levels
,
Usage
);
...
...
@@ -1329,7 +1316,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
}
object
->
lpVtbl
=
&
IWineD3DVolumeTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VOLUMETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
hr
=
resource_init
((
IWineD3DResource
*
)
object
,
WINED3DRTYPE_VOLUMETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1340,8 +1328,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
basetexture_init
(
&
object
->
baseTexture
,
Levels
,
Usage
);
TRACE
(
"(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%d), Fmt(%u,%s), Pool(%s)
\n
"
,
This
,
Width
,
Height
,
...
...
@@ -1418,7 +1404,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
}
object
->
lpVtbl
=
&
IWineD3DVolume_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_VOLUME
,
This
,
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_VOLUME
,
This
,
Width
*
Height
*
Depth
*
format_desc
->
byte_count
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1430,8 +1416,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
*
ppVolume
=
(
IWineD3DVolume
*
)
object
;
TRACE
(
"(%p) : W(%d) H(%d) D(%d), Usage(%d), Fmt(%u,%s), Pool(%s)
\n
"
,
This
,
Width
,
Height
,
...
...
@@ -1508,7 +1492,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
}
object
->
lpVtbl
=
&
IWineD3DCubeTexture_Vtbl
;
hr
=
resource_init
(
&
object
->
resource
,
WINED3DRTYPE_CUBETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
hr
=
resource_init
(
(
IWineD3DResource
*
)
object
,
WINED3DRTYPE_CUBETEXTURE
,
This
,
0
,
Usage
,
format_desc
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize resource, returning %#x
\n
"
,
hr
);
...
...
@@ -1519,8 +1503,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
TRACE
(
"(%p) : Created resource %p
\n
"
,
This
,
object
);
IWineD3DDeviceImpl_AddResource
(
iface
,
(
IWineD3DResource
*
)
object
);
basetexture_init
(
&
object
->
baseTexture
,
Levels
,
Usage
);
TRACE
(
"(%p) Create Cube Texture
\n
"
,
This
);
...
...
@@ -7779,10 +7761,10 @@ static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT i
* any handles to other resource held by the caller must be closed
* (e.g. a texture should release all held surfaces because telling the device that it's been released.)
*****************************************************/
static
void
IWineD3DDeviceImpl_AddResource
(
IWineD3DDevice
*
iface
,
IWineD3DResource
*
resource
){
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
void
device_resource_add
(
IWineD3DDeviceImpl
*
This
,
IWineD3DResource
*
resource
)
{
TRACE
(
"(%p) : Adding resource %p
\n
"
,
This
,
resource
);
TRACE
(
"(%p) : Adding Resource %p
\n
"
,
This
,
resource
);
list_add_head
(
&
This
->
resources
,
&
((
IWineD3DResourceImpl
*
)
resource
)
->
resource
.
resource_list_entry
);
}
...
...
dlls/wined3d/resource.c
View file @
56545447
...
...
@@ -26,10 +26,12 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d
);
HRESULT
resource_init
(
struct
IWineD3DResourceClass
*
resour
ce
,
WINED3DRESOURCETYPE
resource_type
,
HRESULT
resource_init
(
IWineD3DResource
*
ifa
ce
,
WINED3DRESOURCETYPE
resource_type
,
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
const
struct
GlPixelFormatDesc
*
format_desc
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
struct
IWineD3DResourceClass
*
resource
=
&
((
IWineD3DResourceImpl
*
)
iface
)
->
resource
;
resource
->
wineD3DDevice
=
device
;
resource
->
parent
=
parent
;
resource
->
resourceType
=
resource_type
;
...
...
@@ -68,6 +70,8 @@ HRESULT resource_init(struct IWineD3DResourceClass *resource, WINED3DRESOURCETYP
WineD3DAdapterChangeGLRam
(
device
,
size
);
}
device_resource_add
(
device
,
iface
);
return
WINED3D_OK
;
}
...
...
dlls/wined3d/wined3d_private.h
View file @
56545447
...
...
@@ -1578,6 +1578,7 @@ struct IWineD3DDeviceImpl
extern
const
IWineD3DDeviceVtbl
IWineD3DDevice_Vtbl
;
void
device_resource_add
(
IWineD3DDeviceImpl
*
This
,
IWineD3DResource
*
resource
);
void
device_resource_released
(
IWineD3DDeviceImpl
*
This
,
IWineD3DResource
*
resource
);
void
device_stream_info_from_declaration
(
IWineD3DDeviceImpl
*
This
,
BOOL
use_vshader
,
struct
wined3d_stream_info
*
stream_info
,
BOOL
*
fixup
);
...
...
@@ -1649,7 +1650,7 @@ HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **parent);
DWORD
resource_get_priority
(
IWineD3DResource
*
iface
);
HRESULT
resource_get_private_data
(
IWineD3DResource
*
iface
,
REFGUID
guid
,
void
*
data
,
DWORD
*
data_size
);
HRESULT
resource_init
(
struct
IWineD3DResourceClass
*
resour
ce
,
WINED3DRESOURCETYPE
resource_type
,
HRESULT
resource_init
(
IWineD3DResource
*
ifa
ce
,
WINED3DRESOURCETYPE
resource_type
,
IWineD3DDeviceImpl
*
device
,
UINT
size
,
DWORD
usage
,
const
struct
GlPixelFormatDesc
*
format_desc
,
WINED3DPOOL
pool
,
IUnknown
*
parent
);
WINED3DRESOURCETYPE
resource_get_type
(
IWineD3DResource
*
iface
);
...
...
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