Commit b648b741 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Pass fogstart==fogend to GL in fog table mode.

parent ba16113d
......@@ -6513,6 +6513,8 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi
static void state_arbfp_fog(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
enum fogsource new_source;
DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
......@@ -6541,7 +6543,7 @@ static void state_arbfp_fog(struct wined3d_context *context, const struct wined3
new_source = FOGSOURCE_FFP;
}
if (new_source != context->fog_source)
if (new_source != context->fog_source || fogstart == fogend)
{
context->fog_source = new_source;
state_fogstartend(context, state, STATE_RENDER(WINED3D_RS_FOGSTART));
......
......@@ -7086,6 +7086,8 @@ static void glsl_fragment_pipe_fog(struct wined3d_context *context,
{
BOOL use_vshader = use_vs(state);
enum fogsource new_source;
DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
context->select_shader = 1;
context->load_constants = 1;
......@@ -7107,7 +7109,7 @@ static void glsl_fragment_pipe_fog(struct wined3d_context *context,
new_source = FOGSOURCE_FFP;
}
if (new_source != context->fog_source)
if (new_source != context->fog_source || fogstart == fogend)
{
context->fog_source = new_source;
state_fogstartend(context, state, STATE_RENDER(WINED3D_RS_FOGSTART));
......
......@@ -1043,8 +1043,13 @@ void state_fogstartend(struct wined3d_context *context, const struct wined3d_sta
fogstart = tmpvalue.f;
tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
fogend = tmpvalue.f;
/* In GL, fogstart == fogend disables fog, in D3D everything's fogged.*/
if(fogstart == fogend) {
/* Special handling for fogstart == fogend. In d3d with vertex
* fog, everything is fogged. With table fog, everything with
* fog_coord < fog_start is unfogged, and fog_coord > fog_start
* is fogged. Windows drivers disagree when fog_coord == fog_start. */
if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE
&& fogstart == fogend)
{
fogstart = -INFINITY;
fogend = 0.0f;
}
......@@ -1072,6 +1077,8 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st
{
const struct wined3d_gl_info *gl_info = context->gl_info;
enum fogsource new_source;
DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
......@@ -1217,7 +1224,7 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st
glEnableWINE(GL_FOG);
checkGLcall("glEnable GL_FOG");
if (new_source != context->fog_source)
if (new_source != context->fog_source || fogstart == fogend)
{
context->fog_source = new_source;
state_fogstartend(context, state, STATE_RENDER(WINED3D_RS_FOGSTART));
......
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