<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 1, 2018 at 10:51 AM, Axel Davy <span dir="ltr"><<a href="mailto:davyaxel0@gmail.com" target="_blank">davyaxel0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div><div class="m_5629603938923675121h5"><br>
<br>
On 01/05/2018 01:43, Marek Olšák wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
<br>
This is a hypothetical interface for EQAA (a superset of CSAA). CSAA could be<br>
exposed via GL_NV_framebuffer_multisample_<wbr>coverage. EQAA additionally removes<br>
the restriction that the number of samples in all FBO attachments must match,<br>
which means it allows arbitrary sample counts in each FBO attachment.<br>
---<br>
  src/gallium/docs/source/screen<wbr>.rst   | 17 +++++++++++++++--<br>
  src/gallium/include/pipe/p_def<wbr>ines.h |  1 +<br>
  src/gallium/include/pipe/p_sta<wbr>te.h   |  3 ++-<br>
  3 files changed, 18 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/gallium/docs/source/scre<wbr>en.rst b/src/gallium/docs/source/scre<wbr>en.rst<br>
index 3837360fb40..28934c2f7b9 100644<br>
--- a/src/gallium/docs/source/scre<wbr>en.rst<br>
+++ b/src/gallium/docs/source/scre<wbr>en.rst<br>
@@ -398,20 +398,22 @@ The integer capabilities:<br>
  * ``PIPE_CAP_LOAD_CONSTBUF``: True if the driver supports TGSI_OPCODE_LOAD use<br>
    with constant buffers.<br>
  * ``PIPE_CAP_TGSI_ANY_REG_AS_ADD<wbr>RESS``: Any TGSI register can be used as<br>
    an address for indirect register indexing.<br>
  * ``PIPE_CAP_TILE_RASTER_ORDER``<wbr>: Whether the driver supports<br>
    GL_MESA_tile_raster_order, using the tile_raster_order_* fields in<br>
    pipe_rasterizer_state.<br>
  * ``PIPE_CAP_MAX_COMBINED_SHADER<wbr>_OUTPUT_RESOURCES``: Limit on combined shader<br>
    output resources (images + buffers + fragment outputs). If 0 the state<br>
    tracker works it out.<br>
+* ``PIPE_CAP_EQAA_COLOR_SAMPLE_S<wbr>UPPORT_MASK``: If the i-th bit is set, EQAA<br>
+  supports (i+1) color samples.<br>
  * ``PIPE_CAP_SIGNED_VERTEX_BUFFE<wbr>R_OFFSET``:<br>
    Whether pipe_vertex_buffer::buffer_off<wbr>set is treated as signed. The u_vbuf<br>
    module needs this for optimal performance in workstation applications.<br>
  * ``PIPE_CAP_CONTEXT_PRIORITY_MA<wbr>SK``: For drivers that support per-context<br>
    priorities, this returns a bitmask of PIPE_CONTEXT_PRIORITY_x for the<br>
    supported priority levels.  A driver that does not support prioritized<br>
    contexts can return 0.<br>
  * ``PIPE_CAP_FENCE_SIGNAL``: True if the driver supports signaling semaphores<br>
    using fence_server_signal().<br>
  * ``PIPE_CAP_CONSTBUF0_FLAGS``: The bits of pipe_resource::flags that must be<br>
@@ -743,22 +745,33 @@ Modern APIs allow using buffers as shader resources.<br>
  (1 for 1D or 1D array textures).<br>
    **depth0** the depth of the base mip level of the texture<br>
  (1 for everything else).<br>
    **array_size** the array size for 1D and 2D array textures.<br>
  For cube maps this must be 6, for other textures 1.<br>
    **last_level** the last mip map level present.<br>
  -**nr_samples** the nr of msaa samples. 0 (or 1) specifies a resource<br>
-which isn't multisampled.<br>
+**nr_samples**: For Z/S, this is the number of samples. For color, if EQAA<br>
+is unsupported, this is the number of both coverage samples and color samples.<br>
+If EQAA is supported, this is the number of coverage samples. 0 and 1<br>
+specify a resource which isn't multisampled.<br>
+<br>
+**nr_color_samples**: This is the number of color samples for EQAA, while<br>
+``nr_samples`` is the number of coverage samples. If the format is Z/S,<br>
+``nr_color_samples`` is ignored. Constraints:<br>
+* ``nr_color_samples`` must not be greater than ``nr_samples``.<br>
+* If ``nr_color_samples`` is equal to ``nr_samples``, it is called MSAA.<br>
+* If ``nr_color_samples`` is less than ``nr_samples``, it is called EQAA.<br>
+* If ``nr_color_samples`` is equal to 1, the behavior of the resolve blit is<br>
+driver-dependent.<br>
    **usage** one of the :ref:`PIPE_USAGE` flags.<br>
    **bind** bitmask of the :ref:`PIPE_BIND` flags.<br>
    **flags** bitmask of PIPE_RESOURCE_FLAG flags.<br>
  <br>
</blockquote></div></div>
To remove ambiguity, I'd suggest have both nr_coverage_samples and nr_zsc_samples (for Z/S + color)<br>
which would have to be equal if EQAA is not supported.<br>
<br>
I guess there's going to be constraints on the combination of the values of these two.<br>
I'm not sure the proposed cap is sufficient.<br>
If CSAA has more constraints than EQAA, are these constraints respected with the proposed system ?</blockquote><div><br></div><div>This is for EQAA, not CSAA, but the interface will support CSAA too.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_5629603938923675121h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
      resource_changed<br>
diff --git a/src/gallium/include/pipe/p_d<wbr>efines.h b/src/gallium/include/pipe/p_d<wbr>efines.h<br>
index c4ae0532060..97e1a3a3d42 100644<br>
--- a/src/gallium/include/pipe/p_d<wbr>efines.h<br>
+++ b/src/gallium/include/pipe/p_d<wbr>efines.h<br>
@@ -783,20 +783,21 @@ enum pipe_cap<br>
     PIPE_CAP_ALLOW_MAPPED_BUFFERS<wbr>_DURING_EXECUTION,<br>
     PIPE_CAP_POST_DEPTH_COVERAGE,<br>
     PIPE_CAP_BINDLESS_TEXTURE,<br>
     PIPE_CAP_NIR_SAMPLERS_AS_DERE<wbr>F,<br>
     PIPE_CAP_QUERY_SO_OVERFLOW,<br>
     PIPE_CAP_MEMOBJ,<br>
     PIPE_CAP_LOAD_CONSTBUF,<br>
     PIPE_CAP_TGSI_ANY_REG_AS_ADDR<wbr>ESS,<br>
     PIPE_CAP_TILE_RASTER_ORDER,<br>
     PIPE_CAP_MAX_COMBINED_SHADER_<wbr>OUTPUT_RESOURCES,<br>
+   PIPE_CAP_EQAA_COLOR_SAMPLE_SU<wbr>PPORT_MASK,<br>
     PIPE_CAP_SIGNED_VERTEX_BUFFER<wbr>_OFFSET,<br>
     PIPE_CAP_CONTEXT_PRIORITY_MAS<wbr>K,<br>
     PIPE_CAP_FENCE_SIGNAL,<br>
     PIPE_CAP_CONSTBUF0_FLAGS,<br>
     PIPE_CAP_PACKED_UNIFORMS,<br>
  };<br>
    /**<br>
   * Possible bits for PIPE_CAP_CONTEXT_PRIORITY_MASK param, which should<br>
   * return a bitmask of the supported priorities.  If the driver does not<br>
diff --git a/src/gallium/include/pipe/p_s<wbr>tate.h b/src/gallium/include/pipe/p_s<wbr>tate.h<br>
index 4dce399f848..4010b92e67b 100644<br>
--- a/src/gallium/include/pipe/p_s<wbr>tate.h<br>
+++ b/src/gallium/include/pipe/p_s<wbr>tate.h<br>
@@ -503,41 +503,42 @@ struct pipe_box<br>
     int16_t depth;<br>
  };<br>
      /**<br>
   * A memory object/resource such as a vertex buffer or texture.<br>
   */<br>
  struct pipe_resource<br>
  {<br>
     struct pipe_reference reference;<br>
-   struct pipe_screen *screen; /**< screen that this texture belongs to */<br>
       unsigned width0; /**< Used by both buffers and textures. */<br>
     uint16_t height0; /* Textures: The maximum height/depth/array_size is 16k. */<br>
     uint16_t depth0;<br>
     uint16_t array_size;<br>
       enum pipe_format format:16;         /**< PIPE_FORMAT_x */<br>
     enum pipe_texture_target target:8; /**< PIPE_TEXTURE_x */<br>
     unsigned last_level:8;    /**< Index of last mipmap level present/defined */<br>
     unsigned nr_samples:8;    /**< for multisampled surfaces, nr of samples */<br>
+   unsigned nr_color_samples:8; /**< Number of color samples for EQAA. */<br>
     unsigned usage:8;         /**< PIPE_USAGE_x (not a bitmask) */<br>
       unsigned bind;            /**< bitmask of PIPE_BIND_x */<br>
     unsigned flags;           /**< bitmask of PIPE_RESOURCE_FLAG_x */<br>
       /**<br>
      * For planar images, ie. YUV EGLImage external, etc, pointer to the<br>
      * next plane.<br>
      */<br>
     struct pipe_resource *next;<br>
+   struct pipe_screen *screen; /**< screen that this texture belongs to */<br>
</blockquote>
<br></div></div>
Out of curiosity, why moving this field ?<br></blockquote><div><br></div><div>So that the size of the structure doesn't change.<br><br></div><div>Marek<br></div></div><br></div></div>