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
3a59137b
Commit
3a59137b
authored
Jan 03, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 04, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass an IWineD3DBaseTextureImpl pointer to internal_preload().
parent
a2c81ada
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
58 deletions
+57
-58
cubetexture.c
dlls/wined3d/cubetexture.c
+16
-17
device.c
dlls/wined3d/device.c
+3
-2
surface.c
dlls/wined3d/surface.c
+2
-2
texture.c
dlls/wined3d/texture.c
+16
-17
volumetexture.c
dlls/wined3d/volumetexture.c
+18
-19
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-1
No files found.
dlls/wined3d/cubetexture.c
View file @
3a59137b
...
...
@@ -28,17 +28,17 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d_texture
);
/* Do not call while under the GL lock. */
static
void
cubetexture_internal_preload
(
IWineD3DBaseTexture
*
ifac
e
,
enum
WINED3DSRGB
srgb
)
static
void
cubetexture_internal_preload
(
IWineD3DBaseTexture
Impl
*
textur
e
,
enum
WINED3DSRGB
srgb
)
{
/* Override the IWineD3DResource Preload method. */
IWineD3DCubeTextureImpl
*
This
=
(
IWineD3DCubeTextureImpl
*
)
iface
;
UINT
sub_count
=
This
->
baseTexture
.
level_count
*
This
->
baseTexture
.
layer_count
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
device
;
UINT
sub_count
=
texture
->
baseTexture
.
level_count
*
texture
->
baseTexture
.
layer_count
;
IWineD3DDeviceImpl
*
device
=
texture
->
resource
.
device
;
struct
wined3d_context
*
context
=
NULL
;
BOOL
srgb_mode
;
BOOL
*
dirty
;
UINT
i
;
TRACE
(
"texture %p, srgb %#x.
\n
"
,
texture
,
srgb
);
switch
(
srgb
)
{
case
SRGB_RGB
:
...
...
@@ -46,7 +46,7 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
break
;
case
SRGB_BOTH
:
cubetexture_internal_preload
(
ifac
e
,
SRGB_RGB
);
cubetexture_internal_preload
(
textur
e
,
SRGB_RGB
);
/* Fallthrough */
case
SRGB_SRGB
:
...
...
@@ -54,12 +54,10 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
break
;
default:
srgb_mode
=
This
->
baseTexture
.
is_srgb
;
srgb_mode
=
texture
->
baseTexture
.
is_srgb
;
break
;
}
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
texture_srgb
.
dirty
:
&
This
->
baseTexture
.
texture_rgb
.
dirty
;
TRACE
(
"(%p) : About to load texture: dirtified(%u).
\n
"
,
This
,
*
dirty
);
dirty
=
srgb_mode
?
&
texture
->
baseTexture
.
texture_srgb
.
dirty
:
&
texture
->
baseTexture
.
texture_rgb
.
dirty
;
/* We only have to activate a context for gl when we're not drawing.
* In most cases PreLoad will be called during draw and a context was
...
...
@@ -71,12 +69,12 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
context
=
context_acquire
(
device
,
NULL
);
}
if
(
This
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
||
This
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT_A8_UNORM
)
if
(
texture
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
||
texture
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT_A8_UNORM
)
{
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
IWineD3DSurfaceImpl
*
surface
=
(
IWineD3DSurfaceImpl
*
)
This
->
baseTexture
.
sub_resources
[
i
];
IWineD3DSurfaceImpl
*
surface
=
(
IWineD3DSurfaceImpl
*
)
texture
->
baseTexture
.
sub_resources
[
i
];
if
(
palette9_changed
(
surface
))
{
...
...
@@ -96,12 +94,12 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
{
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
IWineD3DSurface_LoadTexture
((
IWineD3DSurface
*
)
This
->
baseTexture
.
sub_resources
[
i
],
srgb_mode
);
IWineD3DSurface_LoadTexture
((
IWineD3DSurface
*
)
texture
->
baseTexture
.
sub_resources
[
i
],
srgb_mode
);
}
}
else
{
TRACE
(
"
(%p) Texture not dirty, nothing to do.
\n
"
,
ifac
e
);
TRACE
(
"
Texture %p not dirty, nothing to do.
\n
"
,
textur
e
);
}
/* No longer dirty. */
...
...
@@ -203,8 +201,9 @@ static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *ifa
}
/* Do not call while under the GL lock. */
static
void
WINAPI
IWineD3DCubeTextureImpl_PreLoad
(
IWineD3DCubeTexture
*
iface
)
{
cubetexture_internal_preload
((
IWineD3DBaseTexture
*
)
iface
,
SRGB_ANY
);
static
void
WINAPI
IWineD3DCubeTextureImpl_PreLoad
(
IWineD3DCubeTexture
*
iface
)
{
cubetexture_internal_preload
((
IWineD3DBaseTextureImpl
*
)
iface
,
SRGB_ANY
);
}
/* Do not call while under the GL lock. */
...
...
dlls/wined3d/device.c
View file @
3a59137b
...
...
@@ -460,7 +460,7 @@ static void device_preload_texture(const struct wined3d_state *state, unsigned i
if
(
!
(
texture
=
state
->
textures
[
idx
]))
return
;
srgb
=
state
->
sampler_states
[
idx
][
WINED3DSAMP_SRGBTEXTURE
]
?
SRGB_SRGB
:
SRGB_RGB
;
texture
->
baseTexture
.
internal_preload
(
(
IWineD3DBaseTexture
*
)
texture
,
srgb
);
texture
->
baseTexture
.
internal_preload
(
texture
,
srgb
);
}
void
device_preload_textures
(
IWineD3DDeviceImpl
*
device
)
...
...
@@ -5062,7 +5062,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
}
/* Make sure that the destination texture is loaded. */
((
IWineD3DBaseTextureImpl
*
)
dst_texture
)
->
baseTexture
.
internal_preload
(
dst_texture
,
SRGB_RGB
);
((
IWineD3DBaseTextureImpl
*
)
dst_texture
)
->
baseTexture
.
internal_preload
(
(
IWineD3DBaseTextureImpl
*
)
dst_texture
,
SRGB_RGB
);
/* Update every surface level of the texture. */
switch
(
type
)
...
...
dlls/wined3d/surface.c
View file @
3a59137b
...
...
@@ -1071,8 +1071,8 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg
{
IWineD3DBaseTextureImpl
*
texture
=
surface
->
container
.
u
.
texture
;
TRACE
(
"Passing to container
.
\n
"
);
texture
->
baseTexture
.
internal_preload
(
(
IWineD3DBaseTexture
*
)
texture
,
srgb
);
TRACE
(
"Passing to container
(%p).
\n
"
,
texture
);
texture
->
baseTexture
.
internal_preload
(
texture
,
srgb
);
}
else
{
...
...
dlls/wined3d/texture.c
View file @
3a59137b
...
...
@@ -28,17 +28,15 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d_texture
);
/* Do not call while under the GL lock. */
static
void
texture_internal_preload
(
IWineD3DBaseTexture
*
ifac
e
,
enum
WINED3DSRGB
srgb
)
static
void
texture_internal_preload
(
IWineD3DBaseTexture
Impl
*
textur
e
,
enum
WINED3DSRGB
srgb
)
{
/* Override the IWineD3DResource PreLoad method. */
IWineD3DTextureImpl
*
This
=
(
IWineD3DTextureImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
device
;
IWineD3DDeviceImpl
*
device
=
texture
->
resource
.
device
;
struct
wined3d_context
*
context
=
NULL
;
unsigned
int
i
;
BOOL
srgb_mode
;
BOOL
*
dirty
;
TRACE
(
"
(%p) : About to load texture.
\n
"
,
This
);
TRACE
(
"
texture %p, srgb %#x.
\n
"
,
texture
,
srgb
);
switch
(
srgb
)
{
...
...
@@ -47,7 +45,7 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
break
;
case
SRGB_BOTH
:
texture_internal_preload
(
ifac
e
,
SRGB_RGB
);
texture_internal_preload
(
textur
e
,
SRGB_RGB
);
/* Fallthrough */
case
SRGB_SRGB
:
...
...
@@ -55,10 +53,10 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
break
;
default:
srgb_mode
=
This
->
baseTexture
.
is_srgb
;
srgb_mode
=
texture
->
baseTexture
.
is_srgb
;
break
;
}
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
texture_srgb
.
dirty
:
&
This
->
baseTexture
.
texture_rgb
.
dirty
;
dirty
=
srgb_mode
?
&
texture
->
baseTexture
.
texture_srgb
.
dirty
:
&
texture
->
baseTexture
.
texture_rgb
.
dirty
;
if
(
!
device
->
isInDraw
)
{
...
...
@@ -67,12 +65,12 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
context
=
context_acquire
(
device
,
NULL
);
}
if
(
This
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
||
This
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT_A8_UNORM
)
if
(
texture
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT
||
texture
->
resource
.
format
->
id
==
WINED3DFMT_P8_UINT_A8_UNORM
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
level_count
;
++
i
)
{
IWineD3DSurfaceImpl
*
surface
=
(
IWineD3DSurfaceImpl
*
)
This
->
baseTexture
.
sub_resources
[
i
];
IWineD3DSurfaceImpl
*
surface
=
(
IWineD3DSurfaceImpl
*
)
texture
->
baseTexture
.
sub_resources
[
i
];
if
(
palette9_changed
(
surface
))
{
TRACE
(
"Reloading surface because the d3d8/9 palette was changed.
\n
"
);
...
...
@@ -88,14 +86,14 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
* since the last load then reload the surfaces. */
if
(
*
dirty
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
level_count
;
++
i
)
{
IWineD3DSurface_LoadTexture
((
IWineD3DSurface
*
)
This
->
baseTexture
.
sub_resources
[
i
],
srgb_mode
);
IWineD3DSurface_LoadTexture
((
IWineD3DSurface
*
)
texture
->
baseTexture
.
sub_resources
[
i
],
srgb_mode
);
}
}
else
{
TRACE
(
"
(%p) Texture not dirty, nothing to do.
\n
"
,
ifac
e
);
TRACE
(
"
Texture %p not dirty, nothing to do.
\n
"
,
textur
e
);
}
if
(
context
)
context_release
(
context
);
...
...
@@ -198,8 +196,9 @@ static DWORD WINAPI IWineD3DTextureImpl_GetPriority(IWineD3DTexture *iface) {
}
/* Do not call while under the GL lock. */
static
void
WINAPI
IWineD3DTextureImpl_PreLoad
(
IWineD3DTexture
*
iface
)
{
texture_internal_preload
((
IWineD3DBaseTexture
*
)
iface
,
SRGB_ANY
);
static
void
WINAPI
IWineD3DTextureImpl_PreLoad
(
IWineD3DTexture
*
iface
)
{
texture_internal_preload
((
IWineD3DBaseTextureImpl
*
)
iface
,
SRGB_ANY
);
}
/* Do not call while under the GL lock. */
...
...
dlls/wined3d/volumetexture.c
View file @
3a59137b
...
...
@@ -27,55 +27,53 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
d3d_texture
);
/* Do not call while under the GL lock. */
static
void
volumetexture_internal_preload
(
IWineD3DBaseTexture
*
ifac
e
,
enum
WINED3DSRGB
srgb
)
static
void
volumetexture_internal_preload
(
IWineD3DBaseTexture
Impl
*
textur
e
,
enum
WINED3DSRGB
srgb
)
{
/* Override the IWineD3DResource Preload method. */
IWineD3DVolumeTextureImpl
*
This
=
(
IWineD3DVolumeTextureImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
device
;
IWineD3DDeviceImpl
*
device
=
texture
->
resource
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_context
*
context
=
NULL
;
BOOL
srgb_mode
=
This
->
baseTexture
.
is_srgb
;
BOOL
srgb_mode
=
texture
->
baseTexture
.
is_srgb
;
BOOL
srgb_was_toggled
=
FALSE
;
unsigned
int
i
;
TRACE
(
"
(%p) : About to load texture.
\n
"
,
This
);
TRACE
(
"
texture %p, srgb %#x.
\n
"
,
texture
,
srgb
);
if
(
!
device
->
isInDraw
)
context
=
context_acquire
(
device
,
NULL
);
else
if
(
gl_info
->
supported
[
EXT_TEXTURE_SRGB
]
&&
This
->
baseTexture
.
bindCount
>
0
)
else
if
(
gl_info
->
supported
[
EXT_TEXTURE_SRGB
]
&&
texture
->
baseTexture
.
bindCount
>
0
)
{
srgb_mode
=
device
->
stateBlock
->
state
.
sampler_states
[
This
->
baseTexture
.
sampler
][
WINED3DSAMP_SRGBTEXTURE
];
srgb_was_toggled
=
This
->
baseTexture
.
is_srgb
!=
srgb_mode
;
This
->
baseTexture
.
is_srgb
=
srgb_mode
;
srgb_mode
=
device
->
stateBlock
->
state
.
sampler_states
[
texture
->
baseTexture
.
sampler
][
WINED3DSAMP_SRGBTEXTURE
];
srgb_was_toggled
=
texture
->
baseTexture
.
is_srgb
!=
srgb_mode
;
texture
->
baseTexture
.
is_srgb
=
srgb_mode
;
}
/* If the texture is marked dirty or the srgb sampler setting has changed
* since the last load then reload the volumes. */
if
(
This
->
baseTexture
.
texture_rgb
.
dirty
)
if
(
texture
->
baseTexture
.
texture_rgb
.
dirty
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
level_count
;
++
i
)
{
IWineD3DVolume
*
volume
=
(
IWineD3DVolume
*
)
This
->
baseTexture
.
sub_resources
[
i
];
IWineD3DVolume
*
volume
=
(
IWineD3DVolume
*
)
texture
->
baseTexture
.
sub_resources
[
i
];
IWineD3DVolume_LoadTexture
(
volume
,
i
,
srgb_mode
);
}
}
else
if
(
srgb_was_toggled
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
baseTexture
.
level_count
;
++
i
)
{
IWineD3DVolume
*
volume
=
(
IWineD3DVolume
*
)
This
->
baseTexture
.
sub_resources
[
i
];
IWineD3DVolume
*
volume
=
(
IWineD3DVolume
*
)
texture
->
baseTexture
.
sub_resources
[
i
];
volume_add_dirty_box
(
volume
,
NULL
);
IWineD3DVolume_LoadTexture
(
volume
,
i
,
srgb_mode
);
}
}
else
{
TRACE
(
"
(%p) Texture not dirty, nothing to do.
\n
"
,
ifac
e
);
TRACE
(
"
Texture %p not dirty, nothing to do.
\n
"
,
textur
e
);
}
if
(
context
)
context_release
(
context
);
/* No longer dirty */
This
->
baseTexture
.
texture_rgb
.
dirty
=
FALSE
;
texture
->
baseTexture
.
texture_rgb
.
dirty
=
FALSE
;
}
static
void
volumetexture_cleanup
(
IWineD3DVolumeTextureImpl
*
This
)
...
...
@@ -165,8 +163,9 @@ static DWORD WINAPI IWineD3DVolumeTextureImpl_GetPriority(IWineD3DVolumeTexture
return
resource_get_priority
((
IWineD3DResource
*
)
iface
);
}
static
void
WINAPI
IWineD3DVolumeTextureImpl_PreLoad
(
IWineD3DVolumeTexture
*
iface
)
{
volumetexture_internal_preload
((
IWineD3DBaseTexture
*
)
iface
,
SRGB_ANY
);
static
void
WINAPI
IWineD3DVolumeTextureImpl_PreLoad
(
IWineD3DVolumeTexture
*
iface
)
{
volumetexture_internal_preload
((
IWineD3DBaseTextureImpl
*
)
iface
,
SRGB_ANY
);
}
/* Do not call while under the GL lock. */
...
...
dlls/wined3d/wined3d_private.h
View file @
3a59137b
...
...
@@ -58,6 +58,7 @@ typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl;
typedef
struct
IWineD3DDeviceImpl
IWineD3DDeviceImpl
;
typedef
struct
IWineD3DSwapChainImpl
IWineD3DSwapChainImpl
;
struct
IWineD3DBaseShaderImpl
;
struct
IWineD3DBaseTextureImpl
;
/* Texture format fixups */
...
...
@@ -1897,7 +1898,7 @@ typedef struct IWineD3DBaseTextureClass
const
struct
min_lookup
*
minMipLookup
;
const
GLenum
*
magLookup
;
GLenum
target
;
void
(
*
internal_preload
)(
IWineD3DBaseTexture
*
ifac
e
,
enum
WINED3DSRGB
srgb
);
void
(
*
internal_preload
)(
struct
IWineD3DBaseTextureImpl
*
textur
e
,
enum
WINED3DSRGB
srgb
);
}
IWineD3DBaseTextureClass
;
typedef
struct
IWineD3DBaseTextureImpl
...
...
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