summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c241
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h79
-rw-r--r--src/gallium/auxiliary/postprocess/pp_colors.c6
-rw-r--r--src/gallium/auxiliary/postprocess/pp_init.c2
-rw-r--r--src/gallium/auxiliary/postprocess/pp_mlaa.c24
-rw-r--r--src/gallium/auxiliary/util/u_blit.c38
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c14
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c12
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c14
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c13
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c16
11 files changed, 179 insertions, 280 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 7f2dc431ae5..c9a9fef737f 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -84,8 +84,7 @@ struct cso_context {
boolean has_geometry_shader;
boolean has_streamout;
- struct sampler_info fragment_samplers;
- struct sampler_info vertex_samplers;
+ struct sampler_info samplers[PIPE_SHADER_TYPES];
uint nr_vertex_buffers;
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
@@ -296,8 +295,7 @@ out:
*/
void cso_release_all( struct cso_context *ctx )
{
- unsigned i;
- struct sampler_info *info;
+ unsigned i, shader;
if (ctx->pipe) {
ctx->pipe->bind_blend_state( ctx->pipe, NULL );
@@ -317,17 +315,12 @@ void cso_release_all( struct cso_context *ctx )
}
/* free fragment samplers, views */
- info = &ctx->fragment_samplers;
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_sampler_view_reference(&info->views[i], NULL);
- pipe_sampler_view_reference(&info->views_saved[i], NULL);
- }
-
- /* free vertex samplers, views */
- info = &ctx->vertex_samplers;
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_sampler_view_reference(&info->views[i], NULL);
- pipe_sampler_view_reference(&info->views_saved[i], NULL);
+ for (shader = 0; shader < Elements(ctx->samplers); shader++) {
+ struct sampler_info *info = &ctx->samplers[shader];
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ pipe_sampler_view_reference(&info->views[i], NULL);
+ pipe_sampler_view_reference(&info->views_saved[i], NULL);
+ }
}
util_unreference_framebuffer_state(&ctx->fb);
@@ -993,26 +986,19 @@ single_sampler(struct cso_context *ctx,
enum pipe_error
cso_single_sampler(struct cso_context *ctx,
+ unsigned shader_stage,
unsigned idx,
const struct pipe_sampler_state *templ)
{
- return single_sampler(ctx, &ctx->fragment_samplers, idx, templ);
-}
-
-enum pipe_error
-cso_single_vertex_sampler(struct cso_context *ctx,
- unsigned idx,
- const struct pipe_sampler_state *templ)
-{
- return single_sampler(ctx, &ctx->vertex_samplers, idx, templ);
+ return single_sampler(ctx, &ctx->samplers[shader_stage], idx, templ);
}
static void
-single_sampler_done(struct cso_context *ctx,
- struct sampler_info *info)
+single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
{
+ struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
/* find highest non-null sampler */
@@ -1033,32 +1019,32 @@ single_sampler_done(struct cso_context *ctx,
info->nr_samplers * sizeof(void *));
info->hw.nr_samplers = info->nr_samplers;
- if (info == &ctx->fragment_samplers) {
+ switch (shader_stage) {
+ case PIPE_SHADER_FRAGMENT:
ctx->pipe->bind_fragment_sampler_states(ctx->pipe,
info->nr_samplers,
info->samplers);
- }
- else if (info == &ctx->vertex_samplers) {
+ break;
+ case PIPE_SHADER_VERTEX:
ctx->pipe->bind_vertex_sampler_states(ctx->pipe,
info->nr_samplers,
info->samplers);
- }
- else {
- assert(0);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ ctx->pipe->bind_geometry_sampler_states(ctx->pipe,
+ info->nr_samplers,
+ info->samplers);
+ break;
+ default:
+ assert(!"bad shader type in single_sampler_done()");
}
}
}
void
-cso_single_sampler_done( struct cso_context *ctx )
-{
- single_sampler_done(ctx, &ctx->fragment_samplers);
-}
-
-void
-cso_single_vertex_sampler_done(struct cso_context *ctx)
+cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
{
- single_sampler_done(ctx, &ctx->vertex_samplers);
+ single_sampler_done(ctx, shader_stage);
}
@@ -1067,12 +1053,13 @@ cso_single_vertex_sampler_done(struct cso_context *ctx)
* last one. Done to always try to set as many samplers
* as possible.
*/
-static enum pipe_error
-set_samplers(struct cso_context *ctx,
- struct sampler_info *info,
- unsigned nr,
- const struct pipe_sampler_state **templates)
+enum pipe_error
+cso_set_samplers(struct cso_context *ctx,
+ unsigned shader_stage,
+ unsigned nr,
+ const struct pipe_sampler_state **templates)
{
+ struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
enum pipe_error temp, error = PIPE_OK;
@@ -1091,82 +1078,38 @@ set_samplers(struct cso_context *ctx,
error = temp;
}
- single_sampler_done(ctx, info);
+ single_sampler_done(ctx, shader_stage);
return error;
}
-enum pipe_error
-cso_set_samplers(struct cso_context *ctx,
- unsigned nr,
- const struct pipe_sampler_state **templates)
-{
- return set_samplers(ctx, &ctx->fragment_samplers, nr, templates);
-}
-
-enum pipe_error
-cso_set_vertex_samplers(struct cso_context *ctx,
- unsigned nr,
- const struct pipe_sampler_state **templates)
-{
- return set_samplers(ctx, &ctx->vertex_samplers, nr, templates);
-}
-
-
-
-static void
-save_samplers(struct cso_context *ctx, struct sampler_info *info)
+void
+cso_save_samplers(struct cso_context *ctx, unsigned shader_stage)
{
+ struct sampler_info *info = &ctx->samplers[shader_stage];
info->nr_samplers_saved = info->nr_samplers;
memcpy(info->samplers_saved, info->samplers, sizeof(info->samplers));
}
-void
-cso_save_samplers(struct cso_context *ctx)
-{
- save_samplers(ctx, &ctx->fragment_samplers);
-}
void
-cso_save_vertex_samplers(struct cso_context *ctx)
-{
- save_samplers(ctx, &ctx->vertex_samplers);
-}
-
-
-
-static void
-restore_samplers(struct cso_context *ctx, struct sampler_info *info)
+cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage)
{
+ struct sampler_info *info = &ctx->samplers[shader_stage];
info->nr_samplers = info->nr_samplers_saved;
memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers));
- single_sampler_done(ctx, info);
+ single_sampler_done(ctx, shader_stage);
}
-void
-cso_restore_samplers(struct cso_context *ctx)
-{
- restore_samplers(ctx, &ctx->fragment_samplers);
-}
void
-cso_restore_vertex_samplers(struct cso_context *ctx)
+cso_set_sampler_views(struct cso_context *ctx,
+ unsigned shader_stage,
+ unsigned count,
+ struct pipe_sampler_view **views)
{
- restore_samplers(ctx, &ctx->vertex_samplers);
-}
-
-
-
-static void
-set_sampler_views(struct cso_context *ctx,
- struct sampler_info *info,
- void (*set_views)(struct pipe_context *,
- unsigned num_views,
- struct pipe_sampler_view **),
- uint count,
- struct pipe_sampler_view **views)
-{
- uint i;
+ struct sampler_info *info = &ctx->samplers[shader_stage];
+ unsigned i;
/* reference new views */
for (i = 0; i < count; i++) {
@@ -1180,36 +1123,27 @@ set_sampler_views(struct cso_context *ctx,
info->nr_views = count;
/* bind the new sampler views */
- set_views(ctx->pipe, count, info->views);
+ switch (shader_stage) {
+ case PIPE_SHADER_FRAGMENT:
+ ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, info->views);
+ break;
+ case PIPE_SHADER_VERTEX:
+ ctx->pipe->set_vertex_sampler_views(ctx->pipe, count, info->views);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ ctx->pipe->set_geometry_sampler_views(ctx->pipe, count, info->views);
+ break;
+ default:
+ assert(!"bad shader type in cso_set_sampler_views()");
+ }
}
-void
-cso_set_fragment_sampler_views(struct cso_context *ctx,
- uint count,
- struct pipe_sampler_view **views)
-{
- set_sampler_views(ctx, &ctx->fragment_samplers,
- ctx->pipe->set_fragment_sampler_views,
- count, views);
-}
void
-cso_set_vertex_sampler_views(struct cso_context *ctx,
- uint count,
- struct pipe_sampler_view **views)
-{
- set_sampler_views(ctx, &ctx->vertex_samplers,
- ctx->pipe->set_vertex_sampler_views,
- count, views);
-}
-
-
-
-static void
-save_sampler_views(struct cso_context *ctx,
- struct sampler_info *info)
+cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
{
- uint i;
+ struct sampler_info *info = &ctx->samplers[shader_stage];
+ unsigned i;
info->nr_views_saved = info->nr_views;
@@ -1219,29 +1153,14 @@ save_sampler_views(struct cso_context *ctx,
}
}
-void
-cso_save_fragment_sampler_views(struct cso_context *ctx)
-{
- save_sampler_views(ctx, &ctx->fragment_samplers);
-}
void
-cso_save_vertex_sampler_views(struct cso_context *ctx)
+cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
{
- save_sampler_views(ctx, &ctx->vertex_samplers);
-}
+ struct sampler_info *info = &ctx->samplers[shader_stage];
+ unsigned i, nr_saved = info->nr_views_saved;
-
-static void
-restore_sampler_views(struct cso_context *ctx,
- struct sampler_info *info,
- void (*set_views)(struct pipe_context *,
- unsigned num_views,
- struct pipe_sampler_view **))
-{
- uint i;
-
- for (i = 0; i < info->nr_views_saved; i++) {
+ for (i = 0; i < nr_saved; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
/* move the reference from one pointer to another */
info->views[i] = info->views_saved[i];
@@ -1252,26 +1171,24 @@ restore_sampler_views(struct cso_context *ctx,
}
/* bind the old/saved sampler views */
- set_views(ctx->pipe, info->nr_views_saved, info->views);
+ switch (shader_stage) {
+ case PIPE_SHADER_FRAGMENT:
+ ctx->pipe->set_fragment_sampler_views(ctx->pipe, nr_saved, info->views);
+ break;
+ case PIPE_SHADER_VERTEX:
+ ctx->pipe->set_vertex_sampler_views(ctx->pipe, nr_saved, info->views);
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ ctx->pipe->set_geometry_sampler_views(ctx->pipe, nr_saved, info->views);
+ break;
+ default:
+ assert(!"bad shader type in cso_restore_sampler_views()");
+ }
- info->nr_views = info->nr_views_saved;
+ info->nr_views = nr_saved;
info->nr_views_saved = 0;
}
-void
-cso_restore_fragment_sampler_views(struct cso_context *ctx)
-{
- restore_sampler_views(ctx, &ctx->fragment_samplers,
- ctx->pipe->set_fragment_sampler_views);
-}
-
-void
-cso_restore_vertex_sampler_views(struct cso_context *ctx)
-{
- restore_sampler_views(ctx, &ctx->vertex_samplers,
- ctx->pipe->set_vertex_sampler_views);
-}
-
void
cso_set_stream_outputs(struct cso_context *ctx,
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 4de08a8364c..f01a0f20c62 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -69,39 +69,29 @@ void cso_save_rasterizer(struct cso_context *cso);
void cso_restore_rasterizer(struct cso_context *cso);
-
-enum pipe_error cso_set_samplers( struct cso_context *cso,
- unsigned count,
- const struct pipe_sampler_state **states );
-void cso_save_samplers(struct cso_context *cso);
-void cso_restore_samplers(struct cso_context *cso);
-
-/* Alternate interface to support state trackers that like to modify
- * samplers one at a time:
- */
-enum pipe_error cso_single_sampler( struct cso_context *cso,
- unsigned nr,
- const struct pipe_sampler_state *states );
-
-void cso_single_sampler_done( struct cso_context *cso );
-
-enum pipe_error cso_set_vertex_samplers(struct cso_context *cso,
- unsigned count,
- const struct pipe_sampler_state **states);
+enum pipe_error
+cso_set_samplers(struct cso_context *cso,
+ unsigned shader_stage,
+ unsigned count,
+ const struct pipe_sampler_state **states);
void
-cso_save_vertex_samplers(struct cso_context *cso);
+cso_save_samplers(struct cso_context *cso, unsigned shader_stage);
void
-cso_restore_vertex_samplers(struct cso_context *cso);
+cso_restore_samplers(struct cso_context *cso, unsigned shader_stage);
+/* Alternate interface to support state trackers that like to modify
+ * samplers one at a time:
+ */
enum pipe_error
-cso_single_vertex_sampler(struct cso_context *cso,
- unsigned nr,
- const struct pipe_sampler_state *states);
+cso_single_sampler(struct cso_context *cso,
+ unsigned shader_stage,
+ unsigned count,
+ const struct pipe_sampler_state *states);
void
-cso_single_vertex_sampler_done(struct cso_context *cso);
+cso_single_sampler_done(struct cso_context *cso, unsigned shader_stage);
enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
@@ -126,6 +116,13 @@ void cso_save_stream_outputs(struct cso_context *ctx);
void cso_restore_stream_outputs(struct cso_context *ctx);
+/*
+ * We don't provide shader caching in CSO. Most of the time the api provides
+ * object semantics for shaders anyway, and the cases where it doesn't
+ * (eg mesa's internally-generated texenv programs), it will be up to
+ * the state tracker to implement their own specialized caching.
+ */
+
enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
void *handle );
void cso_delete_fragment_shader(struct cso_context *ctx, void *handle );
@@ -184,39 +181,21 @@ void
cso_restore_clip(struct cso_context *cso);
-/* fragment sampler view state */
-
-/*
- * We don't provide shader caching in CSO. Most of the time the api provides
- * object semantics for shaders anyway, and the cases where it doesn't
- * (eg mesa's internally-generated texenv programs), it will be up to
- * the state tracker to implement their own specialized caching.
- */
-
-void
-cso_set_fragment_sampler_views(struct cso_context *cso,
- uint count,
- struct pipe_sampler_view **views);
+/* sampler view state */
void
-cso_save_fragment_sampler_views(struct cso_context *cso);
+cso_set_sampler_views(struct cso_context *cso,
+ unsigned shader_stage,
+ unsigned count,
+ struct pipe_sampler_view **views);
void
-cso_restore_fragment_sampler_views(struct cso_context *cso);
-
-
-/* vertex sampler view state */
+cso_save_sampler_views(struct cso_context *cso, unsigned shader_stage);
void
-cso_set_vertex_sampler_views(struct cso_context *cso,
- uint count,
- struct pipe_sampler_view **views);
+cso_restore_sampler_views(struct cso_context *cso, unsigned shader_stage);
-void
-cso_save_vertex_sampler_views(struct cso_context *cso);
-void
-cso_restore_vertex_sampler_views(struct cso_context *cso);
/* drawing */
diff --git a/src/gallium/auxiliary/postprocess/pp_colors.c b/src/gallium/auxiliary/postprocess/pp_colors.c
index 36bb1f552f5..1773e53bfba 100644
--- a/src/gallium/auxiliary/postprocess/pp_colors.c
+++ b/src/gallium/auxiliary/postprocess/pp_colors.c
@@ -43,9 +43,9 @@ pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in,
pp_filter_set_fb(p);
pp_filter_misc_state(p);
- cso_single_sampler(p->cso, 0, &p->sampler_point);
- cso_single_sampler_done(p->cso);
- cso_set_fragment_sampler_views(p->cso, 1, &p->view);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
+ cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
+ cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]);
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]);
diff --git a/src/gallium/auxiliary/postprocess/pp_init.c b/src/gallium/auxiliary/postprocess/pp_init.c
index e2068c25e5b..2dc29ac5b4b 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -152,7 +152,7 @@ pp_free(struct pp_queue_t *ppq)
util_destroy_blit(ppq->p->blitctx);
- cso_set_fragment_sampler_views(ppq->p->cso, 0, NULL);
+ cso_set_sampler_views(ppq->p->cso, PIPE_SHADER_FRAGMENT, 0, NULL);
cso_release_all(ppq->p->cso);
for (i = 0; i < ppq->n_filters; i++) {
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index 951b76f0e89..297f3e443c1 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -125,9 +125,9 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR,
&p->clear_color, 0, 0);
- cso_single_sampler(p->cso, 0, &p->sampler_point);
- cso_single_sampler_done(p->cso);
- cso_set_fragment_sampler_views(p->cso, 1, &p->view);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
+ cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
+ cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]);
@@ -152,13 +152,13 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
pp_filter_set_clear_fb(p);
- cso_single_sampler(p->cso, 0, &p->sampler_point);
- cso_single_sampler(p->cso, 1, &p->sampler_point);
- cso_single_sampler(p->cso, 2, &p->sampler);
- cso_single_sampler_done(p->cso);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->sampler_point);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 2, &p->sampler);
+ cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
arr[0] = p->view;
- cso_set_fragment_sampler_views(p->cso, 3, arr);
+ cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 3, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]);
@@ -184,12 +184,12 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
u_sampler_view_default_template(&v_tmp, in, in->format);
arr[0] = p->pipe->create_sampler_view(p->pipe, in, &v_tmp);
- cso_single_sampler(p->cso, 0, &p->sampler_point);
- cso_single_sampler(p->cso, 1, &p->sampler_point);
- cso_single_sampler_done(p->cso);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
+ cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->sampler_point);
+ cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
arr[1] = p->view;
- cso_set_fragment_sampler_views(p->cso, 2, arr);
+ cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 2, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]);
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index b52f4c092c2..d2477d28e8e 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -648,8 +648,8 @@ util_blit_pixels(struct blit_state *ctx,
cso_save_blend(ctx->cso);
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
- cso_save_samplers(ctx->cso);
- cso_save_fragment_sampler_views(ctx->cso);
+ cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_save_stream_outputs(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_framebuffer(ctx->cso);
@@ -680,17 +680,17 @@ util_blit_pixels(struct blit_state *ctx,
* we blit.
*/
if (blit_depth && blit_stencil) {
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
/* don't filter stencil */
ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
- cso_single_sampler(ctx->cso, 1, &ctx->sampler);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depthstencil);
set_depthstencil_fragment_shader(ctx, sampler_view->texture->target);
}
else if (blit_depth) {
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depth);
set_depth_fragment_shader(ctx, sampler_view->texture->target);
}
@@ -698,17 +698,17 @@ util_blit_pixels(struct blit_state *ctx,
/* don't filter stencil */
ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_stencil);
set_stencil_fragment_shader(ctx, sampler_view->texture->target);
}
else { /* color */
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil);
set_fragment_shader(ctx, writemask, sampler_view->texture->target);
}
- cso_single_sampler_done(ctx->cso);
+ cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
/* textures */
if (blit_depth && blit_stencil) {
@@ -722,12 +722,12 @@ util_blit_pixels(struct blit_state *ctx,
views[0] = sampler_view;
views[1] = pipe->create_sampler_view(pipe, views[0]->texture, &templ);
- cso_set_fragment_sampler_views(ctx->cso, 2, views);
+ cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 2, views);
pipe_sampler_view_reference(&views[1], NULL);
}
else {
- cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view);
+ cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &sampler_view);
}
/* viewport */
@@ -777,8 +777,8 @@ util_blit_pixels(struct blit_state *ctx,
cso_restore_blend(ctx->cso);
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
- cso_restore_samplers(ctx->cso);
- cso_restore_fragment_sampler_views(ctx->cso);
+ cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_restore_viewport(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
@@ -849,8 +849,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_blend(ctx->cso);
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
- cso_save_samplers(ctx->cso);
- cso_save_fragment_sampler_views(ctx->cso);
+ cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_save_stream_outputs(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_framebuffer(ctx->cso);
@@ -871,8 +871,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
ctx->sampler.normalized_coords = normalized;
ctx->sampler.min_img_filter = filter;
ctx->sampler.mag_img_filter = filter;
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
- cso_single_sampler_done(ctx->cso);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
+ cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
/* viewport */
ctx->viewport.scale[0] = 0.5f * dst->width;
@@ -886,7 +886,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_viewport(ctx->cso, &ctx->viewport);
/* texture */
- cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view);
+ cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &src_sampler_view);
/* shaders */
set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW,
@@ -921,8 +921,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_blend(ctx->cso);
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
- cso_restore_samplers(ctx->cso);
- cso_restore_fragment_sampler_views(ctx->cso);
+ cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_restore_viewport(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index a96cf6a3062..222bf6b028d 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1573,8 +1573,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_blend(ctx->cso);
cso_save_depth_stencil_alpha(ctx->cso);
cso_save_rasterizer(ctx->cso);
- cso_save_samplers(ctx->cso);
- cso_save_fragment_sampler_views(ctx->cso);
+ cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_save_stream_outputs(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
@@ -1675,10 +1675,10 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
*/
ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel;
ctx->sampler.lod_bias = (float) srcLevel;
- cso_single_sampler(ctx->cso, 0, &ctx->sampler);
- cso_single_sampler_done(ctx->cso);
+ cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
+ cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_set_fragment_sampler_views(ctx->cso, 1, &psv);
+ cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv);
/* quad coords in clip coords */
offset = set_vertex_data(ctx,
@@ -1703,8 +1703,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_restore_blend(ctx->cso);
cso_restore_depth_stencil_alpha(ctx->cso);
cso_restore_rasterizer(ctx->cso);
- cso_restore_samplers(ctx->cso);
- cso_restore_fragment_sampler_views(ctx->cso);
+ cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index dc0c789c5c6..84fbd9d4651 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -219,12 +219,12 @@ update_vertex_samplers(struct st_context *st)
st->state.num_vertex_samplers = su + 1;
- cso_single_vertex_sampler(st->cso_context, su, sampler);
+ cso_single_sampler(st->cso_context, PIPE_SHADER_VERTEX, su, sampler);
} else {
- cso_single_vertex_sampler(st->cso_context, su, NULL);
+ cso_single_sampler(st->cso_context, PIPE_SHADER_VERTEX, su, NULL);
}
}
- cso_single_vertex_sampler_done(st->cso_context);
+ cso_single_sampler_done(st->cso_context, PIPE_SHADER_VERTEX);
}
@@ -253,18 +253,18 @@ update_fragment_samplers(struct st_context *st)
st->state.num_samplers = su + 1;
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
- cso_single_sampler(st->cso_context, su, sampler);
+ cso_single_sampler(st->cso_context, PIPE_SHADER_FRAGMENT, su, sampler);
}
else if (samplers_used != 0 || su < old_max) {
/*printf("%s su=%u null\n", __FUNCTION__, su);*/
- cso_single_sampler(st->cso_context, su, NULL);
+ cso_single_sampler(st->cso_context, PIPE_SHADER_FRAGMENT, su, NULL);
} else {
/* if we've reset all the old views and we have no more new ones */
break;
}
}
- cso_single_sampler_done(st->cso_context);
+ cso_single_sampler_done(st->cso_context, PIPE_SHADER_FRAGMENT);
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index fefa5986096..f5db65ae120 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -288,9 +288,10 @@ update_vertex_textures(struct st_context *st)
if (ctx->Const.MaxVertexTextureImageUnits > 0) {
GLuint numUnits = MIN2(st->state.num_vertex_textures,
ctx->Const.MaxVertexTextureImageUnits);
- cso_set_vertex_sampler_views(st->cso_context,
- numUnits,
- st->state.sampler_vertex_views);
+ cso_set_sampler_views(st->cso_context,
+ PIPE_SHADER_VERTEX,
+ numUnits,
+ st->state.sampler_vertex_views);
}
}
@@ -329,9 +330,10 @@ update_fragment_textures(struct st_context *st)
pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
}
- cso_set_fragment_sampler_views(st->cso_context,
- st->state.num_textures,
- st->state.sampler_views);
+ cso_set_sampler_views(st->cso_context,
+ PIPE_SHADER_FRAGMENT,
+ st->state.num_textures,
+ st->state.sampler_views);
}
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index c2605887428..131efcabc6b 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -454,8 +454,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
assert(height <= (GLsizei)maxSize);
cso_save_rasterizer(cso);
- cso_save_samplers(cso);
- cso_save_fragment_sampler_views(cso);
+ cso_save_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_save_viewport(cso);
cso_save_fragment_shader(cso);
cso_save_stream_outputs(cso);
@@ -487,7 +487,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
}
samplers[fpv->bitmap_sampler] =
&st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
- cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers);
+ cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, num,
+ (const struct pipe_sampler_state **) samplers);
}
/* user textures, plus the bitmap texture */
@@ -496,7 +497,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures);
memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
sampler_views[fpv->bitmap_sampler] = sv;
- cso_set_fragment_sampler_views(cso, num, sampler_views);
+ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
}
/* viewport state: viewport matching window dims */
@@ -535,8 +536,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* restore state */
cso_restore_rasterizer(cso);
- cso_restore_samplers(cso);
- cso_restore_fragment_sampler_views(cso);
+ cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_restore_viewport(cso);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index f288a963244..88068ac6078 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -679,8 +679,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_save_rasterizer(cso);
cso_save_viewport(cso);
- cso_save_samplers(cso);
- cso_save_fragment_sampler_views(cso);
+ cso_save_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_save_fragment_shader(cso);
cso_save_stream_outputs(cso);
cso_save_vertex_shader(cso);
@@ -751,11 +751,11 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
sampler.normalized_coords = normalized;
- cso_single_sampler(cso, 0, &sampler);
+ cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 0, &sampler);
if (num_sampler_view > 1) {
- cso_single_sampler(cso, 1, &sampler);
+ cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, &sampler);
}
- cso_single_sampler_done(cso);
+ cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
}
/* viewport state: viewport matching window dims */
@@ -778,7 +778,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
/* texture state: */
- cso_set_fragment_sampler_views(cso, num_sampler_view, sv);
+ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv);
/* Compute Gallium window coords (y=0=top) with pixel zoom.
* Recall that these coords are transformed by the current
@@ -804,8 +804,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* restore state */
cso_restore_rasterizer(cso);
cso_restore_viewport(cso);
- cso_restore_samplers(cso);
- cso_restore_fragment_sampler_views(cso);
+ cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
cso_restore_geometry_shader(cso);