This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/114/head
in repository efl.

View the commit online.

commit 074bcb4401d653e1be5debc4dcc9ea1491e6dcb9
Author: [email protected] <[email protected]>
AuthorDate: Sun Sep 13 18:21:42 2026 -0600

    evas_ector_gl: use one fill type numbering from C to the span shaders
    
    Raster's review was confused by two numberings that sound like the same
    thing. Each side of a span quad carried both:
    
    - type, ector's Span_Data_Type (1 solid, 2 linear, 3 radial), tested
      against SPAN_FILL_TYPE_GRADIENT_MIN = 2;
    - grad_type, a second shader-only encoding (SPAN_GRAD_TYPE_*: 0 linear,
      1 radial, 2 solid) written into the .w of the grad_def attribute.
    
    So 2 meant "linear gradient" in one place and "solid" a few lines away.
    
    Keep only Span_Data_Type:
    
    - evas_ector_gl_span_types.h defines SPAN_FILL_TYPE_SOLID,
      SPAN_FILL_TYPE_LINEAR_GRADIENT and SPAN_FILL_TYPE_RADIAL_GRADIENT for
      gl_common and the shaders, which cannot include the ector header.
      SPAN_FILL_TYPE_GRADIENT_MIN becomes an alias of the linear value. The
      SPAN_GRAD_TYPE_* defines are removed.
    - grad_type is removed from Span_Channel_Params, along with the
      out_gtype parameter of _compute_gradient_coeffs() and its locals.
      _span_side_grad_set() writes the side's type into def.w.
    - The gradient shader tests gtype below SPAN_FILL_TYPE_GRADIENT_MIN for
      a plain colour and SPAN_FILL_TYPE_RADIAL_GRADIENT for radial. The
      values are pasted into the GLSL source from the C defines.
    - gl_generic/evas_engine.c, which sees both, fails the build if the
      SPAN_FILL_TYPE_* values ever differ from Span_Data_Type.
    
    Rendering cannot change. A radial gradient that falls back to solid
    already sets type to Solid, and a shape whose atlas lookup fails is
    skipped before drawing, so grad_type never held anything type did not.
    
    Verified with the expedite GL parity harness on VG tests 117-126: the
    opengl_x11 frames before and after this change are pixel-identical, and
    parity against the software engine is unchanged (9 pass, 123 still shows
    its known mask-edge anti-aliasing difference). The build is clean, and
    ector_suite and evas_suite pass.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
 .../engines/gl_common/evas_ector_gl_span_types.h   | 38 ++++++++++------------
 .../evas/engines/gl_common/evas_gl_common.h        |  5 ++-
 .../evas/engines/gl_common/evas_gl_context.c       | 10 +++---
 .../evas/engines/gl_generic/evas_ector_gl_span.h   |  2 +-
 .../engines/gl_generic/evas_ector_gl_span_shader.c |  9 +++--
 src/modules/evas/engines/gl_generic/evas_engine.c  | 20 ++++++------
 6 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/src/modules/evas/engines/gl_common/evas_ector_gl_span_types.h b/src/modules/evas/engines/gl_common/evas_ector_gl_span_types.h
index 23035b5987..ee0f3ef7a1 100644
--- a/src/modules/evas/engines/gl_common/evas_ector_gl_span_types.h
+++ b/src/modules/evas/engines/gl_common/evas_ector_gl_span_types.h
@@ -4,7 +4,7 @@
 //   - Span_Variant enum
 //   - Span_Vertex_* interleaved vertex structs
 //   - span_vertex_size() helper
-//   - SPAN_PIPE_MAX_QUADS and SPAN_FILL_TYPE_GRADIENT_MIN macros
+//   - SPAN_PIPE_MAX_QUADS and the SPAN_FILL_TYPE_* fill type macros
 //
 // Deliberately has NO dependency on sw_ft_raster.h, GL headers, or any
 // EFL private header so it can be included from both gl_common (which
@@ -25,28 +25,24 @@ typedef float GLfloat;
 # endif
 
 // ---------------------------------------------------------------------------
-// Fill-type threshold: Span_Data_Type values >= this are gradient types.
-// Span_Data_Type: 1=Solid, 2=LinearGradient, 3=RadialGradient.
-// evas_gl_context.c cannot include evas_ector_gl_span.h (sw_ft_raster.h
-// dependency), so it tests fill.type against this macro instead of the enum.
-// ---------------------------------------------------------------------------
-#define SPAN_FILL_TYPE_GRADIENT_MIN 2
-
-// ---------------------------------------------------------------------------
-// Gradient type carried in the .w of a side's grad_def attribute:
-//   0 linear, 1 radial, 2 solid.
+// Fill type of one side of a span quad, as stored in Span_Channel_Params.type
+// and handed to the gradient shaders in the .w of that side's grad_def
+// attribute.  These are ector's Span_Data_Type values (0 is None).  gl_common
+// and the GLSL sources cannot include ector_software_private.h, so the values
+// are mirrored here and gl_generic/evas_engine.c checks at build time that
+// they still match the enum.
 //
-// "Solid" is how a plain colour rides in a gradient variant.  A shape with a
-// gradient fill and a solid stroke would otherwise need two programs and so
-// two draw calls; encoding the solid side as a degenerate gradient lets one
-// draw cover both.  Such a side puts its premultiplied colour in the four
-// components of grad_abc_y - the slots a linear gradient uses for its
-// coefficients and ramp row - and the shader takes it verbatim instead of
-// sampling the ramp atlas.
+// A type below SPAN_FILL_TYPE_GRADIENT_MIN is a plain colour.  In a gradient
+// variant such a side still rides along, so that a shape with a gradient fill
+// and a solid stroke needs one program and one draw rather than two: it puts
+// its premultiplied colour in the four components of grad_abc_y - the slots a
+// linear gradient uses for its coefficients and ramp row - and the shader
+// takes it verbatim instead of sampling the ramp atlas.
 // ---------------------------------------------------------------------------
-#define SPAN_GRAD_TYPE_LINEAR 0
-#define SPAN_GRAD_TYPE_RADIAL 1
-#define SPAN_GRAD_TYPE_SOLID  2
+#define SPAN_FILL_TYPE_SOLID           1
+#define SPAN_FILL_TYPE_LINEAR_GRADIENT 2
+#define SPAN_FILL_TYPE_RADIAL_GRADIENT 3
+#define SPAN_FILL_TYPE_GRADIENT_MIN    SPAN_FILL_TYPE_LINEAR_GRADIENT
 
 // ---------------------------------------------------------------------------
 // Span_Variant — selects the interleaved vertex layout for a given draw call.
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index be44bfa922..cd2f930400 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -47,7 +47,7 @@
 #include "evas_gl_define.h"
 
 // Per-variant span-buffer interleaved vertex types, shared macros, and
-// the SPAN_FILL_TYPE_GRADIENT_MIN threshold constant.
+// the SPAN_FILL_TYPE_* fill type constants.
 // Single source of truth — no duplication with evas_ector_gl_span.h.
 #include "evas_ector_gl_span_types.h"
 
@@ -284,13 +284,12 @@ typedef struct _Span_Channel_Params {
    float    off_tx;     // texel x-offset in pool
    float    off_ty;     // texel y-offset in pool
    uint32_t col;        // base color (premultiplied ARGB)
-   int      type;       // Span_Data_Type: Solid, LinearGradient, RadialGradient
+   int      type;       // SPAN_FILL_TYPE_* (ector's Span_Data_Type)
    int      x_min;      // spatial split x_min
    // Gradient parameters (unused for Solid type)
    float    grad_a, grad_b, grad_c;  // linear: t = a*px + b*py + c
    int      grad_spread;             // 0=PAD, 1=REFLECT, 2=REPEAT
    float    grad_ramp_y;             // atlas V coordinate: (row+0.5)/SPAN_GRAD_ATLAS_H
-   int      grad_type;               // 0=linear, 1=radial
    float    grad_d, grad_e, grad_f;  // radial: 2nd affine row
    float    grad_ra, grad_rdx, grad_rdy; // radial: quadratic params
 } Span_Channel_Params;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index 3d5d4ae7e7..a28030f1fa 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -2062,9 +2062,9 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
    PUSH_6_COLORS(pn, r, g, b, a);
 }
 
-// Write one side's gradient attributes.  A side that is not actually a
-// gradient travels as SPAN_GRAD_TYPE_SOLID with its colour in abc_y, so that
-// a mixed fill/stroke shape needs one program rather than two.
+// Write one side's gradient attributes.  The side's fill type goes in
+// def.w.  A side that is not actually a gradient carries its colour in abc_y,
+// so that a mixed fill/stroke shape needs one program rather than two.
 static void
 _span_side_grad_set(GLfloat abc_y[4], GLfloat def[4], GLfloat radial[4],
                     const Span_Channel_Params *side)
@@ -2076,7 +2076,7 @@ _span_side_grad_set(GLfloat abc_y[4], GLfloat def[4], GLfloat radial[4],
         abc_y[2] = (float)( side->col        & 0xFF) / 255.0f;
         abc_y[3] = (float)((side->col >> 24) & 0xFF) / 255.0f;
         def[0] = def[1] = def[2] = 0.0f;
-        def[3] = (GLfloat)SPAN_GRAD_TYPE_SOLID;
+        def[3] = (GLfloat)side->type;
         radial[0] = radial[1] = radial[2] = radial[3] = 0.0f;
         return;
      }
@@ -2088,7 +2088,7 @@ _span_side_grad_set(GLfloat abc_y[4], GLfloat def[4], GLfloat radial[4],
    def[0]    = side->grad_d;
    def[1]    = side->grad_e;
    def[2]    = side->grad_f;
-   def[3]    = (GLfloat)side->grad_type;
+   def[3]    = (GLfloat)side->type;
    radial[0] = side->grad_ra;
    radial[1] = side->grad_rdx;
    radial[2] = side->grad_rdy;
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.h b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.h
index 51b4f66725..4b55be62b3 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span.h
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span.h
@@ -423,7 +423,7 @@ void span_debug_readback(const char *label, unsigned int tex_id,
 // Per-variant interleaved vertex structs (Task 3)
 // ------------------------------------------------------------------
 
-// Per-variant vertex types, SPAN_PIPE_MAX_QUADS, SPAN_FILL_TYPE_GRADIENT_MIN.
+// Per-variant vertex types, SPAN_PIPE_MAX_QUADS, SPAN_FILL_TYPE_*.
 // Single source of truth shared with gl_common (no sw_ft_raster.h dependency).
 #include "../gl_common/evas_ector_gl_span_types.h"
 
diff --git a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
index 959b38df75..a573b34406 100644
--- a/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
+++ b/src/modules/evas/engines/gl_generic/evas_ector_gl_span_shader.c
@@ -25,6 +25,11 @@
 #include "evas_ector_gl_span.h"
 #include "evas_ector_gl_grad_atlas.h"
 
+// Paste a C integer constant into GLSL source, so C and the shaders share
+// one definition.  The indirection expands the macro before stringifying.
+#define SPAN_GLSL_INT_(x) #x
+#define SPAN_GLSL_INT(x)  SPAN_GLSL_INT_(x)
+
 // Scratch buffer for the no-EXT_unpack_subimage upload path: span rows are
 // copied here tightly packed so one glTexSubImage2D covers the whole
 // sub-rect.  Grown on demand, never shrunk; freed in span_shader_shutdown.
@@ -522,14 +527,14 @@ static const char _glsl_scan_gradient_spans[] =
    "      if (int(px) >= sx && int(px) < sx + len) {\n"
    "         vec4 grad_col;\n"
    "         SPAN_HP float t;\n"
-   "         if (gtype == 2) {\n"
+   "         if (gtype < " SPAN_GLSL_INT(SPAN_FILL_TYPE_GRADIENT_MIN) ") {\n"
    "            /* Plain colour riding in a gradient variant: the four\n"
    "             * gradient-coefficient slots carry it verbatim, so that a\n"
    "             * shape with a gradient fill and a solid stroke needs one\n"
    "             * program and one draw rather than two. */\n"
    "            grad_col = vec4(ga, gb, gc, ramp_v);\n"
    "         } else {\n"
-   "         if (gtype == 1) {\n"
+   "         if (gtype == " SPAN_GLSL_INT(SPAN_FILL_TYPE_RADIAL_GRADIENT) ") {\n"
    "            /* Radial gradient: quadratic solve in gradient space */\n"
    "            SPAN_HP float rx = ga * px + gb * py + gc;\n"
    "            SPAN_HP float ry = gd * px + ge * py + gf;\n"
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 8da2460409..c1d8695263 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -3063,14 +3063,12 @@ _span_gradient_radial_coeffs(Ector_Renderer_Software_Gradient_Data *gd,
 // @param out_gs           Gradient spread mode (EFL enum → int).
 // @param out_gramp_y      Atlas V coordinate for this gradient's ramp row.
 // @param out_atlas_skip   Set to EINA_TRUE if atlas lookup failed (skip shape).
-// @param out_gtype        0=linear, 1=radial.
 static void
 _compute_gradient_coeffs(Span_Collector *sc,
                          Span_Grad_Atlas *atlas,
                          int *inout_shader_type, uint32_t *inout_col,
                          float *out_ga, float *out_gb, float *out_gc,
                          int *out_gs, float *out_gramp_y, Eina_Bool *out_atlas_skip,
-                         int *out_gtype,
                          float *out_gd, float *out_ge, float *out_gf,
                          float *out_gra, float *out_grdx, float *out_grdy)
 {
@@ -3142,7 +3140,6 @@ _compute_gradient_coeffs(Span_Collector *sc,
                                      sc->grad_offx, sc->grad_offy,
                                      0.0f, 0.0f,
                                      out_ga, out_gb, out_gc);
-        *out_gtype = 0;
      }
    else // RadialGradient
      {
@@ -3160,12 +3157,19 @@ _compute_gradient_coeffs(Span_Collector *sc,
                                      out_ga, out_gb, out_gc,
                                      out_gd, out_ge, out_gf,
                                      out_gra, out_grdx, out_grdy);
-        *out_gtype = 1;
      }
 
    *out_gs = (int)gd->gd->s;
 }
 
+// gl_common and the span shaders use SPAN_FILL_TYPE_* because they cannot
+// see ector's Span_Data_Type.  This translation unit sees both, so fail the
+// build here if the two ever drift apart.
+typedef char _span_fill_type_matches_span_data_type[
+   (((int)Solid          == SPAN_FILL_TYPE_SOLID) &&
+    ((int)LinearGradient == SPAN_FILL_TYPE_LINEAR_GRADIENT) &&
+    ((int)RadialGradient == SPAN_FILL_TYPE_RADIAL_GRADIENT)) ? 1 : -1];
+
 static void
 eng_ector_end(void *engine,
               void *surface,
@@ -3326,7 +3330,6 @@ eng_ector_end(void *engine,
                      int   fill_gs = 0;
                      float fill_gramp_y = 0.0f;
                      Eina_Bool fill_atlas_skip = EINA_FALSE;
-                     int   fill_gtype = 0;
                      float fill_gd = 0.0f, fill_ge = 0.0f, fill_gf = 0.0f;
                      float fill_gra = 0.0f, fill_grdx = 0.0f, fill_grdy = 0.0f;
 
@@ -3334,7 +3337,6 @@ eng_ector_end(void *engine,
                      int   stroke_gs = 0;
                      float stroke_gramp_y = 0.0f;
                      Eina_Bool stroke_atlas_skip = EINA_FALSE;
-                     int   stroke_gtype = 0;
                      float stroke_gd = 0.0f, stroke_ge = 0.0f, stroke_gf = 0.0f;
                      float stroke_gra = 0.0f, stroke_grdx = 0.0f, stroke_grdy = 0.0f;
 
@@ -3349,14 +3351,14 @@ eng_ector_end(void *engine,
                                                       &fill_shader_type, &fill_col,
                                                       &fill_ga, &fill_gb, &fill_gc_coef,
                                                       &fill_gs, &fill_gramp_y,
-                                                      &fill_atlas_skip, &fill_gtype,
+                                                      &fill_atlas_skip,
                                                       &fill_gd, &fill_ge, &fill_gf,
                                                       &fill_gra, &fill_grdx, &fill_grdy);
                              _compute_gradient_coeffs(sc_stroke, atlas,
                                                       &stroke_shader_type, &stroke_col,
                                                       &stroke_ga, &stroke_gb, &stroke_gc_coef,
                                                       &stroke_gs, &stroke_gramp_y,
-                                                      &stroke_atlas_skip, &stroke_gtype,
+                                                      &stroke_atlas_skip,
                                                       &stroke_gd, &stroke_ge, &stroke_gf,
                                                       &stroke_gra, &stroke_grdx, &stroke_grdy);
                           }
@@ -3434,7 +3436,6 @@ eng_ector_end(void *engine,
                                 _spp.fill.grad_c     = fill_gc_coef;
                                 _spp.fill.grad_spread  = fill_gs;
                                 _spp.fill.grad_ramp_y  = fill_gramp_y;
-                                _spp.fill.grad_type    = fill_gtype;
                                 _spp.fill.grad_d     = fill_gd;
                                 _spp.fill.grad_e     = fill_ge;
                                 _spp.fill.grad_f     = fill_gf;
@@ -3453,7 +3454,6 @@ eng_ector_end(void *engine,
                                 _spp.stroke.grad_c     = stroke_gc_coef;
                                 _spp.stroke.grad_spread  = stroke_gs;
                                 _spp.stroke.grad_ramp_y  = stroke_gramp_y;
-                                _spp.stroke.grad_type    = stroke_gtype;
                                 _spp.stroke.grad_d     = stroke_gd;
                                 _spp.stroke.grad_e     = stroke_ge;
                                 _spp.stroke.grad_f     = stroke_gf;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to