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
7d29aecd
Commit
7d29aecd
authored
Dec 12, 2008
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Use a simpler way to calculate the number of texture levels.
It's probably slightly faster too.
parent
70ed814b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
25 deletions
+30
-25
device.c
dlls/wined3d/device.c
+3
-25
utils.c
dlls/wined3d/utils.c
+26
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/device.c
View file @
7d29aecd
...
...
@@ -855,15 +855,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
}
object
->
baseTexture
.
levels
=
1
;
}
else
if
(
Levels
==
0
)
{
TRACE
(
"calculating levels %d
\n
"
,
object
->
baseTexture
.
levels
);
object
->
baseTexture
.
levels
++
;
tmpW
=
Width
;
tmpH
=
Height
;
while
(
tmpW
>
1
||
tmpH
>
1
)
{
tmpW
=
max
(
1
,
tmpW
>>
1
);
tmpH
=
max
(
1
,
tmpH
>>
1
);
object
->
baseTexture
.
levels
++
;
}
object
->
baseTexture
.
levels
=
wined3d_log2i
(
max
(
Width
,
Height
))
+
1
;
TRACE
(
"Calculated levels = %d
\n
"
,
object
->
baseTexture
.
levels
);
}
...
...
@@ -958,16 +950,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
}
object
->
baseTexture
.
levels
=
1
;
}
else
if
(
Levels
==
0
)
{
object
->
baseTexture
.
levels
++
;
tmpW
=
Width
;
tmpH
=
Height
;
tmpD
=
Depth
;
while
(
tmpW
>
1
||
tmpH
>
1
||
tmpD
>
1
)
{
tmpW
=
max
(
1
,
tmpW
>>
1
);
tmpH
=
max
(
1
,
tmpH
>>
1
);
tmpD
=
max
(
1
,
tmpD
>>
1
);
object
->
baseTexture
.
levels
++
;
}
object
->
baseTexture
.
levels
=
wined3d_log2i
(
max
(
max
(
Width
,
Height
),
Depth
))
+
1
;
TRACE
(
"Calculated levels = %d
\n
"
,
object
->
baseTexture
.
levels
);
}
...
...
@@ -1117,12 +1100,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
}
object
->
baseTexture
.
levels
=
1
;
}
else
if
(
Levels
==
0
)
{
object
->
baseTexture
.
levels
++
;
tmpW
=
EdgeLength
;
while
(
tmpW
>
1
)
{
tmpW
=
max
(
1
,
tmpW
>>
1
);
object
->
baseTexture
.
levels
++
;
}
object
->
baseTexture
.
levels
=
wined3d_log2i
(
EdgeLength
)
+
1
;
TRACE
(
"Calculated levels = %d
\n
"
,
object
->
baseTexture
.
levels
);
}
...
...
dlls/wined3d/utils.c
View file @
7d29aecd
...
...
@@ -2245,3 +2245,29 @@ BOOL ffp_frag_program_key_compare(const void *keya, const void *keyb)
return
memcmp
(
ka
,
kb
,
sizeof
(
*
ka
))
==
0
;
}
UINT
wined3d_log2i
(
UINT32
x
)
{
static
const
BYTE
l
[]
=
{
0
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
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encilBits(WINED3DFORMAT fmt, short *depthSize, short *stencilSize
/* Math utils */
void
multiply_matrix
(
WINED3DMATRIX
*
dest
,
const
WINED3DMATRIX
*
src1
,
const
WINED3DMATRIX
*
src2
);
unsigned
int
count_bits
(
unsigned
int
mask
);
UINT
wined3d_log2i
(
UINT32
x
);
/*****************************************************************************
* To enable calling of inherited functions, requires prototypes
...
...
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