summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/swapchain9.c
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2016-09-24 10:46:27 +0200
committerAxel Davy <[email protected]>2016-10-10 23:43:51 +0200
commitf04fa0a62c6d39659c38eabd63bff54f0d2833fe (patch)
tree2fe7caf339495f9b721ed91cd7bddfc2b515f0be /src/gallium/state_trackers/nine/swapchain9.c
parentf8c01e7a96aed4e64eab11acbae8aef70c8e7cbe (diff)
st/nine: Assert on buffer creation failure
Add an assert to make sure buffer creation doesn't fail. Add error handling in calling functions. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/swapchain9.c')
-rw-r--r--src/gallium/state_trackers/nine/swapchain9.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index 9459786c6cf..e61111899c7 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -85,6 +85,7 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This,
D3DWindowBuffer *ret;
struct winsys_handle whandle;
int stride, dmaBufFd;
+ HRESULT hr;
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_FD;
@@ -96,14 +97,20 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This,
PIPE_HANDLE_USAGE_READ);
stride = whandle.stride;
dmaBufFd = whandle.handle;
- ID3DPresent_NewD3DWindowBufferFromDmaBuf(This->present,
- dmaBufFd,
- resource->width0,
- resource->height0,
- stride,
- depth,
- 32,
- &ret);
+ hr = ID3DPresent_NewD3DWindowBufferFromDmaBuf(This->present,
+ dmaBufFd,
+ resource->width0,
+ resource->height0,
+ stride,
+ depth,
+ 32,
+ &ret);
+ assert (SUCCEEDED(hr));
+
+ if (FAILED(hr)) {
+ ERR("Failed to create new D3DWindowBufferFromDmaBuf\n");
+ return NULL;
+ }
return ret;
}
@@ -339,6 +346,9 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
}
This->present_handles[i] = D3DWindowBuffer_create(This, resource, depth, false);
pipe_resource_reference(&resource, NULL);
+ if (!This->present_handles[i]) {
+ return D3DERR_DRIVERINTERNALERROR;
+ }
}
if (pParams->EnableAutoDepthStencil) {
tmplt.bind = d3d9_get_pipe_depth_format_bindings(pParams->AutoDepthStencilFormat);