diff options
author | Brian Paul <[email protected]> | 2018-08-22 11:11:22 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-08-29 11:29:07 -0600 |
commit | 8331d69a877bcc656ec19dd48ba5975138336f59 (patch) | |
tree | 84c92b19356ab0fa9e8bbcac56c8a5e2c7bda92a /src/gallium/drivers | |
parent | 46c7433da80aed0dcd2f7ee5d58dd9f7ebf37647 (diff) |
svga: fix PIPE_TEXTURE_RECT/BUFFER const buffer issue
The flag_rect and flag_buffer fields didn't sufficiently capture
the state changes needed for those resource types. For example,
if a texture binding was changed from a 500x500 rect texture to a
400x400 rect texture we didn't set SVGA_NEW_TEXTURE_CONSTS. But
we need to do that to emit the new texcoord scale factors to the
constant buffers. Rather than track the sizes of all bound
resources, just set the flag if the resource is a rect. Same
story with texture buffers.
Also, since rect/buffer textures are usable with VS/GS shaders,
add SVGA_NEW_TEXTURE_CONSTS to the flags we check for emitting
VS/GS constants.
This seems to help with XFCE / xfwm4 desktop scaling.
VMware issue 2156696.
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/svga/svga_context.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_sampler.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_constants.c | 6 |
3 files changed, 16 insertions, 20 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index bc881c943d6..484fd55d5ed 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -300,8 +300,6 @@ 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; diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 4c38092078c..b32bb098f7f 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -446,8 +446,6 @@ 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; @@ -493,12 +491,19 @@ svga_set_sampler_views(struct pipe_context *pipe, flag_srgb |= 1 << (start + i); target = views[i]->target; - if (target == PIPE_TEXTURE_1D) + 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); + } else if (target == PIPE_TEXTURE_RECT) { + /* If the size of the bound texture changes, we need to emit new + * const buffer values. + */ + svga->dirty |= SVGA_NEW_TEXTURE_CONSTS; + } else if (target == PIPE_BUFFER) { + /* If the size of the bound buffer changes, we need to emit new + * const buffer values. + */ + svga->dirty |= SVGA_NEW_TEXTURE_CONSTS; + } } if (!any_change) { @@ -522,15 +527,6 @@ 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, set 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 9af91fedaef..2c1b7048673 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -769,7 +769,8 @@ struct svga_tracked_state svga_hw_vs_constants = "hw vs params", (SVGA_NEW_PRESCALE | SVGA_NEW_VS_CONST_BUFFER | - SVGA_NEW_VS_VARIANT), + SVGA_NEW_VS_VARIANT | + SVGA_NEW_TEXTURE_CONSTS), emit_vs_consts }; @@ -809,6 +810,7 @@ struct svga_tracked_state svga_hw_gs_constants = (SVGA_NEW_PRESCALE | SVGA_NEW_GS_CONST_BUFFER | SVGA_NEW_RAST | - SVGA_NEW_GS_VARIANT), + SVGA_NEW_GS_VARIANT | + SVGA_NEW_TEXTURE_CONSTS), emit_gs_consts }; |