Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
3d452ed9
Commit
3d452ed9
authored
Nov 12, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Create wined3d textures before ddraw surfaces.
parent
80dbeb96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
40 deletions
+31
-40
ddraw.c
dlls/ddraw/ddraw.c
+9
-26
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-1
surface.c
dlls/ddraw/surface.c
+20
-13
No files found.
dlls/ddraw/ddraw.c
View file @
3d452ed9
...
@@ -3116,8 +3116,15 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
...
@@ -3116,8 +3116,15 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
}
}
}
}
/* Create the first surface */
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
)
if
(
FAILED
(
hr
=
ddraw_create_surface
(
ddraw
,
&
desc2
,
flags
,
&
object
,
version
)))
{
if
(
FAILED
(
hr
=
ddraw_surface_create_texture
(
ddraw
,
&
desc2
,
version
,
flags
,
&
object
)))
{
WARN
(
"Failed to create texture, hr %#x.
\n
"
,
hr
);
return
hr
;
}
}
else
if
(
FAILED
(
hr
=
ddraw_create_surface
(
ddraw
,
&
desc2
,
flags
,
&
object
,
version
)))
{
{
WARN
(
"ddraw_create_surface failed, hr %#x.
\n
"
,
hr
);
WARN
(
"ddraw_create_surface failed, hr %#x.
\n
"
,
hr
);
return
hr
;
return
hr
;
...
@@ -3168,22 +3175,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
...
@@ -3168,22 +3175,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
}
}
}
}
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
)
{
hr
=
ddraw_surface_create_texture
(
object
,
flags
);
if
(
FAILED
(
hr
))
{
if
(
version
==
7
)
IDirectDrawSurface7_Release
(
&
object
->
IDirectDrawSurface7_iface
);
else
if
(
version
==
4
)
IDirectDrawSurface4_Release
(
&
object
->
IDirectDrawSurface4_iface
);
else
IDirectDrawSurface_Release
(
&
object
->
IDirectDrawSurface_iface
);
return
hr
;
}
}
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
ddraw
->
primary
=
object
;
ddraw
->
primary
=
object
;
...
@@ -5160,13 +5151,6 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
...
@@ -5160,13 +5151,6 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
TRACE
(
"device_parent %p, container_parent %p, wined3d_desc %p, sub_resource_idx %u, flags %#x, surface %p.
\n
"
,
TRACE
(
"device_parent %p, container_parent %p, wined3d_desc %p, sub_resource_idx %u, flags %#x, surface %p.
\n
"
,
device_parent
,
container_parent
,
wined3d_desc
,
sub_resource_idx
,
flags
,
surface
);
device_parent
,
container_parent
,
wined3d_desc
,
sub_resource_idx
,
flags
,
surface
);
/* The ddraw root surface is created before the wined3d texture. */
if
(
!
sub_resource_idx
)
{
ddraw_surface
=
texture
->
root
;
goto
done
;
}
desc
.
dwWidth
=
wined3d_desc
->
width
;
desc
.
dwWidth
=
wined3d_desc
->
width
;
desc
.
dwHeight
=
wined3d_desc
->
height
;
desc
.
dwHeight
=
wined3d_desc
->
height
;
...
@@ -5174,7 +5158,6 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
...
@@ -5174,7 +5158,6 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
if
(
FAILED
(
hr
=
ddraw_create_surface
(
ddraw
,
&
desc
,
flags
,
&
ddraw_surface
,
texture
->
version
)))
if
(
FAILED
(
hr
=
ddraw_create_surface
(
ddraw
,
&
desc
,
flags
,
&
ddraw_surface
,
texture
->
version
)))
return
hr
;
return
hr
;
done:
*
surface
=
ddraw_surface
->
wined3d_surface
;
*
surface
=
ddraw_surface
->
wined3d_surface
;
wined3d_surface_incref
(
*
surface
);
wined3d_surface_incref
(
*
surface
);
...
...
dlls/ddraw/ddraw_private.h
View file @
3d452ed9
...
@@ -193,7 +193,8 @@ struct ddraw_texture
...
@@ -193,7 +193,8 @@ struct ddraw_texture
struct
ddraw_surface
*
root
;
struct
ddraw_surface
*
root
;
};
};
HRESULT
ddraw_surface_create_texture
(
struct
ddraw_surface
*
surface
,
DWORD
surface_flags
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
desc
,
unsigned
int
version
,
DWORD
surface_flags
,
struct
ddraw_surface
**
surface
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_surface_init
(
struct
ddraw_surface
*
surface
,
struct
ddraw
*
ddraw
,
HRESULT
ddraw_surface_init
(
struct
ddraw_surface
*
surface
,
struct
ddraw
*
ddraw
,
DDSURFACEDESC2
*
desc
,
DWORD
flags
,
UINT
version
)
DECLSPEC_HIDDEN
;
DDSURFACEDESC2
*
desc
,
DWORD
flags
,
UINT
version
)
DECLSPEC_HIDDEN
;
ULONG
ddraw_surface_release_iface
(
struct
ddraw_surface
*
This
)
DECLSPEC_HIDDEN
;
ULONG
ddraw_surface_release_iface
(
struct
ddraw_surface
*
This
)
DECLSPEC_HIDDEN
;
...
...
dlls/ddraw/surface.c
View file @
3d452ed9
...
@@ -5588,11 +5588,12 @@ static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
...
@@ -5588,11 +5588,12 @@ static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
ddraw_texture_wined3d_object_destroyed
,
ddraw_texture_wined3d_object_destroyed
,
};
};
HRESULT
ddraw_surface_create_texture
(
struct
ddraw_surface
*
surface
,
DWORD
surface_flags
)
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
desc
,
unsigned
int
version
,
DWORD
surface_flags
,
struct
ddraw_surface
**
surface
)
{
{
const
DDSURFACEDESC2
*
desc
=
&
surface
->
surface_desc
;
struct
ddraw_surface
*
root
,
*
mip
,
**
attach
;
struct
wined3d_resource_desc
wined3d_desc
;
struct
wined3d_resource_desc
wined3d_desc
;
struct
ddraw_surface
*
mip
,
**
attach
;
struct
wined3d_texture
*
wined3d_texture
;
struct
wined3d_resource
*
resource
;
struct
wined3d_resource
*
resource
;
struct
ddraw_texture
*
texture
;
struct
ddraw_texture
*
texture
;
UINT
layers
,
levels
,
i
,
j
;
UINT
layers
,
levels
,
i
,
j
;
...
@@ -5603,9 +5604,8 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
...
@@ -5603,9 +5604,8 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
if
(
!
(
texture
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
texture
))))
if
(
!
(
texture
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
texture
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
texture
->
version
=
surface
->
version
;
texture
->
version
=
version
;
texture
->
surface_desc
=
*
desc
;
texture
->
surface_desc
=
*
desc
;
texture
->
root
=
surface
;
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_MIPMAP
)
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_MIPMAP
)
levels
=
desc
->
u2
.
dwMipMapCount
;
levels
=
desc
->
u2
.
dwMipMapCount
;
...
@@ -5636,7 +5636,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
...
@@ -5636,7 +5636,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
pool
=
WINED3D_POOL_DEFAULT
;
pool
=
WINED3D_POOL_DEFAULT
;
}
}
wined3d_desc
.
format
=
wined3dformat_from_ddrawformat
(
&
surface
->
surface_desc
.
u4
.
ddpfPixelFormat
);
wined3d_desc
.
format
=
wined3dformat_from_ddrawformat
(
&
desc
->
u4
.
ddpfPixelFormat
);
wined3d_desc
.
multisample_type
=
WINED3D_MULTISAMPLE_NONE
;
wined3d_desc
.
multisample_type
=
WINED3D_MULTISAMPLE_NONE
;
wined3d_desc
.
multisample_quality
=
0
;
wined3d_desc
.
multisample_quality
=
0
;
wined3d_desc
.
pool
=
pool
;
wined3d_desc
.
pool
=
pool
;
...
@@ -5648,14 +5648,14 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
...
@@ -5648,14 +5648,14 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
if
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP
)
if
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP
)
{
{
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_CUBE_TEXTURE
;
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_CUBE_TEXTURE
;
hr
=
wined3d_texture_create_cube
(
surface
->
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
hr
=
wined3d_texture_create_cube
(
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
surface_flags
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
surface
->
wined3d_texture
);
surface_flags
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
wined3d_texture
);
}
}
else
else
{
{
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_TEXTURE
;
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_TEXTURE
;
hr
=
wined3d_texture_create_2d
(
surface
->
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
hr
=
wined3d_texture_create_2d
(
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
surface_flags
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
surface
->
wined3d_texture
);
surface_flags
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
wined3d_texture
);
}
}
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
...
@@ -5675,16 +5675,21 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
...
@@ -5675,16 +5675,21 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
return
hr
;
return
hr
;
}
}
resource
=
wined3d_texture_get_sub_resource
(
wined3d_texture
,
0
);
root
=
wined3d_resource_get_parent
(
resource
);
root
->
wined3d_texture
=
wined3d_texture
;
texture
->
root
=
root
;
for
(
i
=
0
;
i
<
layers
;
++
i
)
for
(
i
=
0
;
i
<
layers
;
++
i
)
{
{
attach
=
&
surface
->
complex_array
[
layers
-
1
-
i
];
attach
=
&
root
->
complex_array
[
layers
-
1
-
i
];
for
(
j
=
0
;
j
<
levels
;
++
j
)
for
(
j
=
0
;
j
<
levels
;
++
j
)
{
{
resource
=
wined3d_texture_get_sub_resource
(
surface
->
wined3d_texture
,
i
*
levels
+
j
);
resource
=
wined3d_texture_get_sub_resource
(
wined3d_texture
,
i
*
levels
+
j
);
mip
=
wined3d_resource_get_parent
(
resource
);
mip
=
wined3d_resource_get_parent
(
resource
);
if
(
mip
==
surface
)
if
(
mip
==
root
)
continue
;
continue
;
mip_desc
=
&
mip
->
surface_desc
;
mip_desc
=
&
mip
->
surface_desc
;
...
@@ -5727,6 +5732,8 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
...
@@ -5727,6 +5732,8 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface, DWORD surfac
}
}
}
}
*
surface
=
root
;
return
DD_OK
;
return
DD_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