diff options
-rw-r--r-- | src/gallium/drivers/svga/svga_context.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_sampler.c | 20 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_constants.c | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index b485485f0be..007d5bc3b51 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -291,6 +291,8 @@ struct svga_state struct { unsigned flag_1d; unsigned flag_srgb; + unsigned flag_rect; /* sampler views with rectangular texture target */ + unsigned flag_buf; /* sampler views with texture buffer target */ } tex_flags; unsigned sample_mask; @@ -586,6 +588,7 @@ struct svga_context #define SVGA_NEW_GS 0x10000000 #define SVGA_NEW_GS_CONST_BUFFER 0x20000000 #define SVGA_NEW_GS_VARIANT 0x40000000 +#define SVGA_NEW_TEXTURE_CONSTS 0x80000000 diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 0780c95ad9c..845eebbd014 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -421,6 +421,8 @@ svga_set_sampler_views(struct pipe_context *pipe, struct svga_context *svga = svga_context(pipe); unsigned flag_1d = 0; unsigned flag_srgb = 0; + unsigned flag_rect = 0; + unsigned flag_buf = 0; uint i; boolean any_change = FALSE; @@ -432,6 +434,8 @@ svga_set_sampler_views(struct pipe_context *pipe, return; for (i = 0; i < num; i++) { + enum pipe_texture_target target; + if (svga->curr.sampler_views[shader][start + i] != views[i]) { /* Note: we're using pipe_sampler_view_release() here to work around * a possible crash when the old view belongs to another context that @@ -449,8 +453,13 @@ svga_set_sampler_views(struct pipe_context *pipe, if (util_format_is_srgb(views[i]->format)) flag_srgb |= 1 << (start + i); - if (views[i]->texture->target == PIPE_TEXTURE_1D) + target = views[i]->texture->target; + if (target == PIPE_TEXTURE_1D) flag_1d |= 1 << (start + i); + else if (target == PIPE_TEXTURE_RECT) + flag_rect |= 1 << (start + i); + else if (target == PIPE_BUFFER) + flag_buf |= 1 << (start + i); } if (!any_change) { @@ -474,6 +483,15 @@ svga_set_sampler_views(struct pipe_context *pipe, svga->curr.tex_flags.flag_srgb = flag_srgb; } + if (flag_rect != svga->curr.tex_flags.flag_rect || + flag_buf != svga->curr.tex_flags.flag_buf) + { + /* Need to re-emit texture constants */ + svga->dirty |= SVGA_NEW_TEXTURE_CONSTS; + svga->curr.tex_flags.flag_rect = flag_rect; + svga->curr.tex_flags.flag_buf = flag_buf; + } + /* Check if any of the sampler view resources collide with the framebuffer * color buffers or depth stencil resource. If so, enable the NEW_FRAME_BUFFER * dirty bit so that emit_framebuffer can be invoked to create backed view diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 51f393f9b0c..8784f47413f 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -788,7 +788,7 @@ struct svga_tracked_state svga_hw_fs_constants = "hw fs params", (SVGA_NEW_FS_CONST_BUFFER | SVGA_NEW_FS_VARIANT | - SVGA_NEW_TEXTURE_BINDING), + SVGA_NEW_TEXTURE_CONSTS), emit_fs_consts }; |