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
063a6c8d
Commit
063a6c8d
authored
Nov 15, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Move the mipmap count fixup from CreateSurface() to ddraw_surface_create_texture().
parent
3a03dcf0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
47 deletions
+40
-47
ddraw.c
dlls/ddraw/ddraw.c
+0
-37
surface.c
dlls/ddraw/surface.c
+40
-10
No files found.
dlls/ddraw/ddraw.c
View file @
063a6c8d
...
...
@@ -3017,43 +3017,6 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
if
(
!
desc2
.
dwWidth
||
!
desc2
.
dwHeight
)
return
DDERR_INVALIDPARAMS
;
/* Mipmap count fixes */
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_MIPMAP
)
{
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_COMPLEX
)
{
if
(
desc2
.
dwFlags
&
DDSD_MIPMAPCOUNT
)
{
/* Mipmap count is given, should not be 0 */
if
(
desc2
.
u2
.
dwMipMapCount
==
0
)
return
DDERR_INVALIDPARAMS
;
}
else
{
/* Undocumented feature: Create sublevels until
* either the width or the height is 1
*/
DWORD
min
=
desc2
.
dwWidth
<
desc2
.
dwHeight
?
desc2
.
dwWidth
:
desc2
.
dwHeight
;
desc2
.
u2
.
dwMipMapCount
=
0
;
while
(
min
)
{
desc2
.
u2
.
dwMipMapCount
+=
1
;
min
>>=
1
;
}
}
}
else
{
/* Not-complex mipmap -> Mipmapcount = 1 */
desc2
.
u2
.
dwMipMapCount
=
1
;
}
/* There's a mipmap count in the created surface in any case */
desc2
.
dwFlags
|=
DDSD_MIPMAPCOUNT
;
}
/* If no mipmap is given, the texture has only one level */
/* The first surface is a front buffer, the back buffer is created afterwards */
if
(
(
desc2
.
dwFlags
&
DDSD_CAPS
)
&&
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
)
{
...
...
dlls/ddraw/surface.c
View file @
063a6c8d
...
...
@@ -5633,6 +5633,44 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
/* Do not fail surface creation, only fail 3D device creation. */
}
/* Mipmap count fixes */
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_MIPMAP
)
{
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_COMPLEX
)
{
if
(
desc
->
dwFlags
&
DDSD_MIPMAPCOUNT
)
{
/* Mipmap count is given, should not be 0. */
if
(
!
desc
->
u2
.
dwMipMapCount
)
return
DDERR_INVALIDPARAMS
;
}
else
{
/* Undocumented feature: Create sublevels until either the
* width or the height is 1. */
DWORD
min
=
desc
->
dwWidth
<
desc
->
dwHeight
?
desc
->
dwWidth
:
desc
->
dwHeight
;
desc
->
u2
.
dwMipMapCount
=
0
;
while
(
min
)
{
++
desc
->
u2
.
dwMipMapCount
;
min
>>=
1
;
}
}
}
else
{
desc
->
u2
.
dwMipMapCount
=
1
;
}
desc
->
dwFlags
|=
DDSD_MIPMAPCOUNT
;
levels
=
desc
->
u2
.
dwMipMapCount
;
}
else
{
levels
=
1
;
}
if
(
!
(
desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_SYSTEMMEMORY
))
&&
!
((
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
)
&&
(
desc
->
ddsCaps
.
dwCaps2
&
(
DDSCAPS2_TEXTUREMANAGE
|
DDSCAPS2_D3DTEXTUREMANAGE
))))
...
...
@@ -5685,16 +5723,6 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
texture
->
version
=
version
;
copy_to_surfacedesc2
(
&
texture
->
surface_desc
,
desc
);
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_MIPMAP
)
levels
=
desc
->
u2
.
dwMipMapCount
;
else
levels
=
1
;
if
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP
)
layers
=
6
;
else
layers
=
1
;
/* Some applications assume surfaces will always be mapped at the same
* address. Some of those also assume that this address is valid even when
* the surface isn't mapped, and that updates done this way will be
...
...
@@ -5706,12 +5734,14 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_CUBE_TEXTURE
;
hr
=
wined3d_texture_create_cube
(
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
WINED3D_SURFACE_PIN_SYSMEM
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
wined3d_texture
);
layers
=
6
;
}
else
{
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_TEXTURE
;
hr
=
wined3d_texture_create_2d
(
ddraw
->
wined3d_device
,
&
wined3d_desc
,
levels
,
WINED3D_SURFACE_PIN_SYSMEM
,
texture
,
&
ddraw_texture_wined3d_parent_ops
,
&
wined3d_texture
);
layers
=
1
;
}
if
(
FAILED
(
hr
))
...
...
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