Commit ef0f3588 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Don't call glPointParameter with a random context.

parent 0a973877
...@@ -1575,23 +1575,6 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, ...@@ -1575,23 +1575,6 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain,
checkGLcall("glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE)"); checkGLcall("glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE)");
} }
if (gl_info->supported[WINED3D_GL_VERSION_2_0])
{
/* 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]) if (gl_info->supported[ARB_PROVOKING_VERTEX])
{ {
GL_EXTCALL(glProvokingVertex(GL_FIRST_VERTEX_CONVENTION)); GL_EXTCALL(glProvokingVertex(GL_FIRST_VERTEX_CONVENTION));
...@@ -2019,27 +2002,9 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) ...@@ -2019,27 +2002,9 @@ 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, static inline void context_set_render_offscreen(struct wined3d_context *context, const struct StateEntry *StateTable,
BOOL offscreen) BOOL offscreen)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info;
if (context->render_offscreen == offscreen) return; if (context->render_offscreen == offscreen) return;
if (gl_info->supported[WINED3D_GL_VERSION_2_0]) Context_MarkStateDirty(context, STATE_POINTSPRITECOORDORIGIN, StateTable);
{
/* 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); Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable);
Context_MarkStateDirty(context, STATE_VDECL, StateTable); Context_MarkStateDirty(context, STATE_VDECL, StateTable);
Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable); Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable);
......
...@@ -4963,6 +4963,34 @@ static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi ...@@ -4963,6 +4963,34 @@ static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
} }
} }
static void psorigin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
static BOOL warned;
if (!warned)
{
WARN("Point sprite coordinate origin switching not supported.\n");
warned = TRUE;
}
}
static void psorigin(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
GLint origin = context->render_offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT;
if (glPointParameteri)
{
glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, origin);
checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, ...)");
}
else if (gl_info->supported[NV_POINT_SPRITE])
{
GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, origin));
checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, ...)");
}
}
const struct StateEntryTemplate misc_state_template[] = { const struct StateEntryTemplate misc_state_template[] = {
{ STATE_RENDER(WINED3DRS_SRCBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_SRCBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3DRS_DESTBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_DESTBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE },
...@@ -4978,6 +5006,9 @@ const struct StateEntryTemplate misc_state_template[] = { ...@@ -4978,6 +5006,9 @@ const struct StateEntryTemplate misc_state_template[] = {
{ STATE_VDECL, { STATE_VDECL, streamsrc }, WINED3D_GL_EXT_NONE }, { STATE_VDECL, { STATE_VDECL, streamsrc }, WINED3D_GL_EXT_NONE },
{ STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, WINED3D_GL_EXT_NONE }, { STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, WINED3D_GL_EXT_NONE },
{ STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, WINED3D_GL_EXT_NONE }, { STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, WINED3D_GL_EXT_NONE },
{ STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin }, WINED3D_GL_VERSION_2_0 },
{ STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin_w }, WINED3D_GL_EXT_NONE },
/* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and /* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and
* vshader loadings are untied from each other * vshader loadings are untied from each other
*/ */
...@@ -5810,6 +5841,7 @@ static void validate_state_table(struct StateEntry *state_table) ...@@ -5810,6 +5841,7 @@ static void validate_state_table(struct StateEntry *state_table)
STATE_VIEWPORT, STATE_VIEWPORT,
STATE_SCISSORRECT, STATE_SCISSORRECT,
STATE_FRONTFACE, STATE_FRONTFACE,
STATE_POINTSPRITECOORDORIGIN,
}; };
unsigned int i, current; unsigned int i, current;
......
...@@ -2212,6 +2212,8 @@ const char *debug_d3dstate(DWORD state) ...@@ -2212,6 +2212,8 @@ const char *debug_d3dstate(DWORD state)
return "STATE_MATERIAL"; return "STATE_MATERIAL";
if (STATE_IS_FRONTFACE(state)) if (STATE_IS_FRONTFACE(state))
return "STATE_FRONTFACE"; return "STATE_FRONTFACE";
if (STATE_IS_POINTSPRITECOORDORIGIN(state))
return "STATE_POINTSPRITECOORDORIGIN";
return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state); return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state);
} }
......
...@@ -992,7 +992,10 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC ...@@ -992,7 +992,10 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC
#define STATE_FRONTFACE (STATE_MATERIAL + 1) #define STATE_FRONTFACE (STATE_MATERIAL + 1)
#define STATE_IS_FRONTFACE(a) ((a) == STATE_FRONTFACE) #define STATE_IS_FRONTFACE(a) ((a) == STATE_FRONTFACE)
#define STATE_HIGHEST (STATE_FRONTFACE) #define STATE_POINTSPRITECOORDORIGIN (STATE_FRONTFACE + 1)
#define STATE_IS_POINTSPRITECOORDORIGIN(a) ((a) == STATE_POINTSPRITECOORDORIGIN)
#define STATE_HIGHEST (STATE_POINTSPRITECOORDORIGIN)
enum fogsource { enum fogsource {
FOGSOURCE_FFP, FOGSOURCE_FFP,
......
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