This only checks power of 2 sample counts for now, but maybe we would
like to probe the values in between too ...

nv50 for example can store 12 "coverage samples" in a depth surface, but
they have to be used in a hardware specific way together with
multisampled colour surfaces (which are always power of 2) which can
presently not be done through the gallium interface.
>From b35a1ce7248237ac0cf4209eb8703d13c380ff5a Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <e0425...@student.tuwien.ac.at>
Date: Sat, 23 Jul 2011 00:55:20 +0200
Subject: [PATCH 3/6] st/mesa: determine Const.MaxSamples in init_extensions

---
 src/mesa/state_tracker/st_extensions.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 99b231d..391ff1b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -219,6 +219,7 @@ void st_init_extensions(struct st_context *st)
 {
    struct pipe_screen *screen = st->pipe->screen;
    struct gl_context *ctx = st->ctx;
+   int i;
 
    /*
     * Extensions that are supported by all Gallium drivers:
@@ -596,6 +597,14 @@ void st_init_extensions(struct st_context *st)
       ctx->Extensions.EXT_packed_float = GL_TRUE;
    }
 
+   /* Maximum sample count. */
+   for (i = 1; i <= 16; i <<= 1)
+      if (!screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_UNORM,
+                                       PIPE_TEXTURE_2D, i << 1,
+                                       PIPE_BIND_RENDER_TARGET))
+         break;
+   ctx->Const.MaxSamples = i;
+
    if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE)) {
       ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
       ctx->Extensions.AMD_seamless_cubemap_per_texture = GL_TRUE;
-- 
1.7.2.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to