[PATCH 1/2] wined3d: Also flip the point sprite coordinate origin when rendering offscreen.

Henri Verbeet hverbeet at codeweavers.com
Fri Jun 11 09:05:23 CDT 2010


I originally intended to send this after 1.2, but it turns out this actually
fixes a regression for applications that use point sprites and are forced to
render offscreen by e.g. dc918d43946462ad4c04ed373cda72d1ebe9b6d3.
---
 dlls/wined3d/context.c    |   12 ++++++++++++
 dlls/wined3d/directx.c    |    2 ++
 dlls/wined3d/drawprim.c   |    7 +++++++
 dlls/wined3d/wined3d_gl.h |    3 +++
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5304af2..f21c805 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1482,6 +1482,12 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
         checkGLcall("glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE)");
     }
 
+    if (gl_info->supported[WINED3D_GL_VERSION_2_0])
+    {
+        glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT);
+        checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)");
+    }
+
     if (gl_info->supported[ARB_PROVOKING_VERTEX])
     {
         GL_EXTCALL(glProvokingVertex(GL_FIRST_VERTEX_CONVENTION));
@@ -1939,6 +1945,12 @@ static inline void context_set_render_offscreen(struct wined3d_context *context,
 {
     if (context->render_offscreen == offscreen) return;
 
+    if (context->gl_info->supported[WINED3D_GL_VERSION_2_0])
+    {
+        glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT);
+        checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, ...)");
+    }
+
     Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable);
     Context_MarkStateDirty(context, STATE_VDECL, StateTable);
     Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 088cfe0..424271b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2287,6 +2287,8 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter)
         }
     }
 
+    if (gl_version >= MAKEDWORD_VERSION(2, 0)) gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
+
     if (gl_info->supported[APPLE_FENCE])
     {
         /* GL_NV_fence and GL_APPLE_fence provide the same functionality basically.
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 1671e7b..304ab23 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -644,6 +644,13 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
         }
     }
 
+    if (!context->gl_info->supported[WINED3D_GL_VERSION_2_0] && context->render_offscreen
+            && This->stateBlock->renderState[WINED3DRS_POINTSPRITEENABLE]
+            && This->stateBlock->gl_primitive_type == GL_POINTS)
+    {
+        FIXME("Point sprite coordinate origin switching not supported.\n");
+    }
+
     /* Ok, we will be updating the screen from here onwards so grab the lock */
     ENTER_GL();
     {
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 4ece7e7..b2dfddf 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -1353,6 +1353,7 @@ void (WINE_GLAPI *glVertex4sv)(const GLshort *v) DECLSPEC_HIDDEN;
 void (WINE_GLAPI *glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) DECLSPEC_HIDDEN;
 void (WINE_GLAPI *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) DECLSPEC_HIDDEN;
 void (WINE_GLAPI *glPointParameterfv)(GLenum pname, const GLfloat *params) DECLSPEC_HIDDEN;
+void (WINE_GLAPI *glPointParameteri)(GLenum name, GLint value) DECLSPEC_HIDDEN;
 
 /* glFinish and glFlush are always loaded from opengl32.dll, thus they always have
  * __stdcall calling convention.
@@ -1708,6 +1709,7 @@ BOOL (WINAPI *pwglShareLists)(HGLRC, HGLRC) DECLSPEC_HIDDEN;
     USE_GL_FUNC(glVertexPointer) \
     USE_GL_FUNC(glViewport) \
     USE_GL_FUNC(glPointParameterfv) \
+    USE_GL_FUNC(glPointParameteri) \
 
 #define WGL_FUNCS_GEN \
     USE_WGL_FUNC(wglCreateContext) \
@@ -1835,6 +1837,7 @@ typedef enum wined3d_gl_extension
     WGL_WINE_PIXEL_FORMAT_PASSTHROUGH,
     /* Internally used */
     WINE_NORMALIZED_TEXRECT,
+    WINED3D_GL_VERSION_2_0,
 
     WINED3D_GL_EXT_COUNT,
 } GL_SupportedExt;
-- 
1.6.4.4




More information about the wine-patches mailing list