diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index f21c80516ae..8029f4f7261 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1484,8 +1484,19 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3 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)"); + /* Windows doesn't support to query the glPointParameteri function pointer, so use the + * NV_POINT_SPRITE extension. + */ + if (glPointParameteri) + { + glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT); + checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)"); + } + else if (gl_info->supported[NV_POINT_SPRITE]) + { + GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)); + checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)"); + } } if (gl_info->supported[ARB_PROVOKING_VERTEX]) @@ -1943,12 +1954,25 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) static inline void context_set_render_offscreen(struct wined3d_context *context, const struct StateEntry *StateTable, BOOL offscreen) { + const struct wined3d_gl_info *gl_info = context->gl_info; + if (context->render_offscreen == offscreen) return; - if (context->gl_info->supported[WINED3D_GL_VERSION_2_0]) + if (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, ...)"); + /* Windows doesn't support to query the glPointParameteri function pointer, so use the + * NV_POINT_SPRITE extension. + */ + if (glPointParameteri) + { + glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT); + checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); + } + else if (gl_info->supported[NV_POINT_SPRITE]) + { + GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT)); + checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); + } } Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 0c4e99400c6..8c744ff2c84 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -138,6 +138,7 @@ static const struct { {"GL_NV_fragment_program_option", NV_FRAGMENT_PROGRAM_OPTION, 0 }, {"GL_NV_half_float", NV_HALF_FLOAT, 0 }, {"GL_NV_light_max_exponent", NV_LIGHT_MAX_EXPONENT, 0 }, + {"GL_NV_point_sprite", NV_POINT_SPRITE, 0 }, {"GL_NV_register_combiners", NV_REGISTER_COMBINERS, 0 }, {"GL_NV_register_combiners2", NV_REGISTER_COMBINERS2, 0 }, {"GL_NV_texgen_reflection", NV_TEXGEN_REFLECTION, 0 }, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 304ab23fa86..650ddf6504f 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -644,7 +644,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT } } - if (!context->gl_info->supported[WINED3D_GL_VERSION_2_0] && context->render_offscreen + if ((!context->gl_info->supported[WINED3D_GL_VERSION_2_0] + || (!glPointParameteri && !context->gl_info->supported[NV_POINT_SPRITE])) + && context->render_offscreen && This->stateBlock->renderState[WINED3DRS_POINTSPRITEENABLE] && This->stateBlock->gl_primitive_type == GL_POINTS) { diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index b2dfddf68df..e069ae6dc87 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -1818,6 +1818,7 @@ typedef enum wined3d_gl_extension NV_FRAGMENT_PROGRAM_OPTION, NV_HALF_FLOAT, NV_LIGHT_MAX_EXPONENT, + NV_POINT_SPRITE, NV_REGISTER_COMBINERS, NV_REGISTER_COMBINERS2, NV_TEXGEN_REFLECTION, @@ -3482,6 +3483,16 @@ typedef void (WINE_GLAPI *PGLFNVERTEXATTRIBS4HVNVPROC)(GLuint index, GLsizei n, #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #endif +/* GL_NV_point_sprite */ +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#define GL_NV_POINT_SPRITE_NV 0x8861 +#define GL_NV_COORD_REPLACE_NV 0x8862 +#define GL_NV_POINT_SPRITE_R_MODE_NV 0x8863 +#endif +typedef void (WINE_GLAPI *PGLFNPOINTPARAMETERIVNVPROC)(GLenum pname, const GLint *params); +typedef void (WINE_GLAPI *PGLFNPOINTPARAMETERINVPROC)(GLenum pname, GLint param); + /* GL_NV_register_combiners */ #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 @@ -4477,6 +4488,11 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma glVertexAttribs3hvNV, NV_HALF_FLOAT, NULL) \ USE_GL_FUNC(PGLFNVERTEXATTRIBS4HVNVPROC, \ glVertexAttribs4hvNV, NV_HALF_FLOAT, NULL) \ + /* GL_NV_point_sprite */ \ + USE_GL_FUNC(PGLFNPOINTPARAMETERIVNVPROC, \ + glPointParameterivNV, NV_POINT_SPRITE, NULL) \ + USE_GL_FUNC(PGLFNPOINTPARAMETERINVPROC, \ + glPointParameteriNV, NV_POINT_SPRITE, NULL) \ /* GL_NV_register_combiners */ \ USE_GL_FUNC(PGLFNCOMBINERINPUTNVPROC, \ glCombinerInputNV, NV_REGISTER_COMBINERS, NULL) \