From f3c3aff6efed49b7740a144f767c713cb22561e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 9 Aug 2012 20:59:44 -0600 Subject: st/mesa: add support for GS textures and samplers --- src/mesa/state_tracker/st_atom.c | 3 ++- src/mesa/state_tracker/st_atom.h | 3 ++- src/mesa/state_tracker/st_atom_sampler.c | 16 ++++++++-------- src/mesa/state_tracker/st_atom_texture.c | 28 +++++++++++++++++++++++++++- 4 files changed, 39 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index e6fc114..102fee9 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -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, diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 703bc2a..6c7d09f 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -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; diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 70ae55f..adcc7b5 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -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]); + } } diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 5604b87..6e2efd9 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -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) -- cgit v1.1