summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl/vl_vertex_buffers.c
diff options
context:
space:
mode:
authorChristian König <deathsimple@vodafone.de>2011-04-23 13:58:08 +0200
committerChristian König <deathsimple@vodafone.de>2011-04-23 13:58:08 +0200
commit24d76d2966a5c666c9627034e6751621b17024c8 (patch)
tree4cb2c9dffc576f0e3241b5cf501b38ad69cc0c81 /src/gallium/auxiliary/vl/vl_vertex_buffers.c
parent2e6274fc3b123e7de695038054b5cbd20b11559a (diff)
downloadexternal_mesa3d-24d76d2966a5c666c9627034e6751621b17024c8.zip
external_mesa3d-24d76d2966a5c666c9627034e6751621b17024c8.tar.gz
external_mesa3d-24d76d2966a5c666c9627034e6751621b17024c8.tar.bz2
[g3dvl] cleanup error handling
Diffstat (limited to 'src/gallium/auxiliary/vl/vl_vertex_buffers.c')
-rw-r--r--src/gallium/auxiliary/vl/vl_vertex_buffers.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index d2e0398..c45f96c 100644
--- a/src/gallium/auxiliary/vl/vl_vertex_buffers.c
+++ b/src/gallium/auxiliary/vl/vl_vertex_buffers.c
@@ -199,7 +199,7 @@ vl_vb_get_ves_mv(struct pipe_context *pipe)
return pipe->create_vertex_elements_state(pipe, NUM_VS_INPUTS, vertex_elems);
}
-void
+bool
vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe,
unsigned width, unsigned height)
{
@@ -220,6 +220,8 @@ vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe,
PIPE_USAGE_STREAM,
sizeof(struct pipe_ycbcr_block) * size * 4
);
+ if (!buffer->ycbcr[i].resource)
+ goto error_ycbcr;
}
for (i = 0; i < VL_MAX_REF_FRAMES; ++i) {
@@ -230,9 +232,21 @@ vl_vb_init(struct vl_vertex_buffer *buffer, struct pipe_context *pipe,
PIPE_USAGE_STREAM,
sizeof(struct pipe_motionvector) * size
);
+ if (!buffer->mv[i].resource)
+ goto error_mv;
}
vl_vb_map(buffer, pipe);
+ return true;
+
+error_mv:
+ for (i = 0; i < VL_MAX_PLANES; ++i)
+ pipe_resource_reference(&buffer->mv[i].resource, NULL);
+
+error_ycbcr:
+ for (i = 0; i < VL_MAX_PLANES; ++i)
+ pipe_resource_reference(&buffer->ycbcr[i].resource, NULL);
+ return false;
}
struct pipe_vertex_buffer