diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2015-09-04 03:26:05 -0700 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2015-09-07 01:25:08 -0700 |
commit | f1ef89eaab765789d777a5bd1bdfcb7811e3a22d (patch) | |
tree | ac5e1b87e873131952f108ad91938ae0afc35899 | |
parent | 1432a182414352e853bfdad997591598e621fd73 (diff) |
svga: Fix surface view error handling
Make sure errors are correcly propagated.
Also don't flush during state emission if emission fails.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r-- | src/gallium/drivers/svga/svga_surface.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index 477a938ccd..aca5abcdfc 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -296,6 +296,11 @@ svga_create_surface_view(struct pipe_context *pipe, s->handle = svga_texture_view_surface(svga, tex, bind, flags, tex->key.format, surf_tmpl->u.tex.level, 1, layer, nlayers, zslice, &s->key); + if (!s->handle) { + FREE(s); + return NULL; + } + s->key.format = format; s->real_layer = 0; s->real_level = 0; @@ -358,6 +363,8 @@ create_backed_surface_view(struct svga_context *svga, struct svga_surface *s) &tex->b.b, &s->base, TRUE); + if (!backed_view) + return NULL; bs = svga_surface(backed_view); s->backed = bs; @@ -376,7 +383,6 @@ struct pipe_surface * svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) { enum pipe_error ret = PIPE_OK; - int try; unsigned shader; assert(svga_have_vgpu10(svga)); @@ -395,6 +401,9 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) "same resource used in shaderResource and renderTarget 0x%x\n", s->handle); s = create_backed_surface_view(svga, s); + if (!s) + return NULL; + break; } } @@ -430,32 +439,27 @@ svga_validate_surface_view(struct svga_context *svga, struct svga_surface *s) resType = SVGA3D_RESOURCE_TEXTURE2D; } - for (try = 0; try < 2; try++) { - if (util_format_is_depth_or_stencil(s->base.format)) { - ret = SVGA3D_vgpu10_DefineDepthStencilView(svga->swc, - s->view_id, - s->handle, - s->key.format, - resType, - &desc); - } - else { - ret = SVGA3D_vgpu10_DefineRenderTargetView(svga->swc, - s->view_id, - s->handle, - s->key.format, - resType, - &desc); - } - if (ret == PIPE_OK) - break; - svga_context_flush(svga, NULL); + if (util_format_is_depth_or_stencil(s->base.format)) { + ret = SVGA3D_vgpu10_DefineDepthStencilView(svga->swc, + s->view_id, + s->handle, + s->key.format, + resType, + &desc); + } + else { + ret = SVGA3D_vgpu10_DefineRenderTargetView(svga->swc, + s->view_id, + s->handle, + s->key.format, + resType, + &desc); } - assert(ret == PIPE_OK); if (ret != PIPE_OK) { util_bitmask_clear(svga->surface_view_id_bm, s->view_id); s->view_id = SVGA3D_INVALID_ID; + return NULL; } } return &s->base; |