[06/10] wined3d: Add a function to determine if a surface is the
front or the backbuffer for a swapchain,
and return the corresponding GLenum
H. Verbeet
hverbeet at gmail.com
Mon Apr 16 14:20:25 CDT 2007
There are a few places dealing with surfaces that do this, the next
patch replaces those instances with this function. Some of the later
patches in this set also use this.
Changelog:
- Add a function to determine if a surface is the front or the
backbuffer for a swapchain, and return the corresponding GLenum
-------------- next part --------------
---
dlls/wined3d/surface.c | 17 +++++++++++++++++
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 117c457..049b827 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -287,6 +287,23 @@ void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int wi
checkGLcall("set_compatible_renderbuffer");
}
+GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain) {
+ IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
+ IWineD3DSwapChainImpl *swapchain_impl = (IWineD3DSwapChainImpl *)swapchain;
+
+ TRACE("(%p) : swapchain %p\n", This, swapchain);
+
+ if (swapchain_impl->backBuffer && swapchain_impl->backBuffer[0] == iface) {
+ TRACE("Returning GL_BACK\n");
+ return GL_BACK;
+ } else if (swapchain_impl->frontBuffer == iface) {
+ TRACE("Returning GL_FRONT\n");
+ return GL_FRONT;
+ }
+
+ FIXME("Higher back buffer, returning GL_BACK\n");
+ return GL_BACK;
+}
/* *******************************************
IWineD3DSurface IUnknown parts follow
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9fb4343..3de938a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1412,6 +1412,7 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DT
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
+GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);
int D3DFmtMakeGlCfg(WINED3DFORMAT BackBufferFormat, WINED3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate);
More information about the wine-patches
mailing list