summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c12
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c8
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c11
-rw-r--r--src/mesa/state_tracker/st_context.c15
-rw-r--r--src/mesa/state_tracker/st_context.h13
5 files changed, 26 insertions, 33 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index f39fd7551c..70ae55fd2e 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -253,23 +253,23 @@ update_samplers(struct st_context *st)
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
ctx->Const.MaxTextureImageUnits,
- st->state.fragment_samplers,
- &st->state.num_fragment_samplers);
+ st->state.samplers[PIPE_SHADER_FRAGMENT],
+ &st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
update_shader_samplers(st,
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
ctx->Const.MaxVertexTextureImageUnits,
- st->state.vertex_samplers,
- &st->state.num_vertex_samplers);
+ 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.geometry_samplers,
- &st->state.num_geometry_samplers);
+ 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 e88675d4e6..5604b8762b 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -312,8 +312,8 @@ update_vertex_textures(struct st_context *st)
PIPE_SHADER_VERTEX,
&ctx->VertexProgram._Current->Base,
ctx->Const.MaxVertexTextureImageUnits,
- st->state.vertex_sampler_views,
- &st->state.num_vertex_textures);
+ st->state.sampler_views[PIPE_SHADER_VERTEX],
+ &st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
}
}
@@ -327,8 +327,8 @@ update_fragment_textures(struct st_context *st)
PIPE_SHADER_FRAGMENT,
&ctx->FragmentProgram._Current->Base,
ctx->Const.MaxTextureImageUnits,
- st->state.fragment_sampler_views,
- &st->state.num_fragment_textures);
+ st->state.sampler_views[PIPE_SHADER_FRAGMENT],
+ &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index 7d9ccc1e5a..dbd778b4fc 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -481,10 +481,11 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* user samplers, plus our bitmap sampler */
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers);
+ uint num = MAX2(fpv->bitmap_sampler + 1,
+ st->state.num_samplers[PIPE_SHADER_FRAGMENT]);
uint i;
- for (i = 0; i < st->state.num_fragment_samplers; i++) {
- samplers[i] = &st->state.fragment_samplers[i];
+ for (i = 0; i < st->state.num_samplers[PIPE_SHADER_FRAGMENT]; i++) {
+ samplers[i] = &st->state.samplers[PIPE_SHADER_FRAGMENT][i];
}
samplers[fpv->bitmap_sampler] =
&st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
@@ -496,8 +497,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
{
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
uint num = MAX2(fpv->bitmap_sampler + 1,
- st->state.num_fragment_textures);
- memcpy(sampler_views, st->state.fragment_sampler_views,
+ st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]);
+ memcpy(sampler_views, st->state.sampler_views[PIPE_SHADER_FRAGMENT],
sizeof(sampler_views));
sampler_views[fpv->bitmap_sampler] = sv;
cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 2f95161782..7735eee4f3 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -237,7 +237,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
static void st_destroy_context_priv( struct st_context *st )
{
- uint i;
+ uint shader, i;
st_destroy_atoms( st );
st_destroy_draw( st );
@@ -248,14 +248,11 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_drawpix(st);
st_destroy_drawtex(st);
- for (i = 0; i < Elements(st->state.fragment_sampler_views); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.fragment_sampler_views[i]);
- }
-
- for (i = 0; i < Elements(st->state.vertex_sampler_views); i++) {
- pipe_sampler_view_release(st->pipe,
- &st->state.vertex_sampler_views[i]);
+ for (shader = 0; shader < Elements(st->state.sampler_views); shader++) {
+ for (i = 0; i < Elements(st->state.sampler_views[0]); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.sampler_views[shader][i]);
+ }
}
if (st->default_texture) {
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 8afd776636..47d3af5205 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -98,25 +98,20 @@ struct st_context
struct pipe_blend_state blend;
struct pipe_depth_stencil_alpha_state depth_stencil;
struct pipe_rasterizer_state rasterizer;
- struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_state vertex_samplers[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_state samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ GLuint num_samplers[PIPE_SHADER_TYPES];
+ struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
+ GLuint num_sampler_views[PIPE_SHADER_TYPES];
struct pipe_clip_state clip;
struct {
void *ptr;
unsigned size;
} constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
- struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
unsigned sample_mask;
- GLuint num_fragment_samplers;
- GLuint num_vertex_samplers;
- GLuint num_fragment_textures;
- GLuint num_vertex_textures;
-
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
GLuint fb_orientation;