Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
e030ed3c
Commit
e030ed3c
authored
11 years ago
by
Stefan Dösinger
Committed by
Alexandre Julliard
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
d3d9/tests: Add a test for fog_start == fog_end.
parent
22319c7f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/d3d9/tests/visual.c
+166
-0
166 additions, 0 deletions
dlls/d3d9/tests/visual.c
with
166 additions
and
0 deletions
dlls/d3d9/tests/visual.c
+
166
−
0
View file @
e030ed3c
...
...
@@ -14038,6 +14038,171 @@ static void zenable_test(IDirect3DDevice9 *device)
}
}
static void fog_special_test(IDirect3DDevice9 *device)
{
static const struct
{
struct vec3 position;
D3DCOLOR diffuse;
}
quad[] =
{
{{ -1.0f, -1.0f, 0.0f}, 0xff00ff00},
{{ 1.0f, -1.0f, 1.0f}, 0xff00ff00},
{{ -1.0f, 1.0f, 0.0f}, 0xff00ff00},
{{ 1.0f, 1.0f, 1.0f}, 0xff00ff00}
};
static const struct
{
DWORD vertexmode, tablemode;
BOOL vs, ps;
D3DCOLOR color_left, color_right;
}
tests[] =
{
{D3DFOG_LINEAR, D3DFOG_NONE, FALSE, FALSE, 0x00ff0000, 0x00ff0000},
{D3DFOG_LINEAR, D3DFOG_NONE, FALSE, TRUE, 0x00ff0000, 0x00ff0000},
{D3DFOG_LINEAR, D3DFOG_NONE, TRUE, FALSE, 0x00ff0000, 0x00ff0000},
{D3DFOG_LINEAR, D3DFOG_NONE, TRUE, TRUE, 0x00ff0000, 0x00ff0000},
{D3DFOG_NONE, D3DFOG_LINEAR, FALSE, FALSE, 0x0000ff00, 0x00ff0000},
{D3DFOG_NONE, D3DFOG_LINEAR, FALSE, TRUE, 0x0000ff00, 0x00ff0000},
{D3DFOG_NONE, D3DFOG_LINEAR, TRUE, FALSE, 0x0000ff00, 0x00ff0000},
{D3DFOG_NONE, D3DFOG_LINEAR, TRUE, TRUE, 0x0000ff00, 0x00ff0000},
};
static const DWORD pixel_shader_code[] =
{
0xffff0101, /* ps_1_1 */
0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */
0x0000ffff
};
static const DWORD vertex_shader_code[] =
{
0xfffe0101, /* vs_1_1 */
0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */
0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */
0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */
0x0000ffff
};
union
{
float f;
DWORD d;
} conv;
DWORD color;
HRESULT hr;
unsigned int i;
IDirect3DPixelShader9 *ps;
IDirect3DVertexShader9 *vs;
D3DCAPS9 caps;
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
if (caps.VertexShaderVersion >= D3DVS_VERSION(1, 1))
{
hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code, &vs);
ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr);
}
else
{
skip("Vertex Shaders not supported, skipping some fog tests.\n");
vs = NULL;
}
if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 1))
{
hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &ps);
ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
}
else
{
skip("Pixel Shaders not supported, skipping some fog tests.\n");
ps = NULL;
}
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE);
ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE);
ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xffff0000);
ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr);
conv.f = 0.5f;
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, conv.d);
ok(SUCCEEDED(hr), "Failed to set fog start, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, conv.d);
ok(SUCCEEDED(hr), "Failed to set fog end, hr %#x.\n", hr);
for (i = 0; i < sizeof(tests) / sizeof(*tests); i++)
{
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
if (!tests[i].vs)
{
hr = IDirect3DDevice9_SetVertexShader(device, NULL);
ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);
}
else if (vs)
{
hr = IDirect3DDevice9_SetVertexShader(device, vs);
ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);
}
else
{
continue;
}
if (!tests[i].ps)
{
hr = IDirect3DDevice9_SetPixelShader(device, NULL);
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
}
else if (ps)
{
hr = IDirect3DDevice9_SetPixelShader(device, ps);
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
}
else
{
continue;
}
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vertexmode);
ok(SUCCEEDED(hr), "Failed to set fogvertexmode, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tablemode);
ok(SUCCEEDED(hr), "Failed to set fogtablemode, hr %#x.\n", hr);
hr = IDirect3DDevice9_BeginScene(device);
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad));
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
hr = IDirect3DDevice9_EndScene(device);
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
color = getPixelColor(device, 310, 240);
ok(color_match(color, tests[i].color_left, 1),
"Expected left color 0x%08x, got 0x%08x, case %u.\n", tests[i].color_left, color, i);
color = getPixelColor(device, 330, 240);
ok(color_match(color, tests[i].color_right, 1),
"Expected right color 0x%08x, got 0x%08x, case %u.\n", tests[i].color_right, color, i);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(SUCCEEDED(hr), "Failed to present backbuffer, hr %#x.\n", hr);
}
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, FALSE);
ok(SUCCEEDED(hr), "Failed to disable fog, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetPixelShader(device, NULL);
ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr);
hr = IDirect3DDevice9_SetVertexShader(device, NULL);
ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr);
if (vs)
IDirect3DVertexShader9_Release(vs);
if (ps)
IDirect3DPixelShader9_Release(ps);
}
START_TEST(visual)
{
IDirect3D9 *d3d9;
...
...
@@ -14215,6 +14380,7 @@ START_TEST(visual)
update_surface_test(device_ptr);
multisample_get_rtdata_test(device_ptr);
zenable_test(device_ptr);
fog_special_test(device_ptr);
hr = IDirect3DDevice9_GetDirect3D(device_ptr, &d3d9);
ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment