From a31ab58d644d18420594645dc145ea900d6bad00 Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 7 Jun 2017 18:03:21 +0100 Subject: [PATCH] More D3D error checking. Patch from ruben_balea --- src/win-d3d-fs.cc | 8 +++++--- src/win-d3d.cc | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/win-d3d-fs.cc b/src/win-d3d-fs.cc index c611647..dcd1d74 100644 --- a/src/win-d3d-fs.cc +++ b/src/win-d3d-fs.cc @@ -123,14 +123,16 @@ static void d3d_fs_init_objects() int y; RECT r; - d3ddev->CreateVertexBuffer(12*sizeof(CUSTOMVERTEX), + if (FAILED(d3ddev->CreateVertexBuffer(12*sizeof(CUSTOMVERTEX), 0, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1, D3DPOOL_MANAGED, &v_buffer, - NULL); + NULL))) + fatal("CreateVertexBuffer failed\n"); - d3ddev->CreateTexture(2048, 2048, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL); + if (FAILED(d3ddev->CreateTexture(2048, 2048, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL))) + fatal("CreateTexture failed\n"); r.top = r.left = 0; r.bottom = r.right = 2047; diff --git a/src/win-d3d.cc b/src/win-d3d.cc index 0abcc80..12402af 100644 --- a/src/win-d3d.cc +++ b/src/win-d3d.cc @@ -100,15 +100,17 @@ void d3d_init_objects() int y; RECT r; - d3ddev->CreateVertexBuffer(12*sizeof(CUSTOMVERTEX), + if (FAILED(d3ddev->CreateVertexBuffer(12*sizeof(CUSTOMVERTEX), 0, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1, D3DPOOL_MANAGED, &v_buffer, - NULL); + NULL))) + fatal("CreateVertexBuffer failed\n"); - d3ddev->CreateTexture(2048, 2048, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL); - + if (FAILED(d3ddev->CreateTexture(2048, 2048, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_MANAGED, &d3dTexture, NULL))) + fatal("CreateTexture failed\n"); + r.top = r.left = 0; r.bottom = r.right = 2047;