[Mesa-dev] [PATCH 02/17] gallium: Obtain ARB_framebuffer_no_attachment constants

Edward O'Callaghan eocallaghan at alterapraxis.com
Fri Mar 25 00:11:06 UTC 2016


Set default values for the constants required in
ARB_framebuffer_no_attachments and obtained the number
of layers from ``PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS``.

We also obtain the MaxFramebufferSamples value using
a query back to the driver for PIPE_FORMAT_NONE.

Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/mesa/state_tracker/st_extensions.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 59777ee..658dfec 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -1050,6 +1050,33 @@ void st_init_extensions(struct pipe_screen *screen,
          extensions->AMD_vertex_shader_viewport_index = GL_TRUE;
    }
 
+   /* ARB_framebuffer_no_attachments */
+   consts->MaxFramebufferWidth   = consts->MaxViewportWidth;
+   consts->MaxFramebufferHeight  = consts->MaxViewportHeight;
+   enum pipe_format void_formats[] = {
+      PIPE_FORMAT_NONE
+   };
+   /* Assumes maximum number of samples of 32 */
+   consts->MaxFramebufferSamples =
+      get_max_samples_for_formats(screen, ARRAY_SIZE(void_formats),
+                                  void_formats, 32,
+                                  PIPE_BIND_RENDER_TARGET);
+
+   /* N.B., we cheat here a little by assuming that
+    * PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS has the same
+    * number of layers as we need, although we technically
+    * could have more the generality is not really useful
+    * in practicality.
+    */
+   consts->MaxFramebufferLayers
+      = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS);
+
+   if ((consts->MaxSamples >= 4 && consts->MaxFramebufferLayers >= 2048)
+      || (consts->MaxFramebufferSamples >= consts->MaxSamples &&
+          consts->MaxFramebufferLayers  >= consts->MaxArrayTextureLayers))
+      if (screen->get_param(screen, PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT))
+         extensions->ARB_framebuffer_no_attachments = GL_TRUE;
+
    /* GL_ARB_ES3_compatibility.
     *
     * Assume that ES3 is supported if GLSL 3.30 is supported.
-- 
2.5.5



More information about the mesa-dev mailing list