ddraw/tests: Split d3d1 initialization and destruction into separate functions.
Slight rewrite to make creating additional D3D1 tests easier.
This commit is contained in:
parent
ed44f9d130
commit
cfa40a22c9
|
@ -33,6 +33,13 @@ static LPDIRECT3DVERTEXBUFFER7 lpVBufSrc = NULL;
|
||||||
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest1 = NULL;
|
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest1 = NULL;
|
||||||
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest2 = NULL;
|
static LPDIRECT3DVERTEXBUFFER7 lpVBufDest2 = NULL;
|
||||||
|
|
||||||
|
static IDirectDraw *DirectDraw1 = NULL;
|
||||||
|
static IDirectDrawSurface *Surface1 = NULL;
|
||||||
|
static IDirect3D *Direct3D1 = NULL;
|
||||||
|
static IDirect3DDevice *Direct3DDevice1 = NULL;
|
||||||
|
static IDirect3DExecuteBuffer *ExecuteBuffer = NULL;
|
||||||
|
static IDirect3DViewport *Viewport = NULL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int total;
|
int total;
|
||||||
int rgb;
|
int rgb;
|
||||||
|
@ -906,18 +913,102 @@ struct v_out {
|
||||||
float x, y, z, rhw;
|
float x, y, z, rhw;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void Direct3D1Test(void)
|
static BOOL D3D1_createObjects(void)
|
||||||
{
|
{
|
||||||
IDirect3DDevice *dev1 = NULL;
|
|
||||||
IDirectDraw *dd;
|
|
||||||
IDirect3D *d3d;
|
|
||||||
IDirectDrawSurface *dds;
|
|
||||||
IDirect3DExecuteBuffer *exebuf;
|
|
||||||
IDirect3DViewport *vp;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DDSURFACEDESC ddsd;
|
DDSURFACEDESC ddsd;
|
||||||
D3DEXECUTEBUFFERDESC desc;
|
D3DEXECUTEBUFFERDESC desc;
|
||||||
D3DVIEWPORT vp_data;
|
D3DVIEWPORT vp_data;
|
||||||
|
|
||||||
|
/* An IDirect3DDevice cannot be queryInterfaced from an IDirect3DDevice7 on windows */
|
||||||
|
hr = DirectDrawCreate(NULL, &DirectDraw1, NULL);
|
||||||
|
ok(hr==DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreate returned: %x\n", hr);
|
||||||
|
if (!DirectDraw1) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirectDraw_SetCooperativeLevel(DirectDraw1, NULL, DDSCL_NORMAL);
|
||||||
|
ok(hr==DD_OK, "SetCooperativeLevel returned: %x\n", hr);
|
||||||
|
|
||||||
|
hr = IDirectDraw_QueryInterface(DirectDraw1, &IID_IDirect3D, (void**) &Direct3D1);
|
||||||
|
ok(hr==DD_OK, "QueryInterface returned: %x\n", hr);
|
||||||
|
if (!Direct3D1) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&ddsd, 0, sizeof(ddsd));
|
||||||
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
|
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
|
||||||
|
ddsd.dwWidth = 256;
|
||||||
|
ddsd.dwHeight = 256;
|
||||||
|
hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &Surface1, NULL);
|
||||||
|
ok(hr==DD_OK, "CreateSurface returned: %x\n", hr);
|
||||||
|
if (!Surface1) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirectDrawSurface_QueryInterface(Surface1, &IID_IDirect3DRGBDevice, (void **) &Direct3DDevice1);
|
||||||
|
ok(hr==D3D_OK || hr==DDERR_NOPALETTEATTACHED || hr==E_OUTOFMEMORY, "CreateDevice returned: %x\n", hr);
|
||||||
|
if(!Direct3DDevice1) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&desc, 0, sizeof(desc));
|
||||||
|
desc.dwSize = sizeof(desc);
|
||||||
|
desc.dwFlags = D3DDEB_BUFSIZE | D3DDEB_CAPS;
|
||||||
|
desc.dwCaps = D3DDEBCAPS_VIDEOMEMORY;
|
||||||
|
desc.dwBufferSize = 128;
|
||||||
|
desc.lpData = NULL;
|
||||||
|
hr = IDirect3DDevice_CreateExecuteBuffer(Direct3DDevice1, &desc, &ExecuteBuffer, NULL);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice_CreateExecuteBuffer failed: %08x\n", hr);
|
||||||
|
if(!ExecuteBuffer) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3D_CreateViewport(Direct3D1, &Viewport, NULL);
|
||||||
|
ok(hr == D3D_OK, "IDirect3D_CreateViewport failed: %08x\n", hr);
|
||||||
|
if(!Viewport) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IDirect3DViewport_Initialize(Viewport, Direct3D1);
|
||||||
|
ok(hr == DDERR_ALREADYINITIALIZED, "IDirect3DViewport_Initialize returned %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IDirect3DDevice_AddViewport(Direct3DDevice1, Viewport);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DDevice_AddViewport returned %08x\n", hr);
|
||||||
|
vp_data.dwSize = sizeof(vp_data);
|
||||||
|
vp_data.dwX = 0;
|
||||||
|
vp_data.dwY = 0;
|
||||||
|
vp_data.dwWidth = 256;
|
||||||
|
vp_data.dwHeight = 256;
|
||||||
|
vp_data.dvScaleX = 1;
|
||||||
|
vp_data.dvScaleY = 1;
|
||||||
|
vp_data.dvMaxX = 256;
|
||||||
|
vp_data.dvMaxY = 256;
|
||||||
|
vp_data.dvMinZ = 0;
|
||||||
|
vp_data.dvMaxZ = 1;
|
||||||
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void D3D1_releaseObjects(void)
|
||||||
|
{
|
||||||
|
if (Viewport) IDirect3DViewport_Release(Viewport);
|
||||||
|
if (ExecuteBuffer) IDirect3DExecuteBuffer_Release(ExecuteBuffer);
|
||||||
|
if (Direct3DDevice1) IDirect3DDevice_Release(Direct3DDevice1);
|
||||||
|
if (Surface1) IDirectDrawSurface_Release(Surface1);
|
||||||
|
if (Direct3D1) IDirect3D_Release(Direct3D1);
|
||||||
|
if (DirectDraw1) IDirectDraw_Release(DirectDraw1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Direct3D1Test(void)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
D3DEXECUTEBUFFERDESC desc;
|
||||||
|
D3DVIEWPORT vp_data;
|
||||||
D3DINSTRUCTION *instr;
|
D3DINSTRUCTION *instr;
|
||||||
D3DBRANCH *branch;
|
D3DBRANCH *branch;
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
|
@ -937,47 +1028,9 @@ static void Direct3D1Test(void)
|
||||||
D3DTRANSFORMDATA transformdata;
|
D3DTRANSFORMDATA transformdata;
|
||||||
DWORD i = FALSE;
|
DWORD i = FALSE;
|
||||||
|
|
||||||
/* An IDirect3DDevice cannot be queryInterfaced from an IDirect3DDevice7 on windows */
|
|
||||||
hr = DirectDrawCreate(NULL, &dd, NULL);
|
|
||||||
ok(hr==DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreate returned: %x\n", hr);
|
|
||||||
if (!dd) {
|
|
||||||
trace("DirectDrawCreate() failed with an error %x\n", hr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = IDirectDraw_SetCooperativeLevel(dd, NULL, DDSCL_NORMAL);
|
|
||||||
ok(hr==DD_OK, "SetCooperativeLevel returned: %x\n", hr);
|
|
||||||
|
|
||||||
hr = IDirectDraw_QueryInterface(dd, &IID_IDirect3D, (void**) &d3d);
|
|
||||||
ok(hr==DD_OK, "QueryInterface returned: %x\n", hr);
|
|
||||||
|
|
||||||
memset(&ddsd, 0, sizeof(ddsd));
|
|
||||||
ddsd.dwSize = sizeof(ddsd);
|
|
||||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
|
||||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
|
|
||||||
ddsd.dwWidth = 256;
|
|
||||||
ddsd.dwHeight = 256;
|
|
||||||
hr = IDirectDraw_CreateSurface(dd, &ddsd, &dds, NULL);
|
|
||||||
ok(hr==DD_OK, "CreateSurface returned: %x\n", hr);
|
|
||||||
|
|
||||||
dev1 = NULL;
|
|
||||||
hr = IDirectDrawSurface_QueryInterface(dds, &IID_IDirect3DRGBDevice, (void **) &dev1);
|
|
||||||
ok(hr==D3D_OK || hr==DDERR_NOPALETTEATTACHED || hr==E_OUTOFMEMORY, "CreateDevice returned: %x\n", hr);
|
|
||||||
if(!dev1) return;
|
|
||||||
|
|
||||||
memset(&desc, 0, sizeof(desc));
|
memset(&desc, 0, sizeof(desc));
|
||||||
desc.dwSize = sizeof(desc);
|
desc.dwSize = sizeof(desc);
|
||||||
desc.dwFlags = D3DDEB_BUFSIZE | D3DDEB_CAPS;
|
hr = IDirect3DExecuteBuffer_Lock(ExecuteBuffer, &desc);
|
||||||
desc.dwCaps = D3DDEBCAPS_VIDEOMEMORY;
|
|
||||||
desc.dwBufferSize = 128;
|
|
||||||
desc.lpData = NULL;
|
|
||||||
hr = IDirect3DDevice_CreateExecuteBuffer(dev1, &desc, &exebuf, NULL);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice_CreateExecuteBuffer failed: %08x\n", hr);
|
|
||||||
|
|
||||||
memset(&desc, 0, sizeof(desc));
|
|
||||||
desc.dwSize = sizeof(desc);
|
|
||||||
|
|
||||||
hr = IDirect3DExecuteBuffer_Lock(exebuf, &desc);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Lock failed: %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Lock failed: %08x\n", hr);
|
||||||
|
|
||||||
memset(desc.lpData, 0, 128);
|
memset(desc.lpData, 0, 128);
|
||||||
|
@ -995,37 +1048,16 @@ static void Direct3D1Test(void)
|
||||||
instr[idx].bOpcode = D3DOP_EXIT;
|
instr[idx].bOpcode = D3DOP_EXIT;
|
||||||
instr[idx].bSize = 0;
|
instr[idx].bSize = 0;
|
||||||
instr[idx].wCount = 0;
|
instr[idx].wCount = 0;
|
||||||
hr = IDirect3DExecuteBuffer_Unlock(exebuf);
|
hr = IDirect3DExecuteBuffer_Unlock(ExecuteBuffer);
|
||||||
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Unlock failed: %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Unlock failed: %08x\n", hr);
|
||||||
|
|
||||||
hr = IDirect3D_CreateViewport(d3d, &vp, NULL);
|
hr = IDirect3DDevice_Execute(Direct3DDevice1, ExecuteBuffer, Viewport, D3DEXECUTE_CLIPPED);
|
||||||
ok(hr == D3D_OK, "IDirect3D_CreateViewport failed: %08x\n", hr);
|
|
||||||
hr = IDirect3DViewport_Initialize(vp, d3d);
|
|
||||||
ok(hr == DDERR_ALREADYINITIALIZED, "IDirect3DViewport_Initialize returned %08x\n", hr);
|
|
||||||
|
|
||||||
hr = IDirect3DDevice_AddViewport(dev1, vp);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice_AddViewport returned %08x\n", hr);
|
|
||||||
vp_data.dwSize = sizeof(vp_data);
|
|
||||||
vp_data.dwX = 0;
|
|
||||||
vp_data.dwY = 0;
|
|
||||||
vp_data.dwWidth = 256;
|
|
||||||
vp_data.dwHeight = 256;
|
|
||||||
vp_data.dvScaleX = 1;
|
|
||||||
vp_data.dvScaleY = 1;
|
|
||||||
vp_data.dvMaxX = 256;
|
|
||||||
vp_data.dvMaxY = 256;
|
|
||||||
vp_data.dvMinZ = 0;
|
|
||||||
vp_data.dvMaxZ = 1;
|
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
|
||||||
|
|
||||||
hr = IDirect3DDevice_Execute(dev1, exebuf, vp, D3DEXECUTE_CLIPPED);
|
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice_Execute returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice_Execute returned %08x\n", hr);
|
||||||
|
|
||||||
memset(&desc, 0, sizeof(desc));
|
memset(&desc, 0, sizeof(desc));
|
||||||
desc.dwSize = sizeof(desc);
|
desc.dwSize = sizeof(desc);
|
||||||
|
|
||||||
hr = IDirect3DExecuteBuffer_Lock(exebuf, &desc);
|
hr = IDirect3DExecuteBuffer_Lock(ExecuteBuffer, &desc);
|
||||||
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Lock failed: %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Lock failed: %08x\n", hr);
|
||||||
|
|
||||||
memset(desc.lpData, 0, 128);
|
memset(desc.lpData, 0, 128);
|
||||||
|
@ -1044,10 +1076,10 @@ static void Direct3D1Test(void)
|
||||||
instr[0].bOpcode = D3DOP_EXIT;
|
instr[0].bOpcode = D3DOP_EXIT;
|
||||||
instr[0].bSize = 0;
|
instr[0].bSize = 0;
|
||||||
instr[0].wCount = 0;
|
instr[0].wCount = 0;
|
||||||
hr = IDirect3DExecuteBuffer_Unlock(exebuf);
|
hr = IDirect3DExecuteBuffer_Unlock(ExecuteBuffer);
|
||||||
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Unlock failed: %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DExecuteBuffer_Unlock failed: %08x\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice_Execute(dev1, exebuf, vp, D3DEXECUTE_CLIPPED);
|
hr = IDirect3DDevice_Execute(Direct3DDevice1, ExecuteBuffer, Viewport, D3DEXECUTE_CLIPPED);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice_Execute returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice_Execute returned %08x\n", hr);
|
||||||
|
|
||||||
memset(&transformdata, 0, sizeof(transformdata));
|
memset(&transformdata, 0, sizeof(transformdata));
|
||||||
|
@ -1058,14 +1090,14 @@ static void Direct3D1Test(void)
|
||||||
transformdata.dwOutSize = sizeof(out[0]);
|
transformdata.dwOutSize = sizeof(out[0]);
|
||||||
|
|
||||||
transformdata.lpHOut = NULL;
|
transformdata.lpHOut = NULL;
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
|
||||||
transformdata.lpHOut = outH;
|
transformdata.lpHOut = outH;
|
||||||
memset(outH, 0xaa, sizeof(outH));
|
memset(outH, 0xaa, sizeof(outH));
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1079,7 +1111,7 @@ static void Direct3D1Test(void)
|
||||||
|
|
||||||
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
||||||
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
||||||
"Vertex %d differs. Got %f %f %f %f, expected %f %f %f %f\n", i + 1,
|
"Vertex %d differs. Got %f %f %f %f, expexted %f %f %f %f\n", i + 1,
|
||||||
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
||||||
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
||||||
}
|
}
|
||||||
|
@ -1090,17 +1122,25 @@ static void Direct3D1Test(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vp_data.dwSize = sizeof(vp_data);
|
||||||
|
vp_data.dwX = 0;
|
||||||
|
vp_data.dwY = 0;
|
||||||
|
vp_data.dwWidth = 256;
|
||||||
|
vp_data.dwHeight = 256;
|
||||||
|
vp_data.dvMaxX = 256;
|
||||||
|
vp_data.dvMaxY = 256;
|
||||||
vp_data.dvScaleX = 5;
|
vp_data.dvScaleX = 5;
|
||||||
vp_data.dvScaleY = 5;
|
vp_data.dvScaleY = 5;
|
||||||
vp_data.dvMinZ = -25;
|
vp_data.dvMinZ = -25;
|
||||||
vp_data.dvMaxZ = 60;
|
vp_data.dvMaxZ = 60;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == 0, "Offscreen is %d\n", i);
|
ok(i == 0, "Offscreen is %d\n", i);
|
||||||
|
|
||||||
for(i = 0; i < sizeof(testverts) / sizeof(testverts[0]); i++) {
|
for(i = 0; i < sizeof(testverts) / sizeof(testverts[0]); i++) {
|
||||||
static const struct v_out cmp[] = {
|
static const struct v_out cmp[] = {
|
||||||
{128.0, 128.0, 0.0, 1}, {133.0, 123.0, 1.0, 1}, {123.0, 133.0, -1, 1},
|
{128.0, 128.0, 0.0, 1}, {133.0, 123.0, 1.0, 1}, {123.0, 133.0, -1, 1},
|
||||||
|
@ -1108,16 +1148,16 @@ static void Direct3D1Test(void)
|
||||||
};
|
};
|
||||||
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
||||||
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
||||||
"Vertex %d differs. Got %f %f %f %f, expected %f %f %f %f\n", i + 1,
|
"Vertex %d differs. Got %f %f %f %f, expexted %f %f %f %f\n", i + 1,
|
||||||
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
||||||
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
||||||
}
|
}
|
||||||
|
|
||||||
vp_data.dwX = 10;
|
vp_data.dwX = 10;
|
||||||
vp_data.dwY = 20;
|
vp_data.dwY = 20;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1129,13 +1169,13 @@ static void Direct3D1Test(void)
|
||||||
};
|
};
|
||||||
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
||||||
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
||||||
"Vertex %d differs. Got %f %f %f %f, expected %f %f %f %f\n", i + 1,
|
"Vertex %d differs. Got %f %f %f %f, expexted %f %f %f %f\n", i + 1,
|
||||||
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
||||||
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0xbb, sizeof(out));
|
memset(out, 0xbb, sizeof(out));
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1148,7 +1188,7 @@ static void Direct3D1Test(void)
|
||||||
};
|
};
|
||||||
ok(U1(cmpH[i]).hx == U1(outH[i]).hx && U2(cmpH[i]).hy == U2(outH[i]).hy &&
|
ok(U1(cmpH[i]).hx == U1(outH[i]).hx && U2(cmpH[i]).hy == U2(outH[i]).hy &&
|
||||||
U3(cmpH[i]).hz == U3(outH[i]).hz && cmpH[i].dwFlags == outH[i].dwFlags,
|
U3(cmpH[i]).hz == U3(outH[i]).hz && cmpH[i].dwFlags == outH[i].dwFlags,
|
||||||
"HVertex %d differs. Got %08x %f %f %f, expected %08x %f %f %f\n", i + 1,
|
"HVertex %d differs. Got %08x %f %f %f, expexted %08x %f %f %f\n", i + 1,
|
||||||
outH[i].dwFlags, U1(outH[i]).hx, U2(outH[i]).hy, U3(outH[i]).hz,
|
outH[i].dwFlags, U1(outH[i]).hx, U2(outH[i]).hy, U3(outH[i]).hz,
|
||||||
cmpH[i].dwFlags, U1(cmpH[i]).hx, U2(cmpH[i]).hy, U3(cmpH[i]).hz);
|
cmpH[i].dwFlags, U1(cmpH[i]).hx, U2(cmpH[i]).hy, U3(cmpH[i]).hz);
|
||||||
|
|
||||||
|
@ -1165,7 +1205,7 @@ static void Direct3D1Test(void)
|
||||||
};
|
};
|
||||||
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
ok(cmp[i].x == out[i].x && cmp[i].y == out[i].y &&
|
||||||
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
cmp[i].z == out[i].z && cmp[i].rhw == out[i].rhw,
|
||||||
"Vertex %d differs. Got %f %f %f %f, expected %f %f %f %f\n", i + 1,
|
"Vertex %d differs. Got %f %f %f %f, expexted %f %f %f %f\n", i + 1,
|
||||||
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
out[i].x, out[i].y, out[i].z, out[i].rhw,
|
||||||
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw);
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1217,7 @@ static void Direct3D1Test(void)
|
||||||
|
|
||||||
transformdata.lpIn = (void *) cliptest;
|
transformdata.lpIn = (void *) cliptest;
|
||||||
transformdata.dwInSize = sizeof(cliptest[0]);
|
transformdata.dwInSize = sizeof(cliptest[0]);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(cliptest) / sizeof(cliptest[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(cliptest) / sizeof(cliptest[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1191,16 +1231,16 @@ static void Direct3D1Test(void)
|
||||||
D3DCLIP_LEFT | D3DCLIP_BOTTOM | D3DCLIP_FRONT,
|
D3DCLIP_LEFT | D3DCLIP_BOTTOM | D3DCLIP_FRONT,
|
||||||
};
|
};
|
||||||
ok(Flags[i] == outH[i].dwFlags,
|
ok(Flags[i] == outH[i].dwFlags,
|
||||||
"Cliptest %d differs. Got %08x expected %08x\n", i + 1,
|
"Cliptest %d differs. Got %08x expexted %08x\n", i + 1,
|
||||||
outH[i].dwFlags, Flags[i]);
|
outH[i].dwFlags, Flags[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
vp_data.dwWidth = 10;
|
vp_data.dwWidth = 10;
|
||||||
vp_data.dwHeight = 1000;
|
vp_data.dwHeight = 1000;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
i = 10;
|
i = 10;
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(cliptest) / sizeof(cliptest[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(cliptest) / sizeof(cliptest[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1214,16 +1254,16 @@ static void Direct3D1Test(void)
|
||||||
D3DCLIP_LEFT | D3DCLIP_FRONT,
|
D3DCLIP_LEFT | D3DCLIP_FRONT,
|
||||||
};
|
};
|
||||||
ok(Flags[i] == outH[i].dwFlags,
|
ok(Flags[i] == outH[i].dwFlags,
|
||||||
"Cliptest %d differs. Got %08x expected %08x\n", i + 1,
|
"Cliptest %d differs. Got %08x expexted %08x\n", i + 1,
|
||||||
outH[i].dwFlags, Flags[i]);
|
outH[i].dwFlags, Flags[i]);
|
||||||
}
|
}
|
||||||
vp_data.dwWidth = 256;
|
vp_data.dwWidth = 256;
|
||||||
vp_data.dwHeight = 256;
|
vp_data.dwHeight = 256;
|
||||||
vp_data.dvScaleX = 1;
|
vp_data.dvScaleX = 1;
|
||||||
vp_data.dvScaleY = 1;
|
vp_data.dvScaleY = 1;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(cliptest) / sizeof(cliptest[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(cliptest) / sizeof(cliptest[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1237,7 +1277,7 @@ static void Direct3D1Test(void)
|
||||||
D3DCLIP_FRONT,
|
D3DCLIP_FRONT,
|
||||||
};
|
};
|
||||||
ok(Flags[i] == outH[i].dwFlags,
|
ok(Flags[i] == outH[i].dwFlags,
|
||||||
"Cliptest %d differs. Got %08x expected %08x\n", i + 1,
|
"Cliptest %d differs. Got %08x expexted %08x\n", i + 1,
|
||||||
outH[i].dwFlags, Flags[i]);
|
outH[i].dwFlags, Flags[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1250,26 +1290,26 @@ static void Direct3D1Test(void)
|
||||||
vp_data.dwHeight = 5;
|
vp_data.dwHeight = 5;
|
||||||
vp_data.dvScaleX = 10000;
|
vp_data.dvScaleX = 10000;
|
||||||
vp_data.dvScaleY = 10000;
|
vp_data.dvScaleY = 10000;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_SetViewport returned %08x\n", hr);
|
||||||
transformdata.lpIn = cliptest;
|
transformdata.lpIn = cliptest;
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, 1,
|
hr = IDirect3DViewport_TransformVertices(Viewport, 1,
|
||||||
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
&transformdata, D3DTRANSFORM_UNCLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == 0, "Offscreen is %d\n", i);
|
ok(i == 0, "Offscreen is %d\n", i);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, 1,
|
hr = IDirect3DViewport_TransformVertices(Viewport, 1,
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == (D3DCLIP_RIGHT | D3DCLIP_TOP), "Offscreen is %d\n", i);
|
ok(i == (D3DCLIP_RIGHT | D3DCLIP_TOP), "Offscreen is %d\n", i);
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, 2,
|
hr = IDirect3DViewport_TransformVertices(Viewport, 2,
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == 0, "Offscreen is %d\n", i);
|
ok(i == 0, "Offscreen is %d\n", i);
|
||||||
transformdata.lpIn = cliptest + 1;
|
transformdata.lpIn = cliptest + 1;
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, 1,
|
hr = IDirect3DViewport_TransformVertices(Viewport, 1,
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
@ -1281,38 +1321,30 @@ static void Direct3D1Test(void)
|
||||||
vp_data.dwHeight = 257;
|
vp_data.dwHeight = 257;
|
||||||
vp_data.dvScaleX = 1;
|
vp_data.dvScaleX = 1;
|
||||||
vp_data.dvScaleY = 1;
|
vp_data.dvScaleY = 1;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
i = 12345;
|
i = 12345;
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(offscreentest) / sizeof(offscreentest[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(offscreentest) / sizeof(offscreentest[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == 0, "Offscreen is %d\n", i);
|
ok(i == 0, "Offscreen is %d\n", i);
|
||||||
vp_data.dwWidth = 256;
|
vp_data.dwWidth = 256;
|
||||||
vp_data.dwHeight = 256;
|
vp_data.dwHeight = 256;
|
||||||
hr = IDirect3DViewport_SetViewport(vp, &vp_data);
|
hr = IDirect3DViewport_SetViewport(Viewport, &vp_data);
|
||||||
i = 12345;
|
i = 12345;
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(offscreentest) / sizeof(offscreentest[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(offscreentest) / sizeof(offscreentest[0]),
|
||||||
&transformdata, D3DTRANSFORM_CLIPPED,
|
&transformdata, D3DTRANSFORM_CLIPPED,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
ok(i == D3DCLIP_RIGHT, "Offscreen is %d\n", i);
|
ok(i == D3DCLIP_RIGHT, "Offscreen is %d\n", i);
|
||||||
|
|
||||||
hr = IDirect3DViewport_TransformVertices(vp, sizeof(testverts) / sizeof(testverts[0]),
|
hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]),
|
||||||
&transformdata, 0,
|
&transformdata, 0,
|
||||||
&i);
|
&i);
|
||||||
ok(hr == DDERR_INVALIDPARAMS, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
ok(hr == DDERR_INVALIDPARAMS, "IDirect3DViewport_TransformVertices returned %08x\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DDevice_DeleteViewport(dev1, vp);
|
hr = IDirect3DDevice_DeleteViewport(Direct3DDevice1, Viewport);
|
||||||
ok(hr == D3D_OK, "IDirect3DDevice_DeleteViewport returned %08x\n", hr);
|
ok(hr == D3D_OK, "IDirect3DDevice_DeleteViewport returned %08x\n", hr);
|
||||||
|
|
||||||
IDirect3DViewport_Release(vp);
|
|
||||||
IDirect3DExecuteBuffer_Release(exebuf);
|
|
||||||
IDirect3DDevice_Release(dev1);
|
|
||||||
IDirectDrawSurface_Release(dds);
|
|
||||||
IDirect3D_Release(d3d);
|
|
||||||
IDirectDraw_Release(dd);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(d3d)
|
START_TEST(d3d)
|
||||||
|
@ -1324,9 +1356,8 @@ START_TEST(d3d)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!CreateDirect3D()) {
|
if(!CreateDirect3D()) {
|
||||||
trace("Skipping tests\n");
|
skip("Skipping d3d7 tests\n");
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
LightTest();
|
LightTest();
|
||||||
ProcessVerticesTest();
|
ProcessVerticesTest();
|
||||||
StateTest();
|
StateTest();
|
||||||
|
@ -1335,5 +1366,12 @@ START_TEST(d3d)
|
||||||
D3D7EnumTest();
|
D3D7EnumTest();
|
||||||
CapsTest();
|
CapsTest();
|
||||||
ReleaseDirect3D();
|
ReleaseDirect3D();
|
||||||
Direct3D1Test();
|
}
|
||||||
|
|
||||||
|
if (!D3D1_createObjects()) {
|
||||||
|
skip("Skipping d3d1 tests\n");
|
||||||
|
} else {
|
||||||
|
Direct3D1Test();
|
||||||
|
D3D1_releaseObjects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue