wined3d: Remove WINED3D_RS_EDGEANTIALIAS.

Handle this render state similarly to D3DRS_ZFUNC, by mapping it in the
client DLLs.

As far as I can tell, save for the fact that it's only supposed to apply
to lines forming a convex outline, it's roughly equivalent to
D3DRS_ANTIALIASEDLINEENABLE. We definitely handled it the same way.

Curiously, even though we supported the render state, we didn't set the
corresponding capability bit. Do that now.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Chip Davis 2020-04-16 14:30:43 -05:00 committed by Alexandre Julliard
parent c24551cae8
commit 42e932e63f
7 changed files with 28 additions and 18 deletions

View File

@ -422,6 +422,9 @@ void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d
| D3DPTFILTERCAPS_MIPFLINEAR | D3DPTFILTERCAPS_MAGFPOINT | D3DPTFILTERCAPS_MAGFLINEAR
| D3DPTFILTERCAPS_MAGFANISOTROPIC | D3DPTFILTERCAPS_MAGFAFLATCUBIC
| D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC;
if (caps->LineCaps & WINED3DLINECAPS_ANTIALIAS)
caps->RasterCaps |= D3DPRASTERCAPS_ANTIALIASEDGES;
caps->LineCaps &= ~WINED3DLINECAPS_ANTIALIAS;
caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
caps->VertexProcessingCaps &= D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7
| D3DVTXPCAPS_DIRECTIONALLIGHTS | D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER
@ -446,9 +449,15 @@ static enum wined3d_transform_state wined3d_transform_state_from_d3d(D3DTRANSFOR
static enum wined3d_render_state wined3d_render_state_from_d3d(D3DRENDERSTATETYPE state)
{
if (state == D3DRS_ZBIAS)
return WINED3D_RS_DEPTHBIAS;
return (enum wined3d_render_state)state;
switch (state)
{
case D3DRS_ZBIAS:
return WINED3D_RS_DEPTHBIAS;
case D3DRS_EDGEANTIALIAS:
return WINED3D_RS_ANTIALIASEDLINEENABLE;
default:
return (enum wined3d_render_state)state;
}
}
static enum wined3d_primitive_type wined3d_primitive_type_from_d3d(D3DPRIMITIVETYPE type)

View File

@ -1340,6 +1340,8 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
if (caps->dpcLineCaps.dwRasterCaps & WINED3DPRASTERCAPS_DEPTHBIAS)
caps->dpcLineCaps.dwRasterCaps = (caps->dpcLineCaps.dwRasterCaps | D3DPRASTERCAPS_ZBIAS)
& ~WINED3DPRASTERCAPS_DEPTHBIAS;
if (wined3d_caps.LineCaps & WINED3DLINECAPS_ANTIALIAS)
caps->dpcLineCaps.dwRasterCaps |= D3DPRASTERCAPS_ANTIALIASEDGES;
caps->dpcLineCaps.dwZCmpCaps &= (
D3DPCMPCAPS_NEVER | D3DPCMPCAPS_LESS | D3DPCMPCAPS_EQUAL |

View File

@ -74,9 +74,15 @@ static inline WORD d3d_fpu_setup(void)
static enum wined3d_render_state wined3d_render_state_from_ddraw(D3DRENDERSTATETYPE state)
{
if (state == D3DRENDERSTATE_ZBIAS)
return WINED3D_RS_DEPTHBIAS;
return (enum wined3d_render_state)state;
switch (state)
{
case D3DRENDERSTATE_ZBIAS:
return WINED3D_RS_DEPTHBIAS;
case D3DRENDERSTATE_EDGEANTIALIAS:
return WINED3D_RS_ANTIALIASEDLINEENABLE;
default:
return (enum wined3d_render_state)state;
}
}
static enum wined3d_transform_state wined3d_transform_state_from_ddraw(D3DTRANSFORMSTATETYPE state)

View File

@ -1798,12 +1798,9 @@ static void state_msaa(struct wined3d_context *context, const struct wined3d_sta
}
}
static void state_line_antialias(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
static void line_antialias(const struct wined3d_rasterizer_state *r, const struct wined3d_gl_info *gl_info)
{
const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
const struct wined3d_rasterizer_state *r = state->rasterizer_state;
if (state->render_states[WINED3D_RS_EDGEANTIALIAS] || (r && r->desc.line_antialias))
if (r && r->desc.line_antialias)
{
gl_info->gl_ops.gl.p_glEnable(GL_LINE_SMOOTH);
checkGLcall("glEnable(GL_LINE_SMOOTH)");
@ -4427,7 +4424,7 @@ static void rasterizer(struct wined3d_context *context, const struct wined3d_sta
cullmode(r, gl_info);
depth_clip(r, gl_info);
scissor(r, gl_info);
state_line_antialias(context, state, STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE));
line_antialias(r, gl_info);
}
static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -4445,7 +4442,7 @@ static void rasterizer_cc(struct wined3d_context *context, const struct wined3d_
cullmode(r, gl_info);
depth_clip(r, gl_info);
scissor(r, gl_info);
state_line_antialias(context, state, STATE_RENDER(WINED3D_RS_ANTIALIASEDLINEENABLE));
line_antialias(r, gl_info);
}
static void psorigin_w(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
@ -4602,7 +4599,6 @@ const struct wined3d_state_entry_template misc_state_template[] =
{ STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, { STATE_COMPUTE_UNORDERED_ACCESS_VIEW_BINDING, state_uav_warn }, WINED3D_GL_EXT_NONE },
{ STATE_STREAM_OUTPUT, { STATE_STREAM_OUTPUT, state_so, }, WINED3D_GL_VERSION_3_2 },
{ STATE_STREAM_OUTPUT, { STATE_STREAM_OUTPUT, state_so_warn, }, WINED3D_GL_EXT_NONE },
{ STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), { STATE_RENDER(WINED3D_RS_EDGEANTIALIAS), state_line_antialias}, WINED3D_GL_EXT_NONE },
{ STATE_BLEND, { STATE_BLEND, blend_dbb }, ARB_DRAW_BUFFERS_BLEND },
{ STATE_BLEND, { STATE_BLEND, blend_db2 }, EXT_DRAW_BUFFERS2 },
{ STATE_BLEND, { STATE_BLEND, blend }, WINED3D_GL_EXT_NONE },
@ -5504,6 +5500,7 @@ static void validate_state_table(struct wined3d_state_entry *state_table)
{ 8, 8},
{ 17, 22},
{ 27, 27},
{ 40, 40},
{ 42, 45},
{ 47, 47},
{ 61, 127},

View File

@ -1665,7 +1665,6 @@ static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], c
rs[WINED3D_RS_FOGEND] = tmpfloat.d;
tmpfloat.f = 1.0f;
rs[WINED3D_RS_FOGDENSITY] = tmpfloat.d;
rs[WINED3D_RS_EDGEANTIALIAS] = FALSE;
rs[WINED3D_RS_RANGEFOGENABLE] = FALSE;
rs[WINED3D_RS_STENCILENABLE] = FALSE;
rs[WINED3D_RS_STENCILFAIL] = WINED3D_STENCIL_OP_KEEP;

View File

@ -4921,7 +4921,6 @@ const char *debug_d3drenderstate(enum wined3d_render_state state)
D3DSTATE_TO_STR(WINED3D_RS_FOGEND);
D3DSTATE_TO_STR(WINED3D_RS_FOGDENSITY);
D3DSTATE_TO_STR(WINED3D_RS_STIPPLEENABLE);
D3DSTATE_TO_STR(WINED3D_RS_EDGEANTIALIAS);
D3DSTATE_TO_STR(WINED3D_RS_COLORKEYENABLE);
D3DSTATE_TO_STR(WINED3D_RS_MIPMAPLODBIAS);
D3DSTATE_TO_STR(WINED3D_RS_RANGEFOGENABLE);

View File

@ -310,7 +310,6 @@ enum wined3d_render_state
WINED3D_RS_FOGEND = 37,
WINED3D_RS_FOGDENSITY = 38,
WINED3D_RS_STIPPLEENABLE = 39,
WINED3D_RS_EDGEANTIALIAS = 40,
WINED3D_RS_COLORKEYENABLE = 41,
WINED3D_RS_MIPMAPLODBIAS = 46,
WINED3D_RS_RANGEFOGENABLE = 48,
@ -1209,7 +1208,6 @@ enum wined3d_shader_type
#define WINED3DPRASTERCAPS_STIPPLE 0x00000200
#define WINED3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400
#define WINED3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800
#define WINED3DPRASTERCAPS_ANTIALIASEDGES 0x00001000
#define WINED3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000
#define WINED3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000
#define WINED3DPRASTERCAPS_FOGRANGE 0x00010000