vc4: Avoid a null-deref if a sampler index isn't used.

Part of fixing ARB_fragment_program/sparse-samplers
This commit is contained in:
Eric Anholt 2014-08-18 15:50:48 -07:00
parent 31ce84a81f
commit c8097afe29

View file

@ -1270,8 +1270,11 @@ static void
vc4_setup_shared_key(struct vc4_key *key, struct vc4_texture_stateobj *texstate)
{
for (int i = 0; i < texstate->num_textures; i++) {
struct pipe_resource *prsc = texstate->textures[i]->texture;
key->tex_format[i] = prsc->format;
struct pipe_sampler_view *sampler = texstate->textures[i];
if (sampler) {
struct pipe_resource *prsc = sampler->texture;
key->tex_format[i] = prsc->format;
}
}
}