summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-06-15 03:00:59 +0200
committerMarek Olšák <[email protected]>2017-06-22 01:51:02 +0200
commit8aba778fa2cd98a0b5a7429d3c5057778a0c808c (patch)
tree34037f7139a86e9292d06afd06d9accf1e4cb220 /src/mesa/state_tracker
parent222a910a9bff5f4138794e0ef69775a1acdad35a (diff)
st/mesa: don't set sampler states for TBOs
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c11
-rw-r--r--src/mesa/state_tracker/st_texture.c5
2 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 2481a72a55b..a10a46995ba 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -223,6 +223,7 @@ st_convert_sampler_from_unit(const struct st_context *st,
texobj = ctx->Texture.Unit[texUnit]._Current;
assert(texobj);
+ assert(texobj->Target != GL_TEXTURE_BUFFER);
msamp = _mesa_get_samplerobj(ctx, texUnit);
@@ -244,6 +245,7 @@ update_shader_samplers(struct st_context *st,
struct pipe_sampler_state *samplers,
unsigned *out_num_samplers)
{
+ struct gl_context *ctx = st->ctx;
GLbitfield samplers_used = prog->SamplersUsed;
GLbitfield free_slots = ~prog->SamplersUsed;
GLbitfield external_samplers_used = prog->ExternalSamplersUsed;
@@ -258,9 +260,14 @@ update_shader_samplers(struct st_context *st,
/* loop over sampler units (aka tex image units) */
for (unit = 0; samplers_used; unit++, samplers_used >>= 1) {
struct pipe_sampler_state *sampler = samplers + unit;
+ unsigned tex_unit = prog->SamplerUnits[unit];
- if (samplers_used & 1) {
- st_convert_sampler_from_unit(st, sampler, prog->SamplerUnits[unit]);
+ /* Don't update the sampler for TBOs. cso_context will not bind sampler
+ * states that are NULL.
+ */
+ if (samplers_used & 1 &&
+ ctx->Texture.Unit[tex_unit]._Current->Target != GL_TEXTURE_BUFFER) {
+ st_convert_sampler_from_unit(st, sampler, tex_unit);
states[unit] = sampler;
} else {
states[unit] = NULL;
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 58636286eef..cf8fe225a2d 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -510,12 +510,13 @@ st_create_texture_handle_from_unit(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
struct pipe_sampler_view *view;
- struct pipe_sampler_state sampler;
+ struct pipe_sampler_state sampler = {0};
if (!st_update_single_texture(st, &view, texUnit, prog->sh.data->Version))
return 0;
- st_convert_sampler_from_unit(st, &sampler, texUnit);
+ if (view->target != PIPE_BUFFER)
+ st_convert_sampler_from_unit(st, &sampler, texUnit);
assert(st->ctx->Texture.Unit[texUnit]._Current);