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
5b5e3bd0
Commit
5b5e3bd0
authored
Sep 19, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Sep 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Track GL texture states in a separate structure.
parent
1c93ab1e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
118 additions
and
110 deletions
+118
-110
basetexture.c
dlls/wined3d/basetexture.c
+73
-75
context.c
dlls/wined3d/context.c
+6
-6
cubetexture.c
dlls/wined3d/cubetexture.c
+5
-5
surface.c
dlls/wined3d/surface.c
+3
-3
texture.c
dlls/wined3d/texture.c
+17
-13
volume.c
dlls/wined3d/volume.c
+2
-1
volumetexture.c
dlls/wined3d/volumetexture.c
+4
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+8
-4
No files found.
dlls/wined3d/basetexture.c
View file @
5b5e3bd0
...
...
@@ -45,8 +45,8 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DR
texture
->
baseTexture
.
levels
=
levels
;
texture
->
baseTexture
.
filterType
=
(
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
?
WINED3DTEXF_LINEAR
:
WINED3DTEXF_NONE
;
texture
->
baseTexture
.
LOD
=
0
;
texture
->
baseTexture
.
dirty
=
TRUE
;
texture
->
baseTexture
.
srgbD
irty
=
TRUE
;
texture
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
texture
->
baseTexture
.
texture_srgb
.
d
irty
=
TRUE
;
texture
->
baseTexture
.
is_srgb
=
FALSE
;
texture
->
baseTexture
.
pow2Matrix_identity
=
TRUE
;
...
...
@@ -75,23 +75,23 @@ void basetexture_unload(IWineD3DBaseTexture *iface)
IWineD3DTextureImpl
*
This
=
(
IWineD3DTextureImpl
*
)
iface
;
IWineD3DDeviceImpl
*
device
=
This
->
resource
.
wineD3DDevice
;
if
(
This
->
baseTexture
.
texture
N
ame
)
{
if
(
This
->
baseTexture
.
texture
_rgb
.
n
ame
)
{
ActivateContext
(
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
glDeleteTextures
(
1
,
&
This
->
baseTexture
.
texture
N
ame
);
This
->
baseTexture
.
texture
N
ame
=
0
;
glDeleteTextures
(
1
,
&
This
->
baseTexture
.
texture
_rgb
.
n
ame
);
This
->
baseTexture
.
texture
_rgb
.
n
ame
=
0
;
LEAVE_GL
();
}
if
(
This
->
baseTexture
.
srgbTextureN
ame
)
{
if
(
This
->
baseTexture
.
texture_srgb
.
n
ame
)
{
ActivateContext
(
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
glDeleteTextures
(
1
,
&
This
->
baseTexture
.
srgbTextureN
ame
);
This
->
baseTexture
.
srgbTextureN
ame
=
0
;
glDeleteTextures
(
1
,
&
This
->
baseTexture
.
texture_srgb
.
n
ame
);
This
->
baseTexture
.
texture_srgb
.
n
ame
=
0
;
LEAVE_GL
();
}
This
->
baseTexture
.
dirty
=
TRUE
;
This
->
baseTexture
.
srgbD
irty
=
TRUE
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
This
->
baseTexture
.
texture_srgb
.
d
irty
=
TRUE
;
}
DWORD
basetexture_set_lod
(
IWineD3DBaseTexture
*
iface
,
DWORD
LODNew
)
...
...
@@ -113,8 +113,8 @@ DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew)
if
(
This
->
baseTexture
.
LOD
!=
LODNew
)
{
This
->
baseTexture
.
LOD
=
LODNew
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
~
0U
;
This
->
baseTexture
.
srgb
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
~
0U
;
This
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
~
0U
;
This
->
baseTexture
.
texture_srgb
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
~
0U
;
if
(
This
->
baseTexture
.
bindCount
)
{
IWineD3DDeviceImpl_MarkStateDirty
(
This
->
resource
.
wineD3DDevice
,
STATE_SAMPLER
(
This
->
baseTexture
.
sampler
));
}
...
...
@@ -158,7 +158,7 @@ HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DT
*/
ActivateContext
(
device
,
NULL
,
CTXUSAGE_RESOURCELOAD
);
ENTER_GL
();
glBindTexture
(
textureDimensions
,
This
->
baseTexture
.
texture
N
ame
);
glBindTexture
(
textureDimensions
,
This
->
baseTexture
.
texture
_rgb
.
n
ame
);
checkGLcall
(
"glBindTexture"
);
switch
(
FilterType
)
{
case
WINED3DTEXF_NONE
:
...
...
@@ -205,16 +205,16 @@ BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty)
{
BOOL
old
;
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
old
=
This
->
baseTexture
.
dirty
||
This
->
baseTexture
.
srgbD
irty
;
This
->
baseTexture
.
dirty
=
dirty
;
This
->
baseTexture
.
srgbD
irty
=
dirty
;
old
=
This
->
baseTexture
.
texture_rgb
.
dirty
||
This
->
baseTexture
.
texture_srgb
.
d
irty
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
dirty
;
This
->
baseTexture
.
texture_srgb
.
d
irty
=
dirty
;
return
old
;
}
BOOL
basetexture_get_dirty
(
IWineD3DBaseTexture
*
iface
)
{
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
return
This
->
baseTexture
.
dirty
||
This
->
baseTexture
.
srgbD
irty
;
return
This
->
baseTexture
.
texture_rgb
.
dirty
||
This
->
baseTexture
.
texture_srgb
.
d
irty
;
}
/* Context activation is done by the caller. */
...
...
@@ -224,49 +224,46 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
HRESULT
hr
=
WINED3D_OK
;
UINT
textureDimensions
;
BOOL
isNewTexture
=
FALSE
;
GLuint
*
texture
;
DWORD
*
states
;
struct
gl_texture
*
gl_tex
;
TRACE
(
"(%p) : About to bind texture
\n
"
,
This
);
This
->
baseTexture
.
is_srgb
=
srgb
;
/* SRGB mode cache for PreLoad calls outside drawprim */
if
(
srgb
)
{
texture
=
&
This
->
baseTexture
.
srgbTextureName
;
states
=
This
->
baseTexture
.
srgbstates
;
gl_tex
=
&
This
->
baseTexture
.
texture_srgb
;
}
else
{
texture
=
&
This
->
baseTexture
.
textureName
;
states
=
This
->
baseTexture
.
states
;
gl_tex
=
&
This
->
baseTexture
.
texture_rgb
;
}
textureDimensions
=
IWineD3DBaseTexture_GetTextureDimensions
(
iface
);
ENTER_GL
();
/* Generate a texture name if we don't already have one */
if
(
*
textur
e
==
0
)
{
if
(
gl_tex
->
nam
e
==
0
)
{
*
set_surface_desc
=
TRUE
;
glGenTextures
(
1
,
textur
e
);
glGenTextures
(
1
,
&
gl_tex
->
nam
e
);
checkGLcall
(
"glGenTextures"
);
TRACE
(
"Generated texture %d
\n
"
,
*
textur
e
);
TRACE
(
"Generated texture %d
\n
"
,
gl_tex
->
nam
e
);
if
(
This
->
resource
.
pool
==
WINED3DPOOL_DEFAULT
)
{
/* Tell opengl to try and keep this texture in video ram (well mostly) */
GLclampf
tmp
;
tmp
=
0
.
9
f
;
glPrioritizeTextures
(
1
,
textur
e
,
&
tmp
);
glPrioritizeTextures
(
1
,
&
gl_tex
->
nam
e
,
&
tmp
);
}
/* Initialise the state of the texture object
to the openGL defaults, not the directx defaults */
states
[
WINED3DTEXSTA_ADDRESSU
]
=
WINED3DTADDRESS_WRAP
;
states
[
WINED3DTEXSTA_ADDRESSV
]
=
WINED3DTADDRESS_WRAP
;
states
[
WINED3DTEXSTA_ADDRESSW
]
=
WINED3DTADDRESS_WRAP
;
states
[
WINED3DTEXSTA_BORDERCOLOR
]
=
0
;
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_LINEAR
;
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
/* GL_NEAREST_MIPMAP_LINEAR */
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_LINEAR
;
/* GL_NEAREST_MIPMAP_LINEAR */
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
0
;
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
=
1
;
states
[
WINED3DTEXSTA_SRGBTEXTURE
]
=
0
;
states
[
WINED3DTEXSTA_ELEMENTINDEX
]
=
0
;
states
[
WINED3DTEXSTA_DMAPOFFSET
]
=
0
;
states
[
WINED3DTEXSTA_TSSADDRESSW
]
=
WINED3DTADDRESS_WRAP
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSU
]
=
WINED3DTADDRESS_WRAP
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSV
]
=
WINED3DTADDRESS_WRAP
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSW
]
=
WINED3DTADDRESS_WRAP
;
gl_tex
->
states
[
WINED3DTEXSTA_BORDERCOLOR
]
=
0
;
gl_tex
->
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_LINEAR
;
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
/* GL_NEAREST_MIPMAP_LINEAR */
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_LINEAR
;
/* GL_NEAREST_MIPMAP_LINEAR */
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
0
;
gl_tex
->
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
=
1
;
gl_tex
->
states
[
WINED3DTEXSTA_SRGBTEXTURE
]
=
0
;
gl_tex
->
states
[
WINED3DTEXSTA_ELEMENTINDEX
]
=
0
;
gl_tex
->
states
[
WINED3DTEXSTA_DMAPOFFSET
]
=
0
;
gl_tex
->
states
[
WINED3DTEXSTA_TSSADDRESSW
]
=
WINED3DTADDRESS_WRAP
;
IWineD3DBaseTexture_SetDirty
(
iface
,
TRUE
);
isNewTexture
=
TRUE
;
...
...
@@ -274,7 +271,7 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
/* This means double binding the texture at creation, but keeps the code simpler all
* in all, and the run-time path free from additional checks
*/
glBindTexture
(
textureDimensions
,
*
textur
e
);
glBindTexture
(
textureDimensions
,
gl_tex
->
nam
e
);
checkGLcall
(
"glBindTexture"
);
glTexParameteri
(
textureDimensions
,
GL_GENERATE_MIPMAP_SGIS
,
GL_TRUE
);
checkGLcall
(
"glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)"
);
...
...
@@ -284,8 +281,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
}
/* Bind the texture */
if
(
*
textur
e
!=
0
)
{
glBindTexture
(
textureDimensions
,
*
textur
e
);
if
(
gl_tex
->
nam
e
!=
0
)
{
glBindTexture
(
textureDimensions
,
gl_tex
->
nam
e
);
checkGLcall
(
"glBindTexture"
);
if
(
isNewTexture
)
{
/* For a new texture we have to set the textures levels after binding the texture.
...
...
@@ -348,40 +345,41 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
const
DWORD
samplerStates
[
WINED3D_HIGHEST_SAMPLER_STATE
+
1
])
{
IWineD3DBaseTextureImpl
*
This
=
(
IWineD3DBaseTextureImpl
*
)
iface
;
DWORD
state
,
*
states
;
DWORD
state
;
GLint
textureDimensions
=
IWineD3DBaseTexture_GetTextureDimensions
(
iface
);
BOOL
cond_np2
=
IWineD3DBaseTexture_IsCondNP2
(
iface
);
DWORD
aniso
;
struct
gl_texture
*
gl_tex
;
TRACE
(
"iface %p, textureStates %p, samplerStates %p
\n
"
,
iface
,
textureStates
,
samplerStates
);
if
(
This
->
baseTexture
.
is_srgb
)
{
states
=
This
->
baseTexture
.
srgbstates
;
gl_tex
=
&
This
->
baseTexture
.
texture_srgb
;
}
else
{
states
=
This
->
baseTexture
.
states
;
gl_tex
=
&
This
->
baseTexture
.
texture_rgb
;
}
/* This function relies on the correct texture being bound and loaded. */
if
(
samplerStates
[
WINED3DSAMP_ADDRESSU
]
!=
states
[
WINED3DTEXSTA_ADDRESSU
])
{
if
(
samplerStates
[
WINED3DSAMP_ADDRESSU
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSU
])
{
state
=
samplerStates
[
WINED3DSAMP_ADDRESSU
];
apply_wrap
(
textureDimensions
,
state
,
GL_TEXTURE_WRAP_S
,
cond_np2
);
states
[
WINED3DTEXSTA_ADDRESSU
]
=
state
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSU
]
=
state
;
}
if
(
samplerStates
[
WINED3DSAMP_ADDRESSV
]
!=
states
[
WINED3DTEXSTA_ADDRESSV
])
{
if
(
samplerStates
[
WINED3DSAMP_ADDRESSV
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSV
])
{
state
=
samplerStates
[
WINED3DSAMP_ADDRESSV
];
apply_wrap
(
textureDimensions
,
state
,
GL_TEXTURE_WRAP_T
,
cond_np2
);
states
[
WINED3DTEXSTA_ADDRESSV
]
=
state
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSV
]
=
state
;
}
if
(
samplerStates
[
WINED3DSAMP_ADDRESSW
]
!=
states
[
WINED3DTEXSTA_ADDRESSW
])
{
if
(
samplerStates
[
WINED3DSAMP_ADDRESSW
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSW
])
{
state
=
samplerStates
[
WINED3DSAMP_ADDRESSW
];
apply_wrap
(
textureDimensions
,
state
,
GL_TEXTURE_WRAP_R
,
cond_np2
);
states
[
WINED3DTEXSTA_ADDRESSW
]
=
state
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSW
]
=
state
;
}
if
(
samplerStates
[
WINED3DSAMP_BORDERCOLOR
]
!=
states
[
WINED3DTEXSTA_BORDERCOLOR
])
{
if
(
samplerStates
[
WINED3DSAMP_BORDERCOLOR
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_BORDERCOLOR
])
{
float
col
[
4
];
state
=
samplerStates
[
WINED3DSAMP_BORDERCOLOR
];
...
...
@@ -389,10 +387,10 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
TRACE
(
"Setting border color for %u to %x
\n
"
,
textureDimensions
,
state
);
glTexParameterfv
(
textureDimensions
,
GL_TEXTURE_BORDER_COLOR
,
&
col
[
0
]);
checkGLcall
(
"glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)"
);
states
[
WINED3DTEXSTA_BORDERCOLOR
]
=
state
;
gl_tex
->
states
[
WINED3DTEXSTA_BORDERCOLOR
]
=
state
;
}
if
(
samplerStates
[
WINED3DSAMP_MAGFILTER
]
!=
states
[
WINED3DTEXSTA_MAGFILTER
])
{
if
(
samplerStates
[
WINED3DSAMP_MAGFILTER
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_MAGFILTER
])
{
GLint
glValue
;
state
=
samplerStates
[
WINED3DSAMP_MAGFILTER
];
if
(
state
>
WINED3DTEXF_ANISOTROPIC
)
{
...
...
@@ -404,25 +402,25 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
TRACE
(
"ValueMAG=%d setting MAGFILTER to %x
\n
"
,
state
,
glValue
);
glTexParameteri
(
textureDimensions
,
GL_TEXTURE_MAG_FILTER
,
glValue
);
states
[
WINED3DTEXSTA_MAGFILTER
]
=
state
;
gl_tex
->
states
[
WINED3DTEXSTA_MAGFILTER
]
=
state
;
}
if
((
samplerStates
[
WINED3DSAMP_MINFILTER
]
!=
states
[
WINED3DTEXSTA_MINFILTER
]
||
samplerStates
[
WINED3DSAMP_MIPFILTER
]
!=
states
[
WINED3DTEXSTA_MIPFILTER
]
||
samplerStates
[
WINED3DSAMP_MAXMIPLEVEL
]
!=
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]))
{
if
((
samplerStates
[
WINED3DSAMP_MINFILTER
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
]
||
samplerStates
[
WINED3DSAMP_MIPFILTER
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
||
samplerStates
[
WINED3DSAMP_MAXMIPLEVEL
]
!=
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]))
{
GLint
glValue
;
states
[
WINED3DTEXSTA_MIPFILTER
]
=
samplerStates
[
WINED3DSAMP_MIPFILTER
];
states
[
WINED3DTEXSTA_MINFILTER
]
=
samplerStates
[
WINED3DSAMP_MINFILTER
];
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
samplerStates
[
WINED3DSAMP_MAXMIPLEVEL
];
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
=
samplerStates
[
WINED3DSAMP_MIPFILTER
];
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
]
=
samplerStates
[
WINED3DSAMP_MINFILTER
];
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
samplerStates
[
WINED3DSAMP_MAXMIPLEVEL
];
if
(
states
[
WINED3DTEXSTA_MINFILTER
]
>
WINED3DTEXF_ANISOTROPIC
||
states
[
WINED3DTEXSTA_MIPFILTER
]
>
WINED3DTEXF_ANISOTROPIC
)
if
(
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
]
>
WINED3DTEXF_ANISOTROPIC
||
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
>
WINED3DTEXF_ANISOTROPIC
)
{
FIXME
(
"Unrecognized or unsupported D3DSAMP_MINFILTER value %d D3DSAMP_MIPFILTER value %d
\n
"
,
states
[
WINED3DTEXSTA_MINFILTER
],
states
[
WINED3DTEXSTA_MIPFILTER
]);
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
],
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]);
}
glValue
=
wined3d_gl_min_mip_filter
(
This
->
baseTexture
.
minMipLookup
,
min
(
max
(
samplerStates
[
WINED3DSAMP_MINFILTER
],
WINED3DTEXF_POINT
),
WINED3DTEXF_LINEAR
),
...
...
@@ -435,15 +433,15 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
checkGLcall
(
"glTexParameter GL_TEXTURE_MIN_FILTER, ..."
);
if
(
!
cond_np2
)
{
if
(
states
[
WINED3DTEXSTA_MIPFILTER
]
==
WINED3DTEXF_NONE
)
{
if
(
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
==
WINED3DTEXF_NONE
)
{
glValue
=
This
->
baseTexture
.
LOD
;
}
else
if
(
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
>=
This
->
baseTexture
.
levels
)
{
}
else
if
(
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
>=
This
->
baseTexture
.
levels
)
{
glValue
=
This
->
baseTexture
.
levels
-
1
;
}
else
if
(
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
<
This
->
baseTexture
.
LOD
)
{
}
else
if
(
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
<
This
->
baseTexture
.
LOD
)
{
/* baseTexture.LOD is already clamped in the setter */
glValue
=
This
->
baseTexture
.
LOD
;
}
else
{
glValue
=
states
[
WINED3DTEXSTA_MAXMIPLEVEL
];
glValue
=
gl_tex
->
states
[
WINED3DTEXSTA_MAXMIPLEVEL
];
}
/* Note that D3DSAMP_MAXMIPLEVEL specifies the biggest mipmap(default 0), while
* GL_TEXTURE_MAX_LEVEL specifies the smallest mimap used(default 1000).
...
...
@@ -453,9 +451,9 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
}
}
if
((
states
[
WINED3DSAMP_MAGFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
&&
states
[
WINED3DSAMP_MINFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
&&
states
[
WINED3DSAMP_MIPFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
)
if
((
gl_tex
->
states
[
WINED3DSAMP_MAGFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
&&
gl_tex
->
states
[
WINED3DSAMP_MINFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
&&
gl_tex
->
states
[
WINED3DSAMP_MIPFILTER
]
!=
WINED3DTEXF_ANISOTROPIC
)
||
cond_np2
)
{
aniso
=
1
;
...
...
@@ -465,7 +463,7 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
aniso
=
samplerStates
[
WINED3DSAMP_MAXANISOTROPY
];
}
if
(
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
!=
aniso
)
if
(
gl_tex
->
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
!=
aniso
)
{
if
(
GL_SUPPORT
(
EXT_TEXTURE_FILTER_ANISOTROPIC
))
{
...
...
@@ -476,6 +474,6 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
{
WARN
(
"Anisotropic filtering not supported.
\n
"
);
}
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
=
aniso
;
gl_tex
->
states
[
WINED3DTEXSTA_MAXANISOTROPY
]
=
aniso
;
}
}
dlls/wined3d/context.c
View file @
5b5e3bd0
...
...
@@ -125,17 +125,17 @@ static void context_apply_attachment_filter_states(IWineD3DSurface *surface, BOO
/* Update base texture states array */
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
(
surface
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture_impl
)))
{
if
(
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
!=
WINED3DTEXF_POINT
||
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
!=
WINED3DTEXF_NONE
)
if
(
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MINFILTER
]
!=
WINED3DTEXF_POINT
||
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MIPFILTER
]
!=
WINED3DTEXF_NONE
)
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
update_minfilter
=
TRUE
;
}
if
(
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
!=
WINED3DTEXF_POINT
)
if
(
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MAGFILTER
]
!=
WINED3DTEXF_POINT
)
{
texture_impl
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
texture_impl
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
update_magfilter
=
TRUE
;
}
...
...
dlls/wined3d/cubetexture.c
View file @
5b5e3bd0
...
...
@@ -56,7 +56,7 @@ static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3
srgb_mode
=
This
->
baseTexture
.
is_srgb
;
break
;
}
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
srgbDirty
:
&
This
->
baseTexture
.
dirty
;
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
texture_srgb
.
dirty
:
&
This
->
baseTexture
.
texture_rgb
.
dirty
;
TRACE
(
"(%p) : About to load texture: dirtified(%u).
\n
"
,
This
,
*
dirty
);
...
...
@@ -293,9 +293,9 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *i
for
(
i
=
0
;
i
<
This
->
baseTexture
.
levels
;
++
i
)
{
for
(
j
=
WINED3DCUBEMAP_FACE_POSITIVE_X
;
j
<=
WINED3DCUBEMAP_FACE_NEGATIVE_Z
;
++
j
)
{
if
(
This
->
baseTexture
.
is_srgb
)
{
surface_set_texture_name
(
This
->
surfaces
[
j
][
i
],
This
->
baseTexture
.
srgbTextureN
ame
,
TRUE
);
surface_set_texture_name
(
This
->
surfaces
[
j
][
i
],
This
->
baseTexture
.
texture_srgb
.
n
ame
,
TRUE
);
}
else
{
surface_set_texture_name
(
This
->
surfaces
[
j
][
i
],
This
->
baseTexture
.
texture
N
ame
,
FALSE
);
surface_set_texture_name
(
This
->
surfaces
[
j
][
i
],
This
->
baseTexture
.
texture
_rgb
.
n
ame
,
FALSE
);
}
}
}
...
...
@@ -387,8 +387,8 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *if
static
HRESULT
WINAPI
IWineD3DCubeTextureImpl_AddDirtyRect
(
IWineD3DCubeTexture
*
iface
,
WINED3DCUBEMAP_FACES
FaceType
,
CONST
RECT
*
pDirtyRect
)
{
HRESULT
hr
=
WINED3DERR_INVALIDCALL
;
IWineD3DCubeTextureImpl
*
This
=
(
IWineD3DCubeTextureImpl
*
)
iface
;
This
->
baseTexture
.
dirty
=
TRUE
;
This
->
baseTexture
.
srgbD
irty
=
TRUE
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
This
->
baseTexture
.
texture_srgb
.
d
irty
=
TRUE
;
TRACE
(
"(%p) : dirtyfication of faceType(%d) Level (0)
\n
"
,
This
,
FaceType
);
if
(
FaceType
<=
WINED3DCUBEMAP_FACE_NEGATIVE_Z
)
{
surface_add_dirty_rect
(
This
->
surfaces
[
FaceType
][
0
],
pDirtyRect
);
...
...
dlls/wined3d/surface.c
View file @
5b5e3bd0
...
...
@@ -4696,9 +4696,9 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
*/
if
(
SUCCEEDED
(
IWineD3DSurface_GetContainer
((
IWineD3DSurface
*
)
This
,
&
IID_IWineD3DBaseTexture
,
(
void
**
)
&
texture
)))
{
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
((
IWineD3DBaseTextureImpl
*
)
texture
)
->
baseTexture
.
texture_rgb
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
IWineD3DBaseTexture_Release
(
texture
);
}
}
...
...
dlls/wined3d/texture.c
View file @
5b5e3bd0
...
...
@@ -58,7 +58,7 @@ static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRG
srgb_mode
=
This
->
baseTexture
.
is_srgb
;
break
;
}
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
srgbDirty
:
&
This
->
baseTexture
.
dirty
;
dirty
=
srgb_mode
?
&
This
->
baseTexture
.
texture_srgb
.
dirty
:
&
This
->
baseTexture
.
texture_rgb
.
dirty
;
if
(
!
device
->
isInDraw
)
{
...
...
@@ -275,12 +275,16 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
hr
=
basetexture_bind
((
IWineD3DBaseTexture
*
)
iface
,
srgb
,
&
set_gl_texture_desc
);
if
(
set_gl_texture_desc
&&
SUCCEEDED
(
hr
))
{
UINT
i
;
struct
gl_texture
*
gl_tex
;
if
(
This
->
baseTexture
.
is_srgb
)
{
gl_tex
=
&
This
->
baseTexture
.
texture_srgb
;
}
else
{
gl_tex
=
&
This
->
baseTexture
.
texture_rgb
;
}
for
(
i
=
0
;
i
<
This
->
baseTexture
.
levels
;
++
i
)
{
if
(
This
->
baseTexture
.
is_srgb
)
{
surface_set_texture_name
(
This
->
surfaces
[
i
],
This
->
baseTexture
.
srgbTextureName
,
TRUE
);
}
else
{
surface_set_texture_name
(
This
->
surfaces
[
i
],
This
->
baseTexture
.
textureName
,
FALSE
);
}
surface_set_texture_name
(
This
->
surfaces
[
i
],
gl_tex
->
name
,
This
->
baseTexture
.
is_srgb
);
}
/* Conditinal non power of two textures use a different clamping default. If we're using the GL_WINE_normalized_texrect
* partial driver emulation, we're dealing with a GL_TEXTURE_2D texture which has the address mode set to repeat - something
...
...
@@ -298,11 +302,11 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
glTexParameteri
(
IWineD3DTexture_GetTextureDimensions
(
iface
),
GL_TEXTURE_MAG_FILTER
,
GL_NEAREST
);
checkGLcall
(
"glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)"
);
LEAVE_GL
();
This
->
baseTexture
.
states
[
WINED3DTEXSTA_ADDRESSU
]
=
WINED3DTADDRESS_CLAMP
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_ADDRESSV
]
=
WINED3DTADDRESS_CLAMP
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSU
]
=
WINED3DTADDRESS_CLAMP
;
gl_tex
->
states
[
WINED3DTEXSTA_ADDRESSV
]
=
WINED3DTADDRESS_CLAMP
;
gl_tex
->
states
[
WINED3DTEXSTA_MAGFILTER
]
=
WINED3DTEXF_POINT
;
gl_tex
->
states
[
WINED3DTEXSTA_MINFILTER
]
=
WINED3DTEXF_POINT
;
gl_tex
->
states
[
WINED3DTEXSTA_MIPFILTER
]
=
WINED3DTEXF_NONE
;
}
}
...
...
@@ -388,8 +392,8 @@ static HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UIN
static
HRESULT
WINAPI
IWineD3DTextureImpl_AddDirtyRect
(
IWineD3DTexture
*
iface
,
CONST
RECT
*
pDirtyRect
)
{
IWineD3DTextureImpl
*
This
=
(
IWineD3DTextureImpl
*
)
iface
;
This
->
baseTexture
.
dirty
=
TRUE
;
This
->
baseTexture
.
srgbD
irty
=
TRUE
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
This
->
baseTexture
.
texture_srgb
.
d
irty
=
TRUE
;
TRACE
(
"(%p) : dirtyfication of surface Level (0)
\n
"
,
This
);
surface_add_dirty_rect
(
This
->
surfaces
[
0
],
pDirtyRect
);
...
...
dlls/wined3d/volume.c
View file @
5b5e3bd0
...
...
@@ -266,7 +266,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DL
if
(
containerType
==
WINED3DRTYPE_VOLUMETEXTURE
)
{
IWineD3DBaseTextureImpl
*
pTexture
=
(
IWineD3DBaseTextureImpl
*
)
cont
;
pTexture
->
baseTexture
.
dirty
=
TRUE
;
pTexture
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
pTexture
->
baseTexture
.
texture_srgb
.
dirty
=
TRUE
;
}
else
{
FIXME
(
"Set dirty on container type %d
\n
"
,
containerType
);
}
...
...
dlls/wined3d/volumetexture.c
View file @
5b5e3bd0
...
...
@@ -53,7 +53,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE
/* If the texture is marked dirty or the srgb sampler setting has changed
* since the last load then reload the volumes. */
if
(
This
->
baseTexture
.
dirty
)
if
(
This
->
baseTexture
.
texture_rgb
.
dirty
)
{
for
(
i
=
0
;
i
<
This
->
baseTexture
.
levels
;
++
i
)
{
...
...
@@ -74,7 +74,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE
}
/* No longer dirty */
This
->
baseTexture
.
dirty
=
FALSE
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
FALSE
;
}
static
void
volumetexture_cleanup
(
IWineD3DVolumeTextureImpl
*
This
)
...
...
@@ -312,7 +312,8 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture
static
HRESULT
WINAPI
IWineD3DVolumeTextureImpl_AddDirtyBox
(
IWineD3DVolumeTexture
*
iface
,
CONST
WINED3DBOX
*
pDirtyBox
)
{
IWineD3DVolumeTextureImpl
*
This
=
(
IWineD3DVolumeTextureImpl
*
)
iface
;
This
->
baseTexture
.
dirty
=
TRUE
;
This
->
baseTexture
.
texture_rgb
.
dirty
=
TRUE
;
This
->
baseTexture
.
texture_srgb
.
dirty
=
TRUE
;
TRACE
(
"(%p) : dirtyfication of volume Level (0)
\n
"
,
This
);
volume_add_dirty_box
(
This
->
volumes
[
0
],
pDirtyBox
);
...
...
dlls/wined3d/wined3d_private.h
View file @
5b5e3bd0
...
...
@@ -1756,16 +1756,20 @@ enum WINED3DSRGB
SRGB_BOTH
=
3
,
/* Loads both textures */
};
struct
gl_texture
{
DWORD
states
[
MAX_WINETEXTURESTATES
];
BOOL
dirty
;
GLuint
name
;
};
/*****************************************************************************
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
*/
typedef
struct
IWineD3DBaseTextureClass
{
DWORD
states
[
MAX_WINETEXTURESTATES
];
DWORD
srgbstates
[
MAX_WINETEXTURESTATES
];
struct
gl_texture
texture_rgb
,
texture_srgb
;
UINT
levels
;
BOOL
dirty
,
srgbDirty
;
UINT
textureName
,
srgbTextureName
;
float
pow2Matrix
[
16
];
UINT
LOD
;
WINED3DTEXTUREFILTERTYPE
filterType
;
...
...
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