<p dir="ltr">Why not derive this information from is_format_supported with rgba8 format? Seems like that would do the trick. Look at how the st already does something similar in st_extensions.c iirc.</p>
<p dir="ltr">Your scheme only enables power-of-two msaa levels, and is redundant wrt the function I mentioned earlier...</p>
<p dir="ltr">As I said to you on a number of previous occasions, the "no attachments" cap should just be a boolean.</p>
<p dir="ltr"> -ilia</p>
<div class="gmail_quote">On Mar 19, 2016 2:42 AM, "Edward O'Callaghan" <<a href="mailto:eocallaghan@alterapraxis.com">eocallaghan@alterapraxis.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add PIPE_CAP to determine the MSAA modes the hardware<br>
supports so that values requested from the application<br>
using GL_ARB_framebuffer_no_attachments may be quantized<br>
to what the hardware expects.<br>
<br>
V.2:<br>
Fix doc for a more detailed description of the PIPE_CAP<br>
and the corresponding GL constant.<br>
<br>
Signed-off-by: Edward O'Callaghan <<a href="mailto:eocallaghan@alterapraxis.com">eocallaghan@alterapraxis.com</a>><br>
---<br>
src/gallium/docs/source/screen.rst | 7 +++++++<br>
src/gallium/drivers/freedreno/freedreno_screen.c | 1 +<br>
src/gallium/drivers/i915/i915_screen.c | 1 +<br>
src/gallium/drivers/ilo/ilo_screen.c | 1 +<br>
src/gallium/drivers/llvmpipe/lp_screen.c | 1 +<br>
src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 +<br>
src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +<br>
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +<br>
src/gallium/drivers/r300/r300_screen.c | 1 +<br>
src/gallium/drivers/r600/r600_pipe.c | 1 +<br>
src/gallium/drivers/radeonsi/si_pipe.c | 1 +<br>
src/gallium/drivers/softpipe/sp_screen.c | 1 +<br>
src/gallium/drivers/svga/svga_screen.c | 1 +<br>
src/gallium/drivers/vc4/vc4_screen.c | 1 +<br>
src/gallium/drivers/virgl/virgl_screen.c | 1 +<br>
src/gallium/include/pipe/p_defines.h | 1 +<br>
src/mesa/state_tracker/st_extensions.c | 1 +<br>
17 files changed, 23 insertions(+)<br>
<br>
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst<br>
index 46ec381..d3d8dc4 100644<br>
--- a/src/gallium/docs/source/screen.rst<br>
+++ b/src/gallium/docs/source/screen.rst<br>
@@ -323,6 +323,13 @@ The integer capabilities:<br>
* ``PIPE_CAP_PCI_BUS``: Return the PCI bus number.<br>
* ``PIPE_CAP_PCI_DEVICE``: Return the PCI device number.<br>
* ``PIPE_CAP_PCI_FUNCTION``: Return the PCI function number.<br>
+* ``PIPE_CAP_MSAA_MODES``:<br>
+ A bitmask of the supported MSAA modes the hardware supports. e.g.,<br>
+ (1 << 5) | .. | (1 << 1). If non-zero, rendering to framebuffers with no<br>
+ surface attachments is supported. N.B., The maximum number of layers<br>
+ supported for rasterizing a primitive on a layer is obtained from<br>
+ ``PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS`` even though it can be larger than<br>
+ the number of layers supported by either rendering or textures.<br>
<br>
<br>
.. _pipe_capf:<br>
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c<br>
index d47cb07..8b6ebe8 100644<br>
--- a/src/gallium/drivers/freedreno/freedreno_screen.c<br>
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c<br>
@@ -255,6 +255,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
case PIPE_CAP_INVALIDATE_BUFFER:<br>
case PIPE_CAP_GENERATE_MIPMAP:<br>
case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_MAX_VIEWPORTS:<br>
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c<br>
index f4aa310..02457c5 100644<br>
--- a/src/gallium/drivers/i915/i915_screen.c<br>
+++ b/src/gallium/drivers/i915/i915_screen.c<br>
@@ -269,6 +269,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:<br>
diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c<br>
index 548d215..49fe658 100644<br>
--- a/src/gallium/drivers/ilo/ilo_screen.c<br>
+++ b/src/gallium/drivers/ilo/ilo_screen.c<br>
@@ -497,6 +497,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_VENDOR_ID:<br>
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c<br>
index 2529b54..db3eff7 100644<br>
--- a/src/gallium/drivers/llvmpipe/lp_screen.c<br>
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c<br>
@@ -319,6 +319,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
}<br>
/* should only get here on unhandled cases */<br>
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c<br>
index b105c6a..4fcadb8 100644<br>
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c<br>
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c<br>
@@ -192,6 +192,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_VENDOR_ID:<br>
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c<br>
index 5836bb2..6c8e930 100644<br>
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c<br>
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c<br>
@@ -236,6 +236,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_VENDOR_ID:<br>
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c<br>
index 3c5b1da..910143f 100644<br>
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c<br>
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c<br>
@@ -229,6 +229,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_VENDOR_ID:<br>
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c<br>
index 1c3bb64..5ca49b2 100644<br>
--- a/src/gallium/drivers/r300/r300_screen.c<br>
+++ b/src/gallium/drivers/r300/r300_screen.c<br>
@@ -214,6 +214,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)<br>
case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:<br>
case PIPE_CAP_QUERY_BUFFER_OBJECT:<br>
case PIPE_CAP_QUERY_MEMORY_INFO:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
/* SWTCL-only features. */<br>
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c<br>
index 7018088..0d22faa 100644<br>
--- a/src/gallium/drivers/r600/r600_pipe.c<br>
+++ b/src/gallium/drivers/r600/r600_pipe.c<br>
@@ -369,6 +369,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)<br>
case PIPE_CAP_GENERATE_MIPMAP:<br>
case PIPE_CAP_STRING_MARKER:<br>
case PIPE_CAP_QUERY_BUFFER_OBJECT:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:<br>
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c<br>
index 8b50a49..46fa592 100644<br>
--- a/src/gallium/drivers/radeonsi/si_pipe.c<br>
+++ b/src/gallium/drivers/radeonsi/si_pipe.c<br>
@@ -357,6 +357,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)<br>
case PIPE_CAP_GENERATE_MIPMAP:<br>
case PIPE_CAP_STRING_MARKER:<br>
case PIPE_CAP_QUERY_BUFFER_OBJECT:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:<br>
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c<br>
index bfd3598..eec449a 100644<br>
--- a/src/gallium/drivers/softpipe/sp_screen.c<br>
+++ b/src/gallium/drivers/softpipe/sp_screen.c<br>
@@ -270,6 +270,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
}<br>
/* should only get here on unhandled cases */<br>
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c<br>
index bcc5120..2c89830 100644<br>
--- a/src/gallium/drivers/svga/svga_screen.c<br>
+++ b/src/gallium/drivers/svga/svga_screen.c<br>
@@ -404,6 +404,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)<br>
case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:<br>
case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:<br>
case PIPE_CAP_QUERY_BUFFER_OBJECT:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
}<br>
<br>
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c<br>
index 92d910b..801e9ba 100644<br>
--- a/src/gallium/drivers/vc4/vc4_screen.c<br>
+++ b/src/gallium/drivers/vc4/vc4_screen.c<br>
@@ -207,6 +207,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
<br>
/* Stream output. */<br>
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c<br>
index 8126bde..4ee0890 100644<br>
--- a/src/gallium/drivers/virgl/virgl_screen.c<br>
+++ b/src/gallium/drivers/virgl/virgl_screen.c<br>
@@ -239,6 +239,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)<br>
case PIPE_CAP_PCI_BUS:<br>
case PIPE_CAP_PCI_DEVICE:<br>
case PIPE_CAP_PCI_FUNCTION:<br>
+ case PIPE_CAP_MSAA_MODES:<br>
return 0;<br>
case PIPE_CAP_VENDOR_ID:<br>
return 0x1af4;<br>
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h<br>
index bdd76ab..bafc7b1 100644<br>
--- a/src/gallium/include/pipe/p_defines.h<br>
+++ b/src/gallium/include/pipe/p_defines.h<br>
@@ -681,6 +681,7 @@ enum pipe_cap<br>
PIPE_CAP_PCI_BUS,<br>
PIPE_CAP_PCI_DEVICE,<br>
PIPE_CAP_PCI_FUNCTION,<br>
+ PIPE_CAP_MSAA_MODES,<br>
};<br>
<br>
#define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)<br>
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c<br>
index 3666ece..275fe55 100644<br>
--- a/src/mesa/state_tracker/st_extensions.c<br>
+++ b/src/mesa/state_tracker/st_extensions.c<br>
@@ -565,6 +565,7 @@ void st_init_extensions(struct pipe_screen *screen,<br>
{ o(ARB_fragment_program_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },<br>
{ o(ARB_framebuffer_object), PIPE_CAP_MIXED_FRAMEBUFFER_SIZES },<br>
{ o(ARB_indirect_parameters), PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS },<br>
+ { o(ARB_framebuffer_no_attachments), PIPE_CAP_MSAA_MODES },<br>
{ o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR },<br>
{ o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY },<br>
{ o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY },<br>
--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>