d3d9: Remove the fog vs sRGB test.

This commit is contained in:
Stefan Dösinger 2010-07-20 12:47:28 +02:00 committed by Alexandre Julliard
parent c63c568731
commit 24adf40ee1
1 changed files with 0 additions and 109 deletions

View File

@ -7032,114 +7032,6 @@ bail:
IDirect3DVertexBuffer9_Release(vb_list);
}
static void fog_srgbwrite_test(IDirect3DDevice9 *device)
{
/* Draw a black quad, half fogged with white fog -> grey color. Enable sRGB writing.
* if sRGB writing is applied before fogging, the 0.0 will be multiplied with ~ 12.92, so still
* stay 0.0. After that the fog gives 0.5. If sRGB writing is applied after fogging, the
* 0.5 will run through the alternative path(0^5 ^ 0.41666 * 1.055 - 0.055), resulting in approx.
* 0.73
*
* At the time of this writing, wined3d could not apply sRGB correction to fixed function rendering,
* so use shaders for this task
*/
IDirect3DPixelShader9 *pshader;
IDirect3DVertexShader9 *vshader;
IDirect3D9 *d3d;
DWORD vshader_code[] = {
0xfffe0101, /* vs_1_1 */
0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */
0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0.0, 0.0, 0.0 */
0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */
0x00000001, 0xc00f0001, 0xa0000000, /* mov oFog, c0.x */
0x0000ffff /* end */
};
DWORD pshader_code[] = {
0xffff0101, /* ps_1_1 */
0x00000051, 0xa00f0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.0, 0.0, 0.0, 0.0 */
0x00000001, 0x800f0000, 0xa0e40000, /* mov r0, c0 */
0x0000ffff /* end */
};
const float quad[] = {
-1.0, -1.0, 0.1,
1.0, -1.0, 0.1,
-1.0, 1.0, 0.1,
1.0, 1.0, 0.1
};
HRESULT hr;
D3DCOLOR color;
IDirect3DDevice9_GetDirect3D(device, &d3d);
/* Ask for srgb writing on D3DRTYPE_TEXTURE. Some Windows drivers do not report it on surfaces.
* For some not entirely understood reasons D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_SRGBWRITE
* passes on surfaces, while asking for SRGBWRITE alone fails. Textures advertize srgb writing
* alone as well, so use that since it is not the point of this test to show how CheckDeviceFormat
* works
*/
if(IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8,
D3DUSAGE_RENDERTARGET | D3DUSAGE_QUERY_SRGBWRITE,
D3DRTYPE_TEXTURE, D3DFMT_A8R8G8B8) != D3D_OK) {
skip("No SRGBWRITEENABLE support on D3DFMT_X8R8G8B8\n");
IDirect3D9_Release(d3d);
return;
}
IDirect3D9_Release(d3d);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffff00, 0.0, 0);
ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, D3DFOG_NONE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xffffffff);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_SRGBWRITEENABLE, TRUE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_CreateVertexShader(device, vshader_code, &vshader);
ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader returned %08x\n", hr);
hr = IDirect3DDevice9_CreatePixelShader(device, pshader_code, &pshader);
ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr);
hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ);
ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF returned %08x\n", hr);
hr = IDirect3DDevice9_SetVertexShader(device, vshader);
ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr);
hr = IDirect3DDevice9_SetPixelShader(device, pshader);
ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned %08x\n", hr);
hr = IDirect3DDevice9_BeginScene(device);
ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %08x\n", hr);
if(SUCCEEDED(hr)) {
hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float) * 3);
ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr);
hr = IDirect3DDevice9_EndScene(device);
ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr);
}
hr = IDirect3DDevice9_SetVertexShader(device, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr);
hr = IDirect3DDevice9_SetPixelShader(device, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned %08x\n", hr);
IDirect3DPixelShader9_Release(pshader);
IDirect3DVertexShader9_Release(vshader);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, FALSE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_SRGBWRITEENABLE, FALSE);
ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr);
color = getPixelColor(device, 160, 360);
ok(color_match(color, 0x00808080, 1),
"Fog with D3DRS_SRGBWRITEENABLE returned color 0x%08x, expected 0x00808080\n", color);
hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr);
}
static void alpha_test(IDirect3DDevice9 *device)
{
HRESULT hr;
@ -11408,7 +11300,6 @@ START_TEST(visual)
if (caps.VertexShaderVersion >= D3DVS_VERSION(1, 1) && caps.PixelShaderVersion >= D3DPS_VERSION(1, 1))
{
fog_with_shader_test(device_ptr);
fog_srgbwrite_test(device_ptr);
}
else skip("No vs_1_1 and ps_1_1 support\n");