Created attachment 113080 [details]
In osmesa_st_framebuffer_validate(), osbuffer is indexed by i:
> out[i] = osbuffer->textures[i] =
> screen->resource_create(screen, &templat);
This caused a crash in OSMesaGetDepthBuffer() at:
> struct pipe_resource *res = osbuffer->textures[ST_ATTACHMENT_DEPTH_STENCIL];
This has been present since (at least) Mesa 10.1.3 but somehow it worked OK in 10.1.3.
Thanks. Your patch looks correct. I believe we can also simply some code in osmesa_st_framebuffer_flush_front() as a follow-on.
I'll apply your patch to master and the 10.4 branch.