summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-09-29 12:05:19 +0100
committerJosé Fonseca <[email protected]>2010-09-29 14:16:35 +0100
commitfdcc168a16d59bf2b7fd291383f214834c2546f6 (patch)
tree7d2a291fada15ea0174d0524ceb2f0622f94a4c7 /src/gallium/drivers/llvmpipe/lp_setup.c
parent4b70fe8421f5132c585ff1dfb8d90229be26e71f (diff)
llvmpipe: Decouple sampler view and sampler state updates.
Fixes glean pbo crash. It would be possible to avoid crashing without decoupling, but given that state trackers give no guarantee that number of views is consistent, that would likely cause too many state updates (or miss some).
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index eade4000873..5ff11a33632 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -617,8 +617,7 @@ lp_setup_set_vertex_info( struct lp_setup_context *setup,
void
lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
unsigned num,
- struct pipe_sampler_view **views,
- const struct pipe_sampler_state **samplers)
+ struct pipe_sampler_view **views)
{
unsigned i;
@@ -629,7 +628,7 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
struct pipe_sampler_view *view = i < num ? views[i] : NULL;
- if(view) {
+ if (view) {
struct pipe_resource *tex = view->texture;
struct llvmpipe_resource *lp_tex = llvmpipe_resource(tex);
struct lp_jit_texture *jit_tex;
@@ -639,12 +638,6 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
jit_tex->depth = tex->depth0;
jit_tex->last_level = tex->last_level;
- /* sampler state */
- jit_tex->min_lod = samplers[i]->min_lod;
- jit_tex->max_lod = samplers[i]->max_lod;
- jit_tex->lod_bias = samplers[i]->lod_bias;
- COPY_4V(jit_tex->border_color, samplers[i]->border_color);
-
/* We're referencing the texture's internal data, so save a
* reference to it.
*/
@@ -694,6 +687,38 @@ lp_setup_set_fragment_sampler_views(struct lp_setup_context *setup,
/**
+ * Called during state validation when LP_NEW_SAMPLER is set.
+ */
+void
+lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup,
+ unsigned num,
+ const struct pipe_sampler_state **samplers)
+{
+ unsigned i;
+
+ LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+
+ assert(num <= PIPE_MAX_SAMPLERS);
+
+ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
+ const struct pipe_sampler_state *sampler = i < num ? samplers[i] : NULL;
+
+ if (sampler) {
+ struct lp_jit_texture *jit_tex;
+ jit_tex = &setup->fs.current.jit_context.textures[i];
+
+ jit_tex->min_lod = sampler->min_lod;
+ jit_tex->max_lod = sampler->max_lod;
+ jit_tex->lod_bias = sampler->lod_bias;
+ COPY_4V(jit_tex->border_color, sampler->border_color);
+ }
+ }
+
+ setup->dirty |= LP_SETUP_NEW_FS;
+}
+
+
+/**
* Is the given texture referenced by any scene?
* Note: we have to check all scenes including any scenes currently
* being rendered and the current scene being built.