Henri Verbeet : wined3d: Remove IWineD3DSurface::BindTexture() from the public interface.
Alexandre Julliard
julliard at winehq.org
Fri Jan 21 13:42:28 CST 2011
Module: wine
Branch: master
Commit: 629d81b192fad68c3c8e99f8c1cf3437cd090835
URL: http://source.winehq.org/git/wine.git/?a=commit;h=629d81b192fad68c3c8e99f8c1cf3437cd090835
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Jan 20 19:51:58 2011 +0100
wined3d: Remove IWineD3DSurface::BindTexture() from the public interface.
---
dlls/wined3d/device.c | 2 +-
dlls/wined3d/surface.c | 110 ++++++++++++++++++---------------------
dlls/wined3d/surface_gdi.c | 6 --
dlls/wined3d/wined3d_private.h | 1 +
include/wine/wined3d.idl | 3 -
5 files changed, 53 insertions(+), 69 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d375ca3..887546a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index cce1a2f..cacf062 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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,
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index d7a6f4a..28a465c 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -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,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index baf009f..a409f05 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 3fea495..9c1a04a 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2465,9 +2465,6 @@ interface IWineD3DSurface : IWineD3DResource
HRESULT LoadTexture(
[in] BOOL srgb_mode
);
- void BindTexture(
- [in] BOOL srgb
- );
const void *GetData(
);
HRESULT SetFormat(
More information about the wine-cvs
mailing list