st/mesa: add support for GS textures and samplers
authorBrian Paul <brianp@vmware.com>
Fri, 10 Aug 2012 02:59:44 +0000 (20:59 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 16 Aug 2012 15:01:31 +0000 (09:01 -0600)
src/mesa/state_tracker/st_atom.c
src/mesa/state_tracker/st_atom.h
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_atom_texture.c

index e6fc114f1fcaf2328e3fd87822bf81a7764aad1e..102fee93b36d89469bdcd80011e87b4768384d3b 100644 (file)
@@ -57,7 +57,8 @@ static const struct st_tracked_state *atoms[] =
    &st_update_blend,
    &st_update_sampler,
    &st_update_vertex_texture,
-   &st_update_texture,
+   &st_update_fragment_texture,
+   &st_update_geometry_texture,
    &st_update_framebuffer,
    &st_update_msaa,
    &st_update_vs_constants,
index 703bc2ab34dee7714a71b3c380f5cc9675b253bd..6c7d09fbae3810b85cc404425ce1dda35e9e1c36 100644 (file)
@@ -60,8 +60,9 @@ extern const struct st_tracked_state st_update_scissor;
 extern const struct st_tracked_state st_update_blend;
 extern const struct st_tracked_state st_update_msaa;
 extern const struct st_tracked_state st_update_sampler;
-extern const struct st_tracked_state st_update_texture;
+extern const struct st_tracked_state st_update_fragment_texture;
 extern const struct st_tracked_state st_update_vertex_texture;
+extern const struct st_tracked_state st_update_geometry_texture;
 extern const struct st_tracked_state st_finalize_textures;
 extern const struct st_tracked_state st_update_fs_constants;
 extern const struct st_tracked_state st_update_gs_constants;
index 70ae55fd2eba33b7d0a1b8828fd79079bec3f754..adcc7b50547bb558cdde4d0304fc04155d119948 100644 (file)
@@ -263,14 +263,14 @@ update_samplers(struct st_context *st)
                           st->state.samplers[PIPE_SHADER_VERTEX],
                           &st->state.num_samplers[PIPE_SHADER_VERTEX]);
 
-/*
-   update_shader_samplers(st,
-                          PIPE_SHADER_GEOMETRY,
-                          &ctx->GeometryProgram._Current->Base,
-                          ctx->Const.MaxGeometryTextureImageUnits,
-                          st->state.samplers[PIPE_SHADER_GEOMETRY],
-                          &st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
-*/
+   if (ctx->GeometryProgram._Current) {
+      update_shader_samplers(st,
+                             PIPE_SHADER_GEOMETRY,
+                             &ctx->GeometryProgram._Current->Base,
+                             ctx->Const.MaxGeometryTextureImageUnits,
+                             st->state.samplers[PIPE_SHADER_GEOMETRY],
+                             &st->state.num_samplers[PIPE_SHADER_GEOMETRY]);
+   }
 }
 
 
index 5604b8762b218a3ad12c2145a41f167d7becd5c8..6e2efd960ddd1f6252685c79d87aeccebab4dfc4 100644 (file)
@@ -332,7 +332,23 @@ update_fragment_textures(struct st_context *st)
 }
 
 
-const struct st_tracked_state st_update_texture = {
+static void
+update_geometry_textures(struct st_context *st)
+{
+   const struct gl_context *ctx = st->ctx;
+
+   if (ctx->GeometryProgram._Current) {
+      update_textures(st,
+                      PIPE_SHADER_GEOMETRY,
+                      &ctx->GeometryProgram._Current->Base,
+                      ctx->Const.MaxTextureImageUnits,
+                      st->state.sampler_views[PIPE_SHADER_GEOMETRY],
+                      &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]);
+   }
+}
+
+
+const struct st_tracked_state st_update_fragment_texture = {
    "st_update_texture",                                        /* name */
    {                                                   /* dirty */
       _NEW_TEXTURE,                                    /* mesa */
@@ -352,6 +368,16 @@ const struct st_tracked_state st_update_vertex_texture = {
 };
 
 
+const struct st_tracked_state st_update_geometry_texture = {
+   "st_update_geometry_texture",                       /* name */
+   {                                                   /* dirty */
+      _NEW_TEXTURE,                                    /* mesa */
+      ST_NEW_GEOMETRY_PROGRAM,                         /* st */
+   },
+   update_geometry_textures                            /* update */
+};
+
+
 
 static void
 finalize_textures(struct st_context *st)