Commit 629d81b1 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove IWineD3DSurface::BindTexture() from the public interface.

parent 4454770c
......@@ -5462,7 +5462,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
/* Make sure the surface is loaded and up to date */
surface_internal_preload(dst_impl, SRGB_RGB);
IWineD3DSurface_BindTexture(dst_surface, FALSE);
surface_bind(dst_impl, FALSE);
src_w = src_impl->currentDesc.Width;
src_h = src_impl->currentDesc.Height;
......
......@@ -510,6 +510,56 @@ void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target)
}
/* Context activation is done by the caller. */
void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb)
{
TRACE("surface %p, srgb %#x.\n", surface, srgb);
if (surface->container.type == WINED3D_CONTAINER_TEXTURE)
{
IWineD3DBaseTextureImpl *texture = surface->container.u.texture;
TRACE("Passing to container (%p).\n", texture);
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
}
else
{
GLuint *name = srgb ? &surface->texture_name_srgb : &surface->texture_name;
if (surface->texture_level)
{
ERR("Standalone surface %p is non-zero texture level %u.\n",
surface, surface->texture_level);
}
ENTER_GL();
if (!*name)
{
glGenTextures(1, name);
checkGLcall("glGenTextures");
TRACE("Surface %p given name %u.\n", surface, *name);
glBindTexture(surface->texture_target, *name);
checkGLcall("glBindTexture");
glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(surface->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(surface->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
checkGLcall("glTexParameteri");
}
else
{
glBindTexture(surface->texture_target, *name);
checkGLcall("glBindTexture");
}
LEAVE_GL();
}
}
/* Context activation is done by the caller. */
static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
DWORD active_sampler;
......@@ -534,7 +584,7 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) {
{
IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler));
}
IWineD3DSurface_BindTexture((IWineD3DSurface *)This, srgb);
surface_bind(This, srgb);
}
/* This function checks if the primary render target uses the 8bit paletted format. */
......@@ -2494,63 +2544,6 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BO
return WINED3D_OK;
}
/* Context activation is done by the caller. */
static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("iface %p, srgb %#x.\n", iface, srgb);
if (This->container.type == WINED3D_CONTAINER_TEXTURE)
{
IWineD3DBaseTextureImpl *texture = This->container.u.texture;
TRACE("Passing to container (%p).\n", texture);
texture->baseTexture.texture_ops->texture_bind(texture, srgb);
}
else
{
GLuint *name;
TRACE("(%p) : Binding surface\n", This);
name = srgb ? &This->texture_name_srgb : &This->texture_name;
ENTER_GL();
if (!This->texture_level)
{
if (!*name) {
glGenTextures(1, name);
checkGLcall("glGenTextures");
TRACE("Surface %p given name %d\n", This, *name);
glBindTexture(This->texture_target, *name);
checkGLcall("glBindTexture");
glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)");
glTexParameteri(This->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
glTexParameteri(This->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
}
/* This is where we should be reducing the amount of GLMemoryUsed */
} else if (*name) {
/* Mipmap surfaces should have a base texture container */
ERR("Mipmap surface has a glTexture bound to it!\n");
}
glBindTexture(This->texture_target, *name);
checkGLcall("glBindTexture");
LEAVE_GL();
}
}
static HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format)
{
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
......@@ -4722,7 +4715,6 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
IWineD3DBaseSurfaceImpl_GetClipper,
/* Internal use: */
IWineD3DSurfaceImpl_LoadTexture,
IWineD3DSurfaceImpl_BindTexture,
IWineD3DBaseSurfaceImpl_GetData,
IWineD3DSurfaceImpl_SetFormat,
IWineD3DSurfaceImpl_PrivateSetup,
......
......@@ -209,11 +209,6 @@ IWineGDISurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode)
return WINED3DERR_INVALIDCALL;
}
static void WINAPI IWineGDISurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb)
{
ERR("Not supported.\n");
}
static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
WINED3DLOCKED_RECT lock;
......@@ -502,7 +497,6 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
IWineD3DBaseSurfaceImpl_GetClipper,
/* Internal use: */
IWineGDISurfaceImpl_LoadTexture,
IWineGDISurfaceImpl_BindTexture,
IWineD3DBaseSurfaceImpl_GetData,
IWineD3DBaseSurfaceImpl_SetFormat,
IWineGDISurfaceImpl_PrivateSetup,
......
......@@ -2154,6 +2154,7 @@ extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl DECLSPEC_HIDDEN;
extern const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl DECLSPEC_HIDDEN;
void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN;
void surface_bind(IWineD3DSurfaceImpl *surface, BOOL srgb) DECLSPEC_HIDDEN;
HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN;
void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN;
GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
......
......@@ -2465,9 +2465,6 @@ interface IWineD3DSurface : IWineD3DResource
HRESULT LoadTexture(
[in] BOOL srgb_mode
);
void BindTexture(
[in] BOOL srgb
);
const void *GetData(
);
HRESULT SetFormat(
......
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