wined3d: Pass gl_info to basetexture_bind().

This commit is contained in:
Henri Verbeet 2011-03-03 09:24:11 +01:00 committed by Alexandre Julliard
parent 75c8e9f7b4
commit af0a4b6956
8 changed files with 22 additions and 18 deletions

View File

@ -238,9 +238,9 @@ void basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty)
}
/* Context activation is done by the caller. */
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc)
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb, BOOL *set_surface_desc)
{
const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
HRESULT hr = WINED3D_OK;
GLenum textureDimensions;
BOOL isNewTexture = FALSE;

View File

@ -28,18 +28,18 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Context activation is done by the caller. */
static HRESULT cubetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
static HRESULT cubetexture_bind(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
BOOL set_gl_texture_desc;
HRESULT hr;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
hr = basetexture_bind(texture, gl_info, srgb, &set_gl_texture_desc);
if (set_gl_texture_desc && SUCCEEDED(hr))
{
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && texture->baseTexture.is_srgb;
GLuint name = srgb_tex ? texture->baseTexture.texture_srgb.name : texture->baseTexture.texture_rgb.name;
UINT i;

View File

@ -3646,7 +3646,7 @@ static void sampler(DWORD state_id, struct wined3d_stateblock *stateblock, struc
IWineD3DBaseTextureImpl *texture = state->textures[sampler];
BOOL srgb = state->sampler_states[sampler][WINED3DSAMP_SRGBTEXTURE];
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
basetexture_apply_state_changes(texture,
state->sampler_states[sampler], gl_info);

View File

@ -701,9 +701,10 @@ void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb)
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
{
IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
TRACE("Passing to container (%p).\n", texture);
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
texture->baseTexture.texture_ops->texture_bind(texture, gl_info, srgb);
}
else
{

View File

@ -28,17 +28,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Context activation is done by the caller. */
static HRESULT texture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
static HRESULT texture_bind(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
BOOL set_gl_texture_desc;
HRESULT hr;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
hr = basetexture_bind(texture, gl_info, srgb, &set_gl_texture_desc);
if (set_gl_texture_desc && SUCCEEDED(hr))
{
const struct wined3d_gl_info *gl_info = &texture->resource.device->adapter->gl_info;
BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] && texture->baseTexture.is_srgb;
struct gl_texture *gl_tex;
UINT i;

View File

@ -60,7 +60,7 @@ static void volume_bind_and_dirtify(struct IWineD3DVolumeImpl *volume)
IWineD3DDeviceImpl_MarkStateDirty(volume->resource.device, STATE_SAMPLER(active_sampler));
}
container->baseTexture.texture_ops->texture_bind(container, FALSE);
container->baseTexture.texture_ops->texture_bind(container, gl_info, FALSE);
}
void volume_add_dirty_box(struct IWineD3DVolumeImpl *volume, const WINED3DBOX *dirty_box)

View File

@ -27,13 +27,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
/* Context activation is done by the caller. */
static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
BOOL dummy;
TRACE("texture %p, srgb %#x.\n", texture, srgb);
TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb);
return basetexture_bind(texture, srgb, &dummy);
return basetexture_bind(texture, gl_info, srgb, &dummy);
}
/* Do not call while under the GL lock. */

View File

@ -1871,7 +1871,8 @@ struct gl_texture
struct wined3d_texture_ops
{
HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture, BOOL srgb);
HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb);
void (*texture_preload)(struct IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb);
};
@ -1919,7 +1920,8 @@ static inline struct gl_texture *basetexture_get_gl_texture(IWineD3DBaseTextureI
void basetexture_apply_state_changes(IWineD3DBaseTextureImpl *texture,
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
void basetexture_cleanup(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
void basetexture_generate_mipmaps(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;