Commit d30d9d5e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Merge the IWineD3DBaseTexture::AddDirtyRegion() implementations.

parent afa93a5b
......@@ -338,6 +338,25 @@ HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture,
return hr;
}
HRESULT basetexture_add_dirty_region(IWineD3DBaseTextureImpl *texture,
UINT layer, const WINED3DBOX *dirty_region)
{
struct wined3d_resource *sub_resource;
TRACE("texture %p, layer %u, dirty_region %p.\n", texture, layer, dirty_region);
if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
basetexture_set_dirty(texture, TRUE);
texture->baseTexture.texture_ops->texture_sub_resource_add_dirty_region(sub_resource, dirty_region);
return WINED3D_OK;
}
/* GL locking is done by the caller */
static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target,
WINED3DTEXTUREADDRESS d3d_wrap, GLenum param, BOOL cond_np2)
......
......@@ -135,6 +135,12 @@ static void cubetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSR
if (context) context_release(context);
}
static void cubetexture_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource,
const WINED3DBOX *dirty_region)
{
surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);
}
/* Do not call while under the GL lock. */
static void cubetexture_unload(struct wined3d_resource *resource)
{
......@@ -161,6 +167,7 @@ static const struct wined3d_texture_ops cubetexture_ops =
{
cubetexture_bind,
cubetexture_preload,
cubetexture_sub_resource_add_dirty_region,
};
static const struct wined3d_resource_ops cubetexture_resource_ops =
......@@ -324,21 +331,7 @@ static struct wined3d_resource * WINAPI IWineD3DCubeTextureImpl_GetSubResource(I
static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface,
UINT layer, const WINED3DBOX *dirty_region)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
struct wined3d_resource *sub_resource;
TRACE("iface %p, layer %u, dirty_region %p.\n", iface, layer, dirty_region);
if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
basetexture_set_dirty(texture, TRUE);
surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);
return WINED3D_OK;
return basetexture_add_dirty_region((IWineD3DBaseTextureImpl *)iface, layer, dirty_region);
}
static const IWineD3DBaseTextureVtbl IWineD3DCubeTexture_Vtbl =
......
......@@ -159,6 +159,12 @@ static void texture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB s
gl_tex->dirty = FALSE;
}
static void texture_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource,
const WINED3DBOX *dirty_region)
{
surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);
}
/* Do not call while under the GL lock. */
static void texture_unload(struct wined3d_resource *resource)
{
......@@ -184,6 +190,7 @@ static const struct wined3d_texture_ops texture_ops =
{
texture_bind,
texture_preload,
texture_sub_resource_add_dirty_region,
};
static const struct wined3d_resource_ops texture_resource_ops =
......@@ -348,21 +355,7 @@ static struct wined3d_resource * WINAPI IWineD3DTextureImpl_GetSubResource(IWine
static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface,
UINT layer, const WINED3DBOX *dirty_region)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
struct wined3d_resource *sub_resource;
TRACE("iface %p, layer %u, dirty_region %p.\n", iface, layer, dirty_region);
if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
basetexture_set_dirty(texture, TRUE);
surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region);
return WINED3D_OK;
return basetexture_add_dirty_region((IWineD3DBaseTextureImpl *)iface, layer, dirty_region);
}
static const IWineD3DBaseTextureVtbl IWineD3DTexture_Vtbl =
......
......@@ -83,6 +83,12 @@ static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3D
texture->baseTexture.texture_rgb.dirty = FALSE;
}
static void volumetexture_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource,
const WINED3DBOX *dirty_region)
{
volume_add_dirty_box(volume_from_resource(sub_resource), dirty_region);
}
/* Do not call while under the GL lock. */
static void volumetexture_unload(struct wined3d_resource *resource)
{
......@@ -104,6 +110,7 @@ static const struct wined3d_texture_ops volumetexture_ops =
{
volumetexture_bind,
volumetexture_preload,
volumetexture_sub_resource_add_dirty_region,
};
static const struct wined3d_resource_ops volumetexture_resource_ops =
......@@ -265,21 +272,7 @@ static struct wined3d_resource * WINAPI IWineD3DVolumeTextureImpl_GetSubResource
static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyRegion(IWineD3DBaseTexture *iface,
UINT layer, const WINED3DBOX *dirty_region)
{
IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface;
struct wined3d_resource *sub_resource;
TRACE("iface %p, layer %u, dirty_region %p.\n", iface, layer, dirty_region);
if (!(sub_resource = basetexture_get_sub_resource(texture, layer * texture->baseTexture.level_count)))
{
WARN("Failed to get sub-resource.\n");
return WINED3DERR_INVALIDCALL;
}
basetexture_set_dirty(texture, TRUE);
volume_add_dirty_box(volume_from_resource(sub_resource), dirty_region);
return WINED3D_OK;
return basetexture_add_dirty_region((IWineD3DBaseTextureImpl *)iface, layer, dirty_region);
}
static const IWineD3DBaseTextureVtbl IWineD3DVolumeTexture_Vtbl =
......
......@@ -1888,6 +1888,8 @@ struct wined3d_texture_ops
HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture,
const struct wined3d_gl_info *gl_info, BOOL srgb);
void (*texture_preload)(struct IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb);
void (*texture_sub_resource_add_dirty_region)(struct wined3d_resource *sub_resource,
const WINED3DBOX *dirty_region);
};
typedef struct IWineD3DBaseTextureClass
......@@ -1932,6 +1934,8 @@ static inline struct gl_texture *basetexture_get_gl_texture(IWineD3DBaseTextureI
: &texture->baseTexture.texture_rgb;
}
HRESULT basetexture_add_dirty_region(IWineD3DBaseTextureImpl *texture,
UINT layer, const WINED3DBOX *dirty_region) DECLSPEC_HIDDEN;
void basetexture_apply_state_changes(IWineD3DBaseTextureImpl *texture,
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment