<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Your understanding is correct. I misunderstood CSAA. So it looks like that CSAA is more useless than I thought. You get the coverage-samples level of quality for back-to-front rendering, but you may get the depth-samples level of quality for front-to-back rendering, because "edges" generated by depth test failures have the same quality as the number of depth samples (if depth values are uncompressed). AMD supports that mode too, but I don't recommend using it because of the possible decrease in front-to-back rendering quality.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">The way the CAP is defined doesn't actually allow NV's implementation of CSAA. A new CAP would be needed.</div><div class="gmail_quote"><br></div><div class="gmail_quote">We'll add a new GL extension for advanced MSAA. The NV extension is unusable, because it changes GL behavior in a non-backward-compatible way by allowing storage_samples = 2 for all renderbuffers (which is cheating, but not surprising from NV).<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Marek<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, May 21, 2018 at 12:55 PM, 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,<br>
<br>
I get the impression when looking at online documentation about EQAA and CSAA, like<br>
<a href="http://www.nvidia.fr/object/coverage-sampled-aa.html" rel="noreferrer" target="_blank">http://www.nvidia.fr/object/co<wbr>verage-sampled-aa.html</a><br>
<br>
that the number of stored samples is the same for the color and depth buffers.<br>
Only the samples used for coverage is greater.<br>
<br>
With your proposal, isn't the number of samples stored in the depth buffer always the same than the number of samples used for coverage ?<br>
That reduces the use-cases. In nine, we have to enforce the number of stored samples to be the same for the color and the depth buffer, but we could increase the number of samples used for coverage and enable EQAA/CSAA (in fact there is a similar way to advertise the feature for Nvidia and Amd).<br>
<br>
But maybe I misunderstood.<br>
<br>
Yours,<br>
<br>
Axel Davy<div class="HOEnZb"><div class="h5"><br>
<br>
On 18/05/2018 06:05, 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>
The interface only uses general MSAA terms, so it's "advanced MSAA" and not<br>
something vendor-specific.<br>
<br>
It's a proper subset of EQAA, and a proper superset of CSAA, so it's neither.<br>
<br>
Changes:<br>
- pipe_resource is changed<br>
- is_format_supported is changed<br>
- a new CAP is added<br>
---<br>
src/gallium/docs/source/screen<wbr>.rst | 31 ++++++++++++++++++++++++++--<br>
src/gallium/include/pipe/p_def<wbr>ines.h | 1 +<br>
src/gallium/include/pipe/p_scr<wbr>een.h | 1 +<br>
src/gallium/include/pipe/p_sta<wbr>te.h | 18 +++++++++++++---<br>
4 files changed, 46 insertions(+), 5 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 5bc6ee99f08..cf4787a1c49 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,25 @@ 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_FRAMEBUFFER_MIXED_S<wbr>AMPLES``: Framebuffer attachments can have<br>
+ different number of samples each with the following restriction:<br>
+ color.nr_samples >= zs.nr_samples >= color.nr_storage_samples<br>
+ If 0 is returned, the following restriction applies:<br>
+ color.nr_samples == zs.nr_samples >= color.nr_storage_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>
@@ -718,20 +723,23 @@ is_format_supported<br>
Determine if a resource in the given format can be used in a specific manner.<br>
**format** the resource format<br>
**target** one of the PIPE_TEXTURE_x flags<br>
**sample_count** the number of samples. 0 and 1 mean no multisampling,<br>
the maximum allowed legal value is 32.<br>
+**storage_sample_count** the number of storage samples. This must be <=<br>
+sample_count. See the documentation of ``pipe_resource::nr_storage_sa<wbr>mples``.<br>
+<br>
**bindings** is a bitmask of :ref:`PIPE_BIND` flags.<br>
Returns TRUE if all usages can be satisfied.<br>
can_create_resource<br>
^^^^^^^^^^^^^^^^^^^<br>
Check if a resource can actually be created (but don't actually allocate any<br>
memory). This is used to implement OpenGL's proxy textures. Typically, a<br>
@@ -761,22 +769,41 @@ 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**: Number of samples determining quality, driving the rasterizer,<br>
+shading, and framebuffer. It is the number of samples seen by the whole<br>
+graphics pipeline. 0 and 1 specify a resource which isn't multisampled.<br>
+<br>
+**nr_storage_samples**: Only color buffers can set this lower than nr_samples.<br>
+Multiple samples within a pixel can have the same color. ``nr_storage_samples``<br>
+determines how many slots for different colors there are per pixel.<br>
+If there are not enough slots to store all sample colors, some samples will<br>
+have an undefined color (called "undefined samples").<br>
+<br>
+The resolve blit behavior is driver-specific, but can be one of these two:<br>
+1. Only defined samples will be averaged. Undefined samples will be ignored.<br>
+2. Undefined samples will be approximated by looking at surrounding defined<br>
+ samples (even in different pixels).<br>
+<br>
+Blits and MSAA texturing: If the sample being fetched is undefined, one of<br>
+the defined samples is returned instead.<br>
+<br>
+Sample shading (``set_min_samples``) will operate at a sample frequency that<br>
+is at most ``nr_storage_samples``. Greater ``min_samples`` values will be<br>
+replaced by ``nr_storage_samples``.<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>
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 6b2f33b9e37..5693396c9e9 100644<br>
--- a/src/gallium/include/pipe/p_d<wbr>efines.h<br>
+++ b/src/gallium/include/pipe/p_d<wbr>efines.h<br>
@@ -794,20 +794,21 @@ enum pipe_cap<br>
PIPE_CAP_ALLOW_MAPPED_<wbr>BUFFERS_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_FRAMEBUFFER_MIXED_SA<wbr>MPLES,<br>
PIPE_CAP_SIGNED_VERTEX_<wbr>BUFFER_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>
PIPE_CAP_CONSERVATIVE_RASTER_<wbr>POST_SNAP_TRIANGLES,<br>
PIPE_CAP_CONSERVATIVE_RASTER_<wbr>POST_SNAP_POINTS_LINES,<br>
PIPE_CAP_CONSERVATIVE_RASTER_<wbr>PRE_SNAP_TRIANGLES,<br>
PIPE_CAP_CONSERVATIVE_RASTER_<wbr>PRE_SNAP_POINTS_LINES,<br>
PIPE_CAP_MAX_CONSERVATIVE_RAS<wbr>TER_SUBPIXEL_PRECISION_BIAS,<br>
diff --git a/src/gallium/include/pipe/p_s<wbr>creen.h b/src/gallium/include/pipe/p_s<wbr>creen.h<br>
index 101e229088b..94c61dfab2e 100644<br>
--- a/src/gallium/include/pipe/p_s<wbr>creen.h<br>
+++ b/src/gallium/include/pipe/p_s<wbr>creen.h<br>
@@ -150,20 +150,21 @@ struct pipe_screen {<br>
/**<br>
* Check if the given pipe_format is supported as a texture or<br>
* drawing surface.<br>
* \param bindings bitmask of PIPE_BIND_*<br>
*/<br>
boolean (*is_format_supported)( struct pipe_screen *,<br>
enum pipe_format format,<br>
enum pipe_texture_target target,<br>
unsigned sample_count,<br>
+ unsigned storage_sample_count,<br>
unsigned bindings );<br>
/**<br>
* Check if the given pipe_format is supported as output for this codec/profile.<br>
* \param profile profile to check, may also be PIPE_VIDEO_PROFILE_UNKNOWN<br>
*/<br>
boolean (*is_video_format_supported)( struct pipe_screen *,<br>
enum pipe_format format,<br>
enum pipe_video_profile profile,<br>
enum pipe_video_entrypoint entrypoint );<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 db9fa1a8e9f..1baa497b227 100644<br>
--- a/src/gallium/include/pipe/p_s<wbr>tate.h<br>
+++ b/src/gallium/include/pipe/p_s<wbr>tate.h<br>
@@ -511,41 +511,53 @@ 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 usage:8; /**< PIPE_USAGE_x (not a bitmask) */<br>
+ /** Number of samples determining quality, driving rasterizer, shading,<br>
+ * and framebuffer.<br>
+ */<br>
+ unsigned nr_samples:8;<br>
+<br>
+ /** Multiple samples within a pixel can have the same value.<br>
+ * nr_storage_samples determines how many slots for different values<br>
+ * there are per pixel. Only color buffers can set this lower than<br>
+ * nr_samples.<br>
+ */<br>
+ unsigned nr_storage_samples:8;<br>
+<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>
+ /* The screen pointer should be last for optimal structure packing. */<br>
+ struct pipe_screen *screen; /**< screen that this texture belongs to */<br>
};<br>
/**<br>
* Transfer object. For data transfer to/from a resource.<br>
*/<br>
struct pipe_transfer<br>
{<br>
struct pipe_resource *resource; /**< resource to transfer to/from */<br>
unsigned level; /**< texture mipmap level */<br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br></div></div>