d3d9/tests: Cleanup maxmip_test() a bit.
Having the failure message match the actual draw call in particular makes debugging failures a lot nicer.
This commit is contained in:
parent
09be7dd83d
commit
d911622722
|
@ -2983,31 +2983,43 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
IDirect3DSurface9 *surface = NULL;
|
||||
HRESULT hr;
|
||||
DWORD color;
|
||||
const float quads[] = {
|
||||
-1.0, -1.0, 0.0, 0.0, 0.0,
|
||||
-1.0, 0.0, 0.0, 0.0, 1.0,
|
||||
0.0, -1.0, 0.0, 1.0, 0.0,
|
||||
0.0, 0.0, 0.0, 1.0, 1.0,
|
||||
|
||||
0.0, -1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 1.0,
|
||||
1.0, -1.0, 0.0, 1.0, 0.0,
|
||||
1.0, 0.0, 0.0, 1.0, 1.0,
|
||||
|
||||
0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0, 1.0,
|
||||
1.0, 0.0, 0.0, 1.0, 0.0,
|
||||
1.0, 1.0, 0.0, 1.0, 1.0,
|
||||
|
||||
-1.0, 0.0, 0.0, 0.0, 0.0,
|
||||
-1.0, 1.0, 0.0, 0.0, 1.0,
|
||||
0.0, 0.0, 0.0, 1.0, 0.0,
|
||||
0.0, 1.0, 0.0, 1.0, 1.0,
|
||||
static const struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
float x, y, z;
|
||||
float s, t;
|
||||
}
|
||||
v[4];
|
||||
}
|
||||
quads[] =
|
||||
{
|
||||
{{
|
||||
{-1.0, -1.0, 0.0, 0.0, 0.0},
|
||||
{-1.0, 0.0, 0.0, 0.0, 1.0},
|
||||
{ 0.0, -1.0, 0.0, 1.0, 0.0},
|
||||
{ 0.0, 0.0, 0.0, 1.0, 1.0},
|
||||
}},
|
||||
{{
|
||||
{ 0.0, -1.0, 0.0, 0.0, 0.0},
|
||||
{ 0.0, 0.0, 0.0, 0.0, 1.0},
|
||||
{ 1.0, -1.0, 0.0, 1.0, 0.0},
|
||||
{ 1.0, 0.0, 0.0, 1.0, 1.0},
|
||||
}},
|
||||
{{
|
||||
{ 0.0, 0.0, 0.0, 0.0, 0.0},
|
||||
{ 0.0, 1.0, 0.0, 0.0, 1.0},
|
||||
{ 1.0, 0.0, 0.0, 1.0, 0.0},
|
||||
{ 1.0, 1.0, 0.0, 1.0, 1.0},
|
||||
}},
|
||||
{{
|
||||
{-1.0, 0.0, 0.0, 0.0, 0.0},
|
||||
{-1.0, 1.0, 0.0, 0.0, 1.0},
|
||||
{ 0.0, 0.0, 0.0, 1.0, 0.0},
|
||||
{ 0.0, 1.0, 0.0, 1.0, 1.0},
|
||||
}},
|
||||
};
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 0.0, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 3, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
|
||||
&texture, NULL);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %08x\n", hr);
|
||||
|
@ -3038,27 +3050,30 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 0.0, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[ 0], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 1);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[20], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[1], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 2);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[40], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[2], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 3);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[60], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[3], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "EndScene failed (%08x)\n", hr);
|
||||
|
@ -3066,62 +3081,65 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
|
||||
/* With mipmapping disabled, the max mip level is ignored, only level 0 is used */
|
||||
color = getPixelColor(device, 160, 360);
|
||||
ok(color == 0x00FF0000, "MapMip 0, no mipfilter has color %08x\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x00FF0000, "MapMip 3, no mipfilter has color %08x\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x00FF0000, "MapMip 2, no mipfilter has color %08x\n", color);
|
||||
ok(color == 0x00ff0000, "MaxMip 0, no mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 360);
|
||||
ok(color == 0x00FF0000, "MapMip 1, no mipfilter has color %08x\n", color);
|
||||
ok(color == 0x00ff0000, "MaxMip 1, no mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x00ff0000, "MaxMip 2, no mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x00ff0000, "MaxMip 3, no mipfilter has color 0x%08x.\n", color);
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 0.0, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 0.0, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[ 0], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 1);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[20], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[1], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 2);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[40], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[2], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, 3);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[60], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[3], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "IDirect3DDevice9_EndScene returned %#x.\n", hr);
|
||||
}
|
||||
|
||||
/* Max Mip level 0-2 sample from the specified texture level, Max Mip level 3(> levels in texture)
|
||||
* samples from the highest level in the texture(level 2)
|
||||
*/
|
||||
/* Max Mip level 0-2 sample from the specified texture level, Max Mip
|
||||
* level 3 (> levels in texture) samples from the highest level in the
|
||||
* texture (level 2). */
|
||||
color = getPixelColor(device, 160, 360);
|
||||
ok(color == 0x00FF0000, "MapMip 0, point mipfilter has color %08x\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x000000FF, "MapMip 3, point mipfilter has color %08x\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x000000FF, "MapMip 2, point mipfilter has color %08x\n", color);
|
||||
ok(color == 0x00ff0000, "MaxMip 0, point mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 360);
|
||||
ok(color == 0x0000FF00, "MapMip 1, point mipfilter has color %08x\n", color);
|
||||
ok(color == 0x0000ff00, "MaxMip 1, point mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x000000ff, "MaxMip 2, point mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x000000ff, "MaxMip 3, point mipfilter has color 0x%08x.\n", color);
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 0.0, 0);
|
||||
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginScene(device);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -3134,7 +3152,7 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
ret = IDirect3DTexture9_SetLOD(texture, 1);
|
||||
ok(ret == 0, "IDirect3DTexture9_SetLOD returned %u, expected 0\n", ret);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[ 0], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
/* Mipmapping ON, LOD level smaller than max mip level. LOD level limits */
|
||||
|
@ -3144,7 +3162,7 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
ret = IDirect3DTexture9_SetLOD(texture, 2);
|
||||
ok(ret == 1, "IDirect3DTexture9_SetLOD returned %u, expected 1\n", ret);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[20], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[1], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
/* Mipmapping ON, LOD level bigger than max mip level. MAXMIPLEVEL limits */
|
||||
|
@ -3152,7 +3170,7 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
ret = IDirect3DTexture9_SetLOD(texture, 1);
|
||||
ok(ret == 2, "IDirect3DTexture9_SetLOD returned %u, expected 2\n", ret);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[40], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[2], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
|
||||
/* Mipmapping OFF, LOD level bigger than max mip level. LOD level limits */
|
||||
|
@ -3162,22 +3180,23 @@ static void maxmip_test(IDirect3DDevice9 *device)
|
|||
ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState failed with %08x\n", hr);
|
||||
ret = IDirect3DTexture9_SetLOD(texture, 1);
|
||||
ok(ret == 1, "IDirect3DTexture9_SetLOD returned %u, expected 1\n", ret);
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[60], 5 * sizeof(float));
|
||||
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[3], sizeof(*quads->v));
|
||||
ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr);
|
||||
hr = IDirect3DDevice9_EndScene(device);
|
||||
}
|
||||
|
||||
/* Max Mip level 0-2 sample from the specified texture level, Max Mip level 3(> levels in texture)
|
||||
* samples from the highest level in the texture(level 2)
|
||||
*/
|
||||
/* Max Mip level 0-2 sample from the specified texture level, Max Mip
|
||||
* level 3 (> levels in texture) samples from the highest level in the
|
||||
* texture (level 2). */
|
||||
color = getPixelColor(device, 160, 360);
|
||||
ok(color == 0x0000FF00, "MaxMip 0, LOD 1, none mipfilter has color 0x%08x\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x0000FF00, "MaxMip 1, LOD 2, point mipfilter has color 0x%08x\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x000000FF, "MapMip 2, LOD 1, point mipfilter has color 0x%08x\n", color);
|
||||
ok(color == 0x0000ff00, "MaxMip 0, LOD 1, none mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 360);
|
||||
ok(color == 0x000000FF, "MapMip 2, LOD 1, none mipfilter has color 0x%08x\n", color);
|
||||
ok(color == 0x000000ff, "MaxMip 1, LOD 2, point mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 480, 120);
|
||||
ok(color == 0x000000ff, "MaxMip 2, LOD 1, point mipfilter has color 0x%08x.\n", color);
|
||||
color = getPixelColor(device, 160, 120);
|
||||
ok(color == 0x0000ff00, "MaxMip 2, LOD 1, none mipfilter has color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
|
||||
ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue