svga: fix an error in svga_texture_generate_mipmap
authorCharmaine Lee <charmainel@vmware.com>
Mon, 29 Feb 2016 20:00:12 +0000 (12:00 -0800)
committerBrian Paul <brianp@vmware.com>
Fri, 4 Mar 2016 14:57:41 +0000 (07:57 -0700)
With this patch, make sure the shader resource view is properly created
before referencing it in the generate mipmap command.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/drivers/svga/svga_resource_texture.c

index 3f754c4d53e9ce800264b5e9d2dc1bace55f4523..e898ff2c4e6e554eb57938ca092102001cddc118 100644 (file)
@@ -1038,7 +1038,12 @@ svga_texture_generate_mipmap(struct pipe_context *pipe,
       return FALSE;
 
    sv = svga_pipe_sampler_view(psv);
-   svga_validate_pipe_sampler_view(svga, sv);
+   ret = svga_validate_pipe_sampler_view(svga, sv);
+   if (ret != PIPE_OK) {
+      svga_context_flush(svga, NULL);
+      ret = svga_validate_pipe_sampler_view(svga, sv);
+      assert(ret == PIPE_OK);
+   }
 
    ret = SVGA3D_vgpu10_GenMips(svga->swc, sv->id, tex->handle);
    if (ret != PIPE_OK) {