svga: fix resource checking in is_blending_enabled()
authorCharmaine Lee <charmainel@vmware.com>
Mon, 18 Dec 2017 17:41:54 +0000 (09:41 -0800)
committerBrian Paul <brianp@vmware.com>
Mon, 10 Sep 2018 19:07:30 +0000 (13:07 -0600)
This patch makes sure a valid color buffer is bound before
checking its resource. This fixes Unigine Valley running in SM41 device.

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

index 57df5f4c48915401f1b72d16f708981ffc30727e..ab612416c284c6f6d0c110759031fae8c139f131 100644 (file)
@@ -234,7 +234,8 @@ is_blending_enabled(struct svga_context *svga,
    if (svga->curr.blend) {
       if (svga->curr.blend->independent_blend_enable) {
          for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
-            if (svga->curr.framebuffer.cbufs[i]->texture == blit->dst.resource) {
+            struct pipe_surface *cbuf = svga->curr.framebuffer.cbufs[i];
+            if (cbuf && (cbuf->texture == blit->dst.resource)) {
                if (svga->curr.blend->rt[i].blend_enable) {
                   blend_enable = true;
                }