Mesa (master): gallium: implement seamless cubemap extensions

Marek Olšák mareko at kemper.freedesktop.org
Fri May 6 18:14:56 UTC 2011


Module: Mesa
Branch: master
Commit: a5f0a11477ae90f47f3adb59a93c5576dc8c7325
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a5f0a11477ae90f47f3adb59a93c5576dc8c7325

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon May  2 02:37:46 2011 +0200

gallium: implement seamless cubemap extensions

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/docs/source/cso/sampler.rst  |    4 ++++
 src/gallium/include/pipe/p_defines.h     |    2 ++
 src/gallium/include/pipe/p_state.h       |    1 +
 src/mesa/state_tracker/st_atom_sampler.c |    3 +++
 src/mesa/state_tracker/st_extensions.c   |    8 ++++++++
 5 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/gallium/docs/source/cso/sampler.rst b/src/gallium/docs/source/cso/sampler.rst
index 9bbb784..648b5cc 100644
--- a/src/gallium/docs/source/cso/sampler.rst
+++ b/src/gallium/docs/source/cso/sampler.rst
@@ -107,3 +107,7 @@ max_anisotropy
     Set to zero to disable anisotropic filtering.  Any other setting enables
     anisotropic filtering, however it's not unexpected some drivers only will
     change their filtering with a setting of 2 and higher.
+seamless_cube_map
+    If set, the bilinear filter of a cube map may take samples from adjacent
+    cube map faces when sampled near a texture border to produce a seamless
+    look.
\ No newline at end of file
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 5f7dd96..c0c2a7c 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -466,6 +466,8 @@ enum pipe_cap {
    PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR = 44,
    PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL = 45,
    PIPE_CAP_MIXED_COLORBUFFER_FORMATS = 46,
+   PIPE_CAP_SEAMLESS_CUBE_MAP = 47,
+   PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE = 48,
 };
 
 /* Shader caps not specific to any single stage */
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 0c1f509..86ef255 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -269,6 +269,7 @@ struct pipe_sampler_state
    unsigned compare_func:3;      /**< PIPE_FUNC_x */
    unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */
    unsigned max_anisotropy:6;
+   unsigned seamless_cube_map:1;
    float lod_bias;               /**< LOD/lambda bias */
    float min_lod, max_lod;       /**< LOD clamp range, after bias */
    float border_color[4];
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 56da010..e3d6cbb 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -201,6 +201,9 @@ update_samplers(struct st_context *st)
                = st_compare_func_to_pipe(msamp->CompareFunc);
          }
 
+         sampler->seamless_cube_map =
+               st->ctx->Texture.CubeMapSeamless || msamp->CubeMapSeamless;
+
          st->state.num_samplers = su + 1;
 
          /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 030bbc7..ad8e6bb 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -595,4 +595,12 @@ void st_init_extensions(struct st_context *st)
                                    PIPE_BIND_SAMPLER_VIEW)) {
       ctx->Extensions.EXT_packed_float = GL_TRUE;
    }
+
+   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;
+   }
+   else if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP)) {
+      ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
+   }
 }




More information about the mesa-commit mailing list