mirror of
https://github.com/reactos/wine.git
synced 2024-11-27 21:50:37 +00:00
wined3d: Remove IWineD3DBaseTexture::BindTexture() from the public interface.
This commit is contained in:
parent
f9a1e8813e
commit
d72520b5cc
@ -27,9 +27,9 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
||||
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, DWORD usage,
|
||||
const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_texture_ops *texture_ops,
|
||||
UINT layer_count, UINT level_count, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device,
|
||||
DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
HRESULT hr;
|
||||
@ -42,6 +42,7 @@ HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UIN
|
||||
return hr;
|
||||
}
|
||||
|
||||
texture->baseTexture.texture_ops = texture_ops;
|
||||
texture->baseTexture.sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
level_count * layer_count * sizeof(*texture->baseTexture.sub_resources));
|
||||
if (!texture->baseTexture.sub_resources)
|
||||
|
@ -27,8 +27,36 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT cubetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
|
||||
{
|
||||
BOOL set_gl_texture_desc;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("texture %p, srgb %#x.\n", texture, srgb);
|
||||
|
||||
hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
|
||||
if (set_gl_texture_desc && SUCCEEDED(hr))
|
||||
{
|
||||
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i];
|
||||
|
||||
if (texture->baseTexture.is_srgb)
|
||||
surface_set_texture_name(surface, texture->baseTexture.texture_srgb.name, TRUE);
|
||||
else
|
||||
surface_set_texture_name(surface, texture->baseTexture.texture_rgb.name, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static void cubetexture_internal_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
static void cubetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
{
|
||||
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
|
||||
IWineD3DDeviceImpl *device = texture->resource.device;
|
||||
@ -46,7 +74,7 @@ static void cubetexture_internal_preload(IWineD3DBaseTextureImpl *texture, enum
|
||||
break;
|
||||
|
||||
case SRGB_BOTH:
|
||||
cubetexture_internal_preload(texture, SRGB_RGB);
|
||||
cubetexture_preload(texture, SRGB_RGB);
|
||||
/* Fallthrough */
|
||||
|
||||
case SRGB_SRGB:
|
||||
@ -108,6 +136,12 @@ static void cubetexture_internal_preload(IWineD3DBaseTextureImpl *texture, enum
|
||||
if (context) context_release(context);
|
||||
}
|
||||
|
||||
static const struct wined3d_texture_ops cubetexture_ops =
|
||||
{
|
||||
cubetexture_bind,
|
||||
cubetexture_preload,
|
||||
};
|
||||
|
||||
static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This)
|
||||
{
|
||||
UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count;
|
||||
@ -203,7 +237,7 @@ 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((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
cubetexture_preload((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
@ -274,34 +308,6 @@ static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeText
|
||||
basetexture_generate_mipmaps((IWineD3DBaseTextureImpl *)iface);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface, BOOL srgb) {
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
BOOL set_gl_texture_desc;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
|
||||
hr = basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &set_gl_texture_desc);
|
||||
if (set_gl_texture_desc && SUCCEEDED(hr))
|
||||
{
|
||||
UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count;
|
||||
UINT i;
|
||||
|
||||
for (i = 0; i < sub_count; ++i)
|
||||
{
|
||||
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i];
|
||||
|
||||
if (This->baseTexture.is_srgb)
|
||||
surface_set_texture_name(surface, This->baseTexture.texture_srgb.name, TRUE);
|
||||
else
|
||||
surface_set_texture_name(surface, This->baseTexture.texture_rgb.name, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface)
|
||||
{
|
||||
TRACE("iface %p.\n", iface);
|
||||
@ -433,7 +439,6 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
|
||||
IWineD3DCubeTextureImpl_SetAutoGenFilterType,
|
||||
IWineD3DCubeTextureImpl_GetAutoGenFilterType,
|
||||
IWineD3DCubeTextureImpl_GenerateMipSubLevels,
|
||||
IWineD3DCubeTextureImpl_BindTexture,
|
||||
IWineD3DCubeTextureImpl_IsCondNP2,
|
||||
/* IWineD3DCubeTexture */
|
||||
IWineD3DCubeTextureImpl_GetLevelDesc,
|
||||
@ -493,8 +498,9 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
|
||||
|
||||
texture->lpVtbl = &IWineD3DCubeTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 6, levels,
|
||||
WINED3DRTYPE_CUBETEXTURE, device, usage, format, pool, parent, parent_ops);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, &cubetexture_ops,
|
||||
6, levels, WINED3DRTYPE_CUBETEXTURE, device, usage, format, pool,
|
||||
parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x\n", hr);
|
||||
@ -559,7 +565,6 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
|
||||
}
|
||||
tmp_w = max(1, tmp_w >> 1);
|
||||
}
|
||||
texture->baseTexture.internal_preload = cubetexture_internal_preload;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -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(texture, srgb);
|
||||
texture->baseTexture.texture_ops->texture_preload(texture, srgb);
|
||||
}
|
||||
|
||||
void device_preload_textures(IWineD3DDeviceImpl *device)
|
||||
@ -5062,7 +5062,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface,
|
||||
}
|
||||
|
||||
/* Make sure that the destination texture is loaded. */
|
||||
((IWineD3DBaseTextureImpl *)dst_texture)->baseTexture.internal_preload(
|
||||
((IWineD3DBaseTextureImpl *)dst_texture)->baseTexture.texture_ops->texture_preload(
|
||||
(IWineD3DBaseTextureImpl *)dst_texture, SRGB_RGB);
|
||||
|
||||
/* Update every surface level of the texture. */
|
||||
|
@ -3646,7 +3646,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
|
||||
IWineD3DBaseTextureImpl *texture = state->textures[sampler];
|
||||
BOOL srgb = state->sampler_states[sampler][WINED3DSAMP_SRGBTEXTURE];
|
||||
|
||||
IWineD3DBaseTexture_BindTexture((IWineD3DBaseTexture *)texture, srgb);
|
||||
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
|
||||
basetexture_apply_state_changes(texture,
|
||||
state->sampler_states[sampler], gl_info);
|
||||
|
||||
|
@ -1072,7 +1072,7 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg
|
||||
IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
|
||||
|
||||
TRACE("Passing to container (%p).\n", texture);
|
||||
texture->baseTexture.internal_preload(texture, srgb);
|
||||
texture->baseTexture.texture_ops->texture_preload(texture, srgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2503,8 +2503,10 @@ static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL
|
||||
|
||||
if (This->container.type == WINED3D_CONTAINER_TEXTURE)
|
||||
{
|
||||
TRACE("Passing to container.\n");
|
||||
IWineD3DBaseTexture_BindTexture((IWineD3DBaseTexture *)This->container.u.texture, srgb);
|
||||
IWineD3DBaseTextureImpl *texture = This->container.u.texture;
|
||||
|
||||
TRACE("Passing to container (%p).\n", texture);
|
||||
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -27,8 +27,66 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT texture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
|
||||
{
|
||||
BOOL set_gl_texture_desc;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("texture %p, srgb %#x.\n", texture, srgb);
|
||||
|
||||
hr = basetexture_bind(texture, srgb, &set_gl_texture_desc);
|
||||
if (set_gl_texture_desc && SUCCEEDED(hr))
|
||||
{
|
||||
UINT i;
|
||||
struct gl_texture *gl_tex;
|
||||
|
||||
if (texture->baseTexture.is_srgb)
|
||||
gl_tex = &texture->baseTexture.texture_srgb;
|
||||
else
|
||||
gl_tex = &texture->baseTexture.texture_rgb;
|
||||
|
||||
for (i = 0; i < texture->baseTexture.level_count; ++i)
|
||||
{
|
||||
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i];
|
||||
surface_set_texture_name(surface, gl_tex->name, texture->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 that prevents us
|
||||
* from hitting the accelerated codepath. Thus manually set the GL
|
||||
* state. The same applies to filtering. Even if the texture has only
|
||||
* one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW
|
||||
* fallback on macos. */
|
||||
if (IWineD3DBaseTexture_IsCondNP2((IWineD3DBaseTexture *)texture))
|
||||
{
|
||||
GLenum target = texture->baseTexture.target;
|
||||
|
||||
ENTER_GL();
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
|
||||
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
|
||||
LEAVE_GL();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static void texture_internal_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
static void texture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = texture->resource.device;
|
||||
struct wined3d_context *context = NULL;
|
||||
@ -45,7 +103,7 @@ static void texture_internal_preload(IWineD3DBaseTextureImpl *texture, enum WINE
|
||||
break;
|
||||
|
||||
case SRGB_BOTH:
|
||||
texture_internal_preload(texture, SRGB_RGB);
|
||||
texture_preload(texture, SRGB_RGB);
|
||||
/* Fallthrough */
|
||||
|
||||
case SRGB_SRGB:
|
||||
@ -102,6 +160,12 @@ static void texture_internal_preload(IWineD3DBaseTextureImpl *texture, enum WINE
|
||||
*dirty = FALSE;
|
||||
}
|
||||
|
||||
static const struct wined3d_texture_ops texture_ops =
|
||||
{
|
||||
texture_bind,
|
||||
texture_preload,
|
||||
};
|
||||
|
||||
static void texture_cleanup(IWineD3DTextureImpl *This)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -198,7 +262,7 @@ 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((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
texture_preload((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
@ -265,64 +329,6 @@ static void WINAPI IWineD3DTextureImpl_GenerateMipSubLevels(IWineD3DTexture *ifa
|
||||
basetexture_generate_mipmaps((IWineD3DBaseTextureImpl *)iface);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BOOL srgb) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
BOOL set_gl_texture_desc;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
|
||||
hr = basetexture_bind((IWineD3DBaseTextureImpl *)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.level_count; ++i)
|
||||
{
|
||||
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i];
|
||||
surface_set_texture_name(surface, 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 that prevents us
|
||||
* from hitting the accelerated codepath. Thus manually set the GL
|
||||
* state. The same applies to filtering. Even if the texture has only
|
||||
* one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW
|
||||
* fallback on macos. */
|
||||
if (IWineD3DBaseTexture_IsCondNP2(iface))
|
||||
{
|
||||
GLenum target = This->baseTexture.target;
|
||||
|
||||
ENTER_GL();
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
|
||||
glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
|
||||
LEAVE_GL();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
@ -448,7 +454,6 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
|
||||
IWineD3DTextureImpl_SetAutoGenFilterType,
|
||||
IWineD3DTextureImpl_GetAutoGenFilterType,
|
||||
IWineD3DTextureImpl_GenerateMipSubLevels,
|
||||
IWineD3DTextureImpl_BindTexture,
|
||||
IWineD3DTextureImpl_IsCondNP2,
|
||||
/* IWineD3DTexture */
|
||||
IWineD3DTextureImpl_GetLevelDesc,
|
||||
@ -526,8 +531,9 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
||||
|
||||
texture->lpVtbl = &IWineD3DTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels,
|
||||
WINED3DRTYPE_TEXTURE, device, usage, format, pool, parent, parent_ops);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, &texture_ops,
|
||||
1, levels, WINED3DRTYPE_TEXTURE, device, usage, format, pool,
|
||||
parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x.\n", hr);
|
||||
@ -616,7 +622,6 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
|
||||
tmp_w = max(1, tmp_w >> 1);
|
||||
tmp_h = max(1, tmp_h >> 1);
|
||||
}
|
||||
texture->baseTexture.internal_preload = texture_internal_preload;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
||||
static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
|
||||
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
||||
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
|
||||
IWineD3DBaseTextureImpl *container = (IWineD3DBaseTextureImpl *)This->container;
|
||||
DWORD active_sampler;
|
||||
|
||||
/* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
|
||||
@ -59,7 +60,7 @@ static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler));
|
||||
}
|
||||
|
||||
IWineD3DVolumeTexture_BindTexture((IWineD3DVolumeTexture *)This->container, FALSE);
|
||||
container->baseTexture.texture_ops->texture_bind(container, FALSE);
|
||||
}
|
||||
|
||||
void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box)
|
||||
|
@ -26,8 +26,18 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT volumetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb)
|
||||
{
|
||||
BOOL dummy;
|
||||
|
||||
TRACE("texture %p, srgb %#x.\n", texture, srgb);
|
||||
|
||||
return basetexture_bind(texture, srgb, &dummy);
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
static void volumetexture_internal_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
static void volumetexture_preload(IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb)
|
||||
{
|
||||
IWineD3DDeviceImpl *device = texture->resource.device;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
@ -76,6 +86,12 @@ static void volumetexture_internal_preload(IWineD3DBaseTextureImpl *texture, enu
|
||||
texture->baseTexture.texture_rgb.dirty = FALSE;
|
||||
}
|
||||
|
||||
const struct wined3d_texture_ops volumetexture_ops =
|
||||
{
|
||||
volumetexture_bind,
|
||||
volumetexture_preload,
|
||||
};
|
||||
|
||||
static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This)
|
||||
{
|
||||
unsigned int i;
|
||||
@ -165,7 +181,7 @@ static DWORD WINAPI IWineD3DVolumeTextureImpl_GetPriority(IWineD3DVolumeTexture
|
||||
|
||||
static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *iface)
|
||||
{
|
||||
volumetexture_internal_preload((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
volumetexture_preload((IWineD3DBaseTextureImpl *)iface, SRGB_ANY);
|
||||
}
|
||||
|
||||
/* Do not call while under the GL lock. */
|
||||
@ -229,16 +245,6 @@ static void WINAPI IWineD3DVolumeTextureImpl_GenerateMipSubLevels(IWineD3DVolume
|
||||
basetexture_generate_mipmaps((IWineD3DBaseTextureImpl *)iface);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTexture *iface, BOOL srgb)
|
||||
{
|
||||
BOOL dummy;
|
||||
|
||||
TRACE("iface %p, srgb %#x.\n", iface, srgb);
|
||||
|
||||
return basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &dummy);
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
|
||||
{
|
||||
TRACE("iface %p.\n", iface);
|
||||
@ -365,7 +371,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
|
||||
IWineD3DVolumeTextureImpl_GetAutoGenFilterType,
|
||||
IWineD3DVolumeTextureImpl_GenerateMipSubLevels,
|
||||
/* not in d3d */
|
||||
IWineD3DVolumeTextureImpl_BindTexture,
|
||||
IWineD3DVolumeTextureImpl_IsCondNP2,
|
||||
/* volume texture */
|
||||
IWineD3DVolumeTextureImpl_GetLevelDesc,
|
||||
@ -424,8 +429,9 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
|
||||
|
||||
texture->lpVtbl = &IWineD3DVolumeTexture_Vtbl;
|
||||
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels,
|
||||
WINED3DRTYPE_VOLUMETEXTURE, device, usage, format, pool, parent, parent_ops);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, &volumetexture_ops,
|
||||
1, levels, WINED3DRTYPE_VOLUMETEXTURE, device, usage, format, pool,
|
||||
parent, parent_ops);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize basetexture, returning %#x.\n", hr);
|
||||
@ -467,7 +473,6 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
|
||||
tmp_h = max(1, tmp_h >> 1);
|
||||
tmp_d = max(1, tmp_d >> 1);
|
||||
}
|
||||
texture->baseTexture.internal_preload = volumetexture_internal_preload;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -1879,11 +1879,18 @@ struct gl_texture
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_texture_ops
|
||||
{
|
||||
HRESULT (*texture_bind)(struct IWineD3DBaseTextureImpl *texture, BOOL srgb);
|
||||
void (*texture_preload)(struct IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb);
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
|
||||
*/
|
||||
typedef struct IWineD3DBaseTextureClass
|
||||
{
|
||||
const struct wined3d_texture_ops *texture_ops;
|
||||
struct gl_texture texture_rgb, texture_srgb;
|
||||
IWineD3DResourceImpl **sub_resources;
|
||||
UINT layer_count;
|
||||
@ -1898,7 +1905,6 @@ typedef struct IWineD3DBaseTextureClass
|
||||
const struct min_lookup *minMipLookup;
|
||||
const GLenum *magLookup;
|
||||
GLenum target;
|
||||
void (*internal_preload)(struct IWineD3DBaseTextureImpl *texture, enum WINED3DSRGB srgb);
|
||||
} IWineD3DBaseTextureClass;
|
||||
|
||||
typedef struct IWineD3DBaseTextureImpl
|
||||
@ -1921,9 +1927,9 @@ DWORD basetexture_get_level_count(IWineD3DBaseTextureImpl *texture) DECLSPEC_HID
|
||||
DWORD basetexture_get_lod(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
||||
IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture,
|
||||
UINT sub_resource_idx) DECLSPEC_HIDDEN;
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
|
||||
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, DWORD usage,
|
||||
const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_texture_ops *texture_ops,
|
||||
UINT layer_count, UINT level_count, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device,
|
||||
DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
|
||||
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTextureImpl *texture,
|
||||
WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
|
||||
|
@ -2525,9 +2525,6 @@ interface IWineD3DBaseTexture : IWineD3DResource
|
||||
);
|
||||
void GenerateMipSubLevels(
|
||||
);
|
||||
HRESULT BindTexture(
|
||||
[in] BOOL srgb
|
||||
);
|
||||
BOOL IsCondNP2(
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user