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
83b3d4f2
Commit
83b3d4f2
authored
Sep 16, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move vtable initialization to the texture init functions.
parent
b1ede91b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
214 additions
and
219 deletions
+214
-219
cubetexture.c
dlls/wined3d/cubetexture.c
+119
-117
device.c
dlls/wined3d/device.c
+0
-4
texture.c
dlls/wined3d/texture.c
+0
-0
volumetexture.c
dlls/wined3d/volumetexture.c
+95
-92
wined3d_private.h
dlls/wined3d/wined3d_private.h
+0
-6
No files found.
dlls/wined3d/cubetexture.c
View file @
83b3d4f2
...
...
@@ -5,6 +5,7 @@
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -137,121 +138,6 @@ static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This)
basetexture_cleanup
((
IWineD3DBaseTexture
*
)
This
);
}
HRESULT
cubetexture_init
(
IWineD3DCubeTextureImpl
*
texture
,
UINT
edge_length
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
format
,
gl_info
);
UINT
pow2_edge_length
;
unsigned
int
i
,
j
;
UINT
tmp_w
;
HRESULT
hr
;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if
(
WINED3DFMT_UNKNOWN
>=
format
)
{
WARN
(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
GL_SUPPORT
(
ARB_TEXTURE_CUBE_MAP
)
&&
pool
!=
WINED3DPOOL_SCRATCH
)
{
WARN
(
"(%p) : Tried to create not supported cube texture.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
/* Calculate levels for mip mapping */
if
(
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
{
if
(
!
GL_SUPPORT
(
SGIS_GENERATE_MIPMAP
))
{
WARN
(
"No mipmap generation support, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
levels
>
1
)
{
WARN
(
"D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
levels
=
1
;
}
else
if
(
!
levels
)
{
levels
=
wined3d_log2i
(
edge_length
)
+
1
;
TRACE
(
"Calculated levels = %u.
\n
"
,
levels
);
}
hr
=
basetexture_init
((
IWineD3DBaseTextureImpl
*
)
texture
,
levels
,
WINED3DRTYPE_CUBETEXTURE
,
device
,
0
,
usage
,
format_desc
,
pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize basetexture, returning %#x
\n
"
,
hr
);
return
hr
;
}
/* Find the nearest pow2 match. */
pow2_edge_length
=
1
;
while
(
pow2_edge_length
<
edge_length
)
pow2_edge_length
<<=
1
;
if
(
GL_SUPPORT
(
ARB_TEXTURE_NON_POWER_OF_TWO
)
||
(
edge_length
==
pow2_edge_length
))
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
}
else
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix_identity
=
FALSE
;
}
/* Generate all the surfaces. */
tmp_w
=
edge_length
;
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
levels
;
++
i
)
{
/* Create the 6 faces. */
for
(
j
=
0
;
j
<
6
;
++
j
)
{
static
const
GLenum
cube_targets
[
6
]
=
{
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
,
};
hr
=
IWineD3DDeviceParent_CreateSurface
(
device
->
device_parent
,
parent
,
tmp_w
,
tmp_w
,
format
,
usage
,
pool
,
i
/* Level */
,
j
,
&
texture
->
surfaces
[
j
][
i
]);
if
(
FAILED
(
hr
))
{
FIXME
(
"(%p) Failed to create surface, hr %#x.
\n
"
,
texture
,
hr
);
texture
->
surfaces
[
j
][
i
]
=
NULL
;
cubetexture_cleanup
(
texture
);
return
hr
;
}
IWineD3DSurface_SetContainer
(
texture
->
surfaces
[
j
][
i
],
(
IWineD3DBase
*
)
texture
);
TRACE
(
"Created surface level %u @ %p.
\n
"
,
i
,
texture
->
surfaces
[
j
][
i
]);
surface_set_texture_target
(
texture
->
surfaces
[
j
][
i
],
cube_targets
[
j
]);
}
tmp_w
=
max
(
1
,
tmp_w
>>
1
);
}
texture
->
baseTexture
.
internal_preload
=
cubetexture_internal_preload
;
return
WINED3D_OK
;
}
#undef GLINFO_LOCATION
/* *******************************************
...
...
@@ -519,8 +405,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture
return
hr
;
}
const
IWineD3DCubeTextureVtbl
IWineD3DCubeTexture_Vtbl
=
static
const
IWineD3DCubeTextureVtbl
IWineD3DCubeTexture_Vtbl
=
{
/* IUnknown */
IWineD3DCubeTextureImpl_QueryInterface
,
...
...
@@ -557,3 +442,120 @@ const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
IWineD3DCubeTextureImpl_UnlockRect
,
IWineD3DCubeTextureImpl_AddDirtyRect
};
HRESULT
cubetexture_init
(
IWineD3DCubeTextureImpl
*
texture
,
UINT
edge_length
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
format
,
gl_info
);
UINT
pow2_edge_length
;
unsigned
int
i
,
j
;
UINT
tmp_w
;
HRESULT
hr
;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if
(
WINED3DFMT_UNKNOWN
>=
format
)
{
WARN
(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
gl_info
->
supported
[
ARB_TEXTURE_CUBE_MAP
]
&&
pool
!=
WINED3DPOOL_SCRATCH
)
{
WARN
(
"(%p) : Tried to create not supported cube texture.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
/* Calculate levels for mip mapping */
if
(
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
{
if
(
!
gl_info
->
supported
[
SGIS_GENERATE_MIPMAP
])
{
WARN
(
"No mipmap generation support, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
levels
>
1
)
{
WARN
(
"D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
levels
=
1
;
}
else
if
(
!
levels
)
{
levels
=
wined3d_log2i
(
edge_length
)
+
1
;
TRACE
(
"Calculated levels = %u.
\n
"
,
levels
);
}
texture
->
lpVtbl
=
&
IWineD3DCubeTexture_Vtbl
;
hr
=
basetexture_init
((
IWineD3DBaseTextureImpl
*
)
texture
,
levels
,
WINED3DRTYPE_CUBETEXTURE
,
device
,
0
,
usage
,
format_desc
,
pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize basetexture, returning %#x
\n
"
,
hr
);
return
hr
;
}
/* Find the nearest pow2 match. */
pow2_edge_length
=
1
;
while
(
pow2_edge_length
<
edge_length
)
pow2_edge_length
<<=
1
;
if
(
gl_info
->
supported
[
ARB_TEXTURE_NON_POWER_OF_TWO
]
||
(
edge_length
==
pow2_edge_length
))
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
}
else
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
((
float
)
edge_length
)
/
((
float
)
pow2_edge_length
);
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix_identity
=
FALSE
;
}
/* Generate all the surfaces. */
tmp_w
=
edge_length
;
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
levels
;
++
i
)
{
/* Create the 6 faces. */
for
(
j
=
0
;
j
<
6
;
++
j
)
{
static
const
GLenum
cube_targets
[
6
]
=
{
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
,
};
hr
=
IWineD3DDeviceParent_CreateSurface
(
device
->
device_parent
,
parent
,
tmp_w
,
tmp_w
,
format
,
usage
,
pool
,
i
/* Level */
,
j
,
&
texture
->
surfaces
[
j
][
i
]);
if
(
FAILED
(
hr
))
{
FIXME
(
"(%p) Failed to create surface, hr %#x.
\n
"
,
texture
,
hr
);
texture
->
surfaces
[
j
][
i
]
=
NULL
;
cubetexture_cleanup
(
texture
);
return
hr
;
}
IWineD3DSurface_SetContainer
(
texture
->
surfaces
[
j
][
i
],
(
IWineD3DBase
*
)
texture
);
TRACE
(
"Created surface level %u @ %p.
\n
"
,
i
,
texture
->
surfaces
[
j
][
i
]);
surface_set_texture_target
(
texture
->
surfaces
[
j
][
i
],
cube_targets
[
j
]);
}
tmp_w
=
max
(
1
,
tmp_w
>>
1
);
}
texture
->
baseTexture
.
internal_preload
=
cubetexture_internal_preload
;
return
WINED3D_OK
;
}
dlls/wined3d/device.c
View file @
83b3d4f2
...
...
@@ -983,8 +983,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
return
WINED3DERR_OUTOFVIDEOMEMORY
;
}
object
->
lpVtbl
=
&
IWineD3DTexture_Vtbl
;
hr
=
texture_init
(
object
,
Width
,
Height
,
Levels
,
This
,
Usage
,
Format
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1020,7 +1018,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
return
WINED3DERR_OUTOFVIDEOMEMORY
;
}
object
->
lpVtbl
=
&
IWineD3DVolumeTexture_Vtbl
;
hr
=
volumetexture_init
(
object
,
Width
,
Height
,
Depth
,
Levels
,
This
,
Usage
,
Format
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1085,7 +1082,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
return
WINED3DERR_OUTOFVIDEOMEMORY
;
}
object
->
lpVtbl
=
&
IWineD3DCubeTexture_Vtbl
;
hr
=
cubetexture_init
(
object
,
EdgeLength
,
Levels
,
This
,
Usage
,
Format
,
Pool
,
parent
);
if
(
FAILED
(
hr
))
{
...
...
dlls/wined3d/texture.c
View file @
83b3d4f2
This diff is collapsed.
Click to expand it.
dlls/wined3d/volumetexture.c
View file @
83b3d4f2
...
...
@@ -4,6 +4,7 @@
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -96,97 +97,6 @@ static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This)
basetexture_cleanup
((
IWineD3DBaseTexture
*
)
This
);
}
HRESULT
volumetexture_init
(
IWineD3DVolumeTextureImpl
*
texture
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
format
,
gl_info
);
UINT
tmp_w
,
tmp_h
,
tmp_d
;
unsigned
int
i
;
HRESULT
hr
;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if
(
WINED3DFMT_UNKNOWN
>=
format
)
{
WARN
(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
GL_SUPPORT
(
EXT_TEXTURE3D
))
{
WARN
(
"(%p) : Texture cannot be created - no volume texture support.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
/* Calculate levels for mip mapping. */
if
(
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
{
if
(
!
GL_SUPPORT
(
SGIS_GENERATE_MIPMAP
))
{
WARN
(
"No mipmap generation support, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
levels
>
1
)
{
WARN
(
"D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
levels
=
1
;
}
else
if
(
!
levels
)
{
levels
=
wined3d_log2i
(
max
(
max
(
width
,
height
),
depth
))
+
1
;
TRACE
(
"Calculated levels = %u.
\n
"
,
levels
);
}
hr
=
basetexture_init
((
IWineD3DBaseTextureImpl
*
)
texture
,
levels
,
WINED3DRTYPE_VOLUMETEXTURE
,
device
,
0
,
usage
,
format_desc
,
pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize basetexture, returning %#x.
\n
"
,
hr
);
return
hr
;
}
/* Is NP2 support for volumes needed? */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
/* Generate all the surfaces. */
tmp_w
=
width
;
tmp_h
=
height
;
tmp_d
=
depth
;
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
levels
;
++
i
)
{
/* Create the volume. */
hr
=
IWineD3DDeviceParent_CreateVolume
(
device
->
device_parent
,
parent
,
tmp_w
,
tmp_h
,
tmp_d
,
format
,
pool
,
usage
,
&
texture
->
volumes
[
i
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Creating a volume for the volume texture failed, hr %#x.
\n
"
,
hr
);
texture
->
volumes
[
i
]
=
NULL
;
volumetexture_cleanup
(
texture
);
return
hr
;
}
/* Set its container to this texture. */
IWineD3DVolume_SetContainer
(
texture
->
volumes
[
i
],
(
IWineD3DBase
*
)
texture
);
/* Calculate the next mipmap level. */
tmp_w
=
max
(
1
,
tmp_w
>>
1
);
tmp_h
=
max
(
1
,
tmp_h
>>
1
);
tmp_d
=
max
(
1
,
tmp_d
>>
1
);
}
texture
->
baseTexture
.
internal_preload
=
volumetexture_internal_preload
;
return
WINED3D_OK
;
}
#undef GLINFO_LOCATION
/* *******************************************
...
...
@@ -415,7 +325,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTextur
return
WINED3D_OK
;
}
const
IWineD3DVolumeTextureVtbl
IWineD3DVolumeTexture_Vtbl
=
static
const
IWineD3DVolumeTextureVtbl
IWineD3DVolumeTexture_Vtbl
=
{
/* IUnknown */
IWineD3DVolumeTextureImpl_QueryInterface
,
...
...
@@ -453,3 +363,96 @@ const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
IWineD3DVolumeTextureImpl_UnlockBox
,
IWineD3DVolumeTextureImpl_AddDirtyBox
};
HRESULT
volumetexture_init
(
IWineD3DVolumeTextureImpl
*
texture
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
GlPixelFormatDesc
*
format_desc
=
getFormatDescEntry
(
format
,
gl_info
);
UINT
tmp_w
,
tmp_h
,
tmp_d
;
unsigned
int
i
;
HRESULT
hr
;
/* TODO: It should only be possible to create textures for formats
* that are reported as supported. */
if
(
WINED3DFMT_UNKNOWN
>=
format
)
{
WARN
(
"(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
gl_info
->
supported
[
EXT_TEXTURE3D
])
{
WARN
(
"(%p) : Texture cannot be created - no volume texture support.
\n
"
,
texture
);
return
WINED3DERR_INVALIDCALL
;
}
/* Calculate levels for mip mapping. */
if
(
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
{
if
(
!
gl_info
->
supported
[
SGIS_GENERATE_MIPMAP
])
{
WARN
(
"No mipmap generation support, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
levels
>
1
)
{
WARN
(
"D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
levels
=
1
;
}
else
if
(
!
levels
)
{
levels
=
wined3d_log2i
(
max
(
max
(
width
,
height
),
depth
))
+
1
;
TRACE
(
"Calculated levels = %u.
\n
"
,
levels
);
}
texture
->
lpVtbl
=
&
IWineD3DVolumeTexture_Vtbl
;
hr
=
basetexture_init
((
IWineD3DBaseTextureImpl
*
)
texture
,
levels
,
WINED3DRTYPE_VOLUMETEXTURE
,
device
,
0
,
usage
,
format_desc
,
pool
,
parent
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize basetexture, returning %#x.
\n
"
,
hr
);
return
hr
;
}
/* Is NP2 support for volumes needed? */
texture
->
baseTexture
.
pow2Matrix
[
0
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
5
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
10
]
=
1
.
0
f
;
texture
->
baseTexture
.
pow2Matrix
[
15
]
=
1
.
0
f
;
/* Generate all the surfaces. */
tmp_w
=
width
;
tmp_h
=
height
;
tmp_d
=
depth
;
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
levels
;
++
i
)
{
/* Create the volume. */
hr
=
IWineD3DDeviceParent_CreateVolume
(
device
->
device_parent
,
parent
,
tmp_w
,
tmp_h
,
tmp_d
,
format
,
pool
,
usage
,
&
texture
->
volumes
[
i
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Creating a volume for the volume texture failed, hr %#x.
\n
"
,
hr
);
texture
->
volumes
[
i
]
=
NULL
;
volumetexture_cleanup
(
texture
);
return
hr
;
}
/* Set its container to this texture. */
IWineD3DVolume_SetContainer
(
texture
->
volumes
[
i
],
(
IWineD3DBase
*
)
texture
);
/* Calculate the next mipmap level. */
tmp_w
=
max
(
1
,
tmp_w
>>
1
);
tmp_h
=
max
(
1
,
tmp_h
>>
1
);
tmp_d
=
max
(
1
,
tmp_d
>>
1
);
}
texture
->
baseTexture
.
internal_preload
=
volumetexture_internal_preload
;
return
WINED3D_OK
;
}
dlls/wined3d/wined3d_private.h
View file @
83b3d4f2
...
...
@@ -1825,8 +1825,6 @@ typedef struct IWineD3DTextureImpl
}
IWineD3DTextureImpl
;
extern
const
IWineD3DTextureVtbl
IWineD3DTexture_Vtbl
DECLSPEC_HIDDEN
;
HRESULT
texture_init
(
IWineD3DTextureImpl
*
texture
,
UINT
width
,
UINT
height
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
DECLSPEC_HIDDEN
;
...
...
@@ -1844,8 +1842,6 @@ typedef struct IWineD3DCubeTextureImpl
IWineD3DSurface
*
surfaces
[
6
][
MAX_MIP_LEVELS
];
}
IWineD3DCubeTextureImpl
;
extern
const
IWineD3DCubeTextureVtbl
IWineD3DCubeTexture_Vtbl
DECLSPEC_HIDDEN
;
HRESULT
cubetexture_init
(
IWineD3DCubeTextureImpl
*
texture
,
UINT
edge_length
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
DECLSPEC_HIDDEN
;
...
...
@@ -1895,8 +1891,6 @@ typedef struct IWineD3DVolumeTextureImpl
IWineD3DVolume
*
volumes
[
MAX_MIP_LEVELS
];
}
IWineD3DVolumeTextureImpl
;
extern
const
IWineD3DVolumeTextureVtbl
IWineD3DVolumeTexture_Vtbl
DECLSPEC_HIDDEN
;
HRESULT
volumetexture_init
(
IWineD3DVolumeTextureImpl
*
texture
,
UINT
width
,
UINT
height
,
UINT
depth
,
UINT
levels
,
IWineD3DDeviceImpl
*
device
,
DWORD
usage
,
WINED3DFORMAT
format
,
WINED3DPOOL
pool
,
IUnknown
*
parent
)
DECLSPEC_HIDDEN
;
...
...
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