[Mesa-dev] [PATCH 2/2] gallium: implement seamless cubemap extensions

Marek Olšák maraeo at gmail.com
Tue May 3 06:55:38 PDT 2011


---
 src/gallium/include/pipe/p_defines.h        |    2 ++
 src/gallium/include/pipe/p_state.h          |    2 ++
 src/mesa/state_tracker/st_atom_rasterizer.c |    6 +++++-
 src/mesa/state_tracker/st_atom_sampler.c    |    3 +++
 src/mesa/state_tracker/st_extensions.c      |    9 +++++++++
 5 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 431a7fb..bf09fca 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -465,6 +465,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, /* these two are mutually-exclusive */
+   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..3bc7f0f 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -101,6 +101,7 @@ struct pipe_rasterizer_state
    unsigned line_smooth:1;
    unsigned line_stipple_enable:1;
    unsigned line_last_pixel:1;
+   unsigned seamless_cube_map:1; /**< PIPE_CAP_SEAMLESS_CUBE_MAP */
 
    /**
     * Use the first vertex of a primitive as the provoking vertex for
@@ -269,6 +270,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; /**< PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE */
    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_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 250cbb2..ac6d76a 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -257,6 +257,9 @@ static void update_raster_state( struct st_context *st )
    /* _NEW_FRAG_CLAMP */
    raster->clamp_fragment_color = ctx->Color._ClampFragmentColor;
 
+   /* _NEW_TEXTURE */
+   raster->seamless_cube_map = ctx->Texture.CubeMapSeamless != GL_FALSE;
+
    raster->gl_rasterization_rules = 1;
 
    cso_set_rasterizer(st->cso_context, raster);
@@ -273,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = {
        _NEW_POLYGON |
        _NEW_PROGRAM |
        _NEW_SCISSOR |
-       _NEW_FRAG_CLAMP),      /* mesa state dependencies*/
+       _NEW_FRAG_CLAMP |
+       _NEW_TEXTURE),  /* mesa state dependencies */
       ST_NEW_VERTEX_PROGRAM,  /* state tracker dependencies */
    },
    update_raster_state     /* update function */
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 56da010..199a755 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 || texobj->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..c610b0b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -595,4 +595,13 @@ void st_init_extensions(struct st_context *st)
                                    PIPE_BIND_SAMPLER_VIEW)) {
       ctx->Extensions.EXT_packed_float = GL_TRUE;
    }
+
+   /* These two CAPs are mutually-exclusive. */
+   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;
+   }
 }
-- 
1.7.4.1



More information about the mesa-dev mailing list