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
59efd5c7
Commit
59efd5c7
authored
Jul 16, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jul 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Set the pow2 sizes in gl surface private setup.
parent
30724a6e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
33 deletions
+30
-33
device.c
dlls/wined3d/device.c
+0
-27
surface.c
dlls/wined3d/surface.c
+30
-0
surface_gdi.c
dlls/wined3d/surface_gdi.c
+0
-6
No files found.
dlls/wined3d/device.c
View file @
59efd5c7
...
...
@@ -575,7 +575,6 @@ If this flag is set, the contents of the depth stencil buffer will be invalid af
static
HRESULT
WINAPI
IWineD3DDeviceImpl_CreateSurface
(
IWineD3DDevice
*
iface
,
UINT
Width
,
UINT
Height
,
WINED3DFORMAT
Format
,
BOOL
Lockable
,
BOOL
Discard
,
UINT
Level
,
IWineD3DSurface
**
ppSurface
,
WINED3DRESOURCETYPE
Type
,
DWORD
Usage
,
WINED3DPOOL
Pool
,
WINED3DMULTISAMPLE_TYPE
MultiSample
,
DWORD
MultisampleQuality
,
HANDLE
*
pSharedHandle
,
WINED3DSURFTYPE
Impl
,
IUnknown
*
parent
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSurfaceImpl
*
object
;
/*NOTE: impl ref allowed since this is a create function */
unsigned
int
pow2Width
,
pow2Height
;
unsigned
int
Size
=
1
;
const
PixelFormatDesc
*
tableEntry
=
getFormatDescEntry
(
Format
);
TRACE
(
"(%p) Create surface
\n
"
,
This
);
...
...
@@ -616,27 +615,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
* by the device.
*******************************/
/* Non-power2 support */
if
(
GL_SUPPORT
(
ARB_TEXTURE_NON_POWER_OF_TWO
))
{
pow2Width
=
Width
;
pow2Height
=
Height
;
}
else
{
/* Find the nearest pow2 match */
pow2Width
=
pow2Height
=
1
;
while
(
pow2Width
<
Width
)
pow2Width
<<=
1
;
while
(
pow2Height
<
Height
)
pow2Height
<<=
1
;
}
if
(
pow2Width
>
Width
||
pow2Height
>
Height
)
{
/** TODO: add support for non power two compressed textures (OpenGL 2 provices support for * non-power-two textures gratis) **/
if
(
Format
==
WINED3DFMT_DXT1
||
Format
==
WINED3DFMT_DXT2
||
Format
==
WINED3DFMT_DXT3
||
Format
==
WINED3DFMT_DXT4
||
Format
==
WINED3DFMT_DXT5
)
{
FIXME
(
"(%p) Compressed non-power-two textures are not supported w(%d) h(%d)
\n
"
,
This
,
Width
,
Height
);
return
WINED3DERR_NOTAVAILABLE
;
}
}
/** DXTn mipmaps use the same number of 'levels' down to eg. 8x1, but since
* it is based around 4x4 pixel blocks it requires padding, so allocate enough
* space!
...
...
@@ -675,13 +653,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
object
->
glDescription
.
level
=
Level
;
object
->
glDescription
.
target
=
GL_TEXTURE_2D
;
/* Internal data */
object
->
pow2Width
=
pow2Width
;
object
->
pow2Height
=
pow2Height
;
/* Flags */
object
->
Flags
=
0
;
object
->
Flags
|=
(
pow2Width
!=
Width
||
pow2Height
!=
Height
)
?
SFLAG_NONPOW2
:
0
;
object
->
Flags
|=
Discard
?
SFLAG_DISCARD
:
0
;
object
->
Flags
|=
(
WINED3DFMT_D16_LOCKABLE
==
Format
)
?
SFLAG_LOCKABLE
:
0
;
object
->
Flags
|=
Lockable
?
SFLAG_LOCKABLE
:
0
;
...
...
dlls/wined3d/surface.c
View file @
59efd5c7
...
...
@@ -3435,6 +3435,36 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetColorKey(IWineD3DSurface *iface, DWORD Fla
static
HRESULT
WINAPI
IWineD3DSurfaceImpl_PrivateSetup
(
IWineD3DSurface
*
iface
)
{
/** Check against the maximum texture sizes supported by the video card **/
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
unsigned
int
pow2Width
,
pow2Height
;
/* Non-power2 support */
if
(
GL_SUPPORT
(
ARB_TEXTURE_NON_POWER_OF_TWO
))
{
pow2Width
=
This
->
currentDesc
.
Width
;
pow2Height
=
This
->
currentDesc
.
Height
;
}
else
{
/* Find the nearest pow2 match */
pow2Width
=
pow2Height
=
1
;
while
(
pow2Width
<
This
->
currentDesc
.
Width
)
pow2Width
<<=
1
;
while
(
pow2Height
<
This
->
currentDesc
.
Height
)
pow2Height
<<=
1
;
}
This
->
pow2Width
=
pow2Width
;
This
->
pow2Height
=
pow2Height
;
if
(
pow2Width
>
This
->
currentDesc
.
Width
||
pow2Height
>
This
->
currentDesc
.
Height
)
{
WINED3DFORMAT
Format
=
This
->
resource
.
format
;
/** TODO: add support for non power two compressed textures **/
if
(
Format
==
WINED3DFMT_DXT1
||
Format
==
WINED3DFMT_DXT2
||
Format
==
WINED3DFMT_DXT3
||
Format
==
WINED3DFMT_DXT4
||
Format
==
WINED3DFMT_DXT5
)
{
FIXME
(
"(%p) Compressed non-power-two textures are not supported w(%d) h(%d)
\n
"
,
This
,
This
->
currentDesc
.
Width
,
This
->
currentDesc
.
Height
);
return
WINED3DERR_NOTAVAILABLE
;
}
}
if
(
pow2Width
!=
This
->
currentDesc
.
Width
||
pow2Height
!=
This
->
currentDesc
.
Height
)
{
This
->
Flags
|=
SFLAG_NONPOW2
;
}
TRACE
(
"%p
\n
"
,
This
);
if
((
This
->
pow2Width
>
GL_LIMITS
(
texture_size
)
||
This
->
pow2Height
>
GL_LIMITS
(
texture_size
))
&&
!
(
This
->
resource
.
usage
&
(
WINED3DUSAGE_RENDERTARGET
|
WINED3DUSAGE_DEPTHSTENCIL
)))
{
...
...
dlls/wined3d/surface_gdi.c
View file @
59efd5c7
...
...
@@ -1513,7 +1513,6 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
IWineD3DSurfaceImpl
*
This
=
(
IWineD3DSurfaceImpl
*
)
iface
;
HRESULT
hr
;
HDC
hdc
;
long
oldsize
=
This
->
resource
.
size
;
if
(
This
->
resource
.
usage
&
WINED3DUSAGE_OVERLAY
)
{
...
...
@@ -1527,13 +1526,8 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
This
->
resource
.
allocatedMemory
=
NULL
;
/* We don't mind the nonpow2 stuff in GDI */
This
->
resource
.
size
=
IWineD3DSurface_GetPitch
(
iface
)
*
This
->
currentDesc
.
Height
;
This
->
pow2Width
=
This
->
currentDesc
.
Width
;
This
->
pow2Height
=
This
->
currentDesc
.
Height
;
This
->
Flags
&=
~
SFLAG_NONPOW2
;
/* Adjust the opengl mem counter */
globalChangeGlRam
(
This
->
resource
.
size
-
oldsize
);
/* Call GetDC to create a DIB section. We will use that
* DIB section for rendering
...
...
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