Skip to content

vrend: create sampler views in the same context the texture it refers to was created in

Gert Wollny requested to merge gerddie/virglrenderer:fix-context-switches into master

Mesa recently introduced some sampler_zombie code that tries to move still active sampler views between contexts when a context is destroyed when the sampler view was created in another context than the original texture, but it doesn't seem to take into account a typical scenario we were using in virglrenderer:

  • create resource 0 in ctx A
  • switch to a new sub-context B
  • create sampler view 1 of resources 1
  • (use this sampler view)
  • destroy sub-context B and also sampler view 1 Now resource 0 will hold a dangling reference to the sampler view 1
  • destroy context A, the zombie sampler collector tries to access the sampler view 1 and fails (use after free)

Work around this by creating the sampler view in the same context the resource was created in.

Closes #98 (closed)

Edited by Gert Wollny

Merge request reports