Chip Davis : wined3d: Remove WINED3D_RS_EDGEANTIALIAS.

Alexandre Julliard julliard at winehq.org
Fri Apr 17 16:12:57 CDT 2020


Module: wine
Branch: master
Commit: 42e932e63f0cb3b313f4eb55dae3c1a9c401e0a0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=42e932e63f0cb3b313f4eb55dae3c1a9c401e0a0

Author: Chip Davis <cdavis at codeweavers.com>
Date:   Thu Apr 16 14:30:43 2020 -0500

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 at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/device.c        | 15 ++++++++++++---
 dlls/ddraw/ddraw.c        |  2 ++
 dlls/ddraw/device.c       | 12 +++++++++---
 dlls/wined3d/state.c      | 13 +++++--------
 dlls/wined3d/stateblock.c |  1 -
 dlls/wined3d/utils.c      |  1 -
 include/wine/wined3d.h    |  2 --
 7 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 6a67f81778..e123502dab 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -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)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 2a4900ea7b..1c104548f6 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -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                   |
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index e09100dfdc..3f1fe08c11 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -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)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index d375122781..1cb9f222ea 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -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},
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 48d133485b..7e97c84c19 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -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;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 211160ad4d..9510eaaa91 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -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);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0b3b41896e..d3eb8100cd 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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




More information about the wine-cvs mailing list