-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
Am 2014-10-04 00:24, schrieb Joachim Priesner:
- static const D3DMATRIX proj_mat_rh =
- {{{
0.828732f, 0.0f, 0.0f, 0.0f,
0.0f, 1.104976f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0001f, -1.0f,
0.0f, 0.0f, -0.010001f, 0.0f
- }}};
...
- static const D3DMATRIX view_mat_rh =
- {{{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, -0.1f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
- }}};
I'm sorry that this reply is a bit late, but I've been wondering if you need the complicated projection matrix to show the abs() in the vertex pipeline. If I understand it correctly, a view and projection matrix like this should do the job as well with the same input coordinates:
static const D3DMATRIX proj_mat = {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }}}; static const D3DMATRIX view_mat = {{{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }}};
The test results with these matrices are identical, and the test correctly detects the defect in Wine. The test is much easier to follow. Am I missing something?
As an added bonus you could replace the 10.0f in the input vertices with 1.0 and the -0.1f in the view matrix with -1.0f.
Some other suggestions:
+/* Some color constants to make tests easier to read. */ +#define COLOR_FOG 0xff00ff00 +#define COLOR_FOGGED 0x0000ff00 +#define COLOR_UNFOGGED 0x00ff0000 +#define COLOR_CLEAR 0xffff00ff
IMHO it would be nicer to either use an enum in the scope of fog_righthanded_test (preferred) or #undef them after the function.
- static struct
- {
struct vec3 position;
DWORD diffuse;
- }
- quad[] =
- {
{{-1.0f, -1.0f, 10.0f}, COLOR_UNFOGGED},
{{-1.0f, 1.0f, 10.0f}, COLOR_UNFOGGED},
{{ 1.0f, -1.0f, 10.0f}, COLOR_UNFOGGED},
{{ 1.0f, 1.0f, 10.0f}, COLOR_UNFOGGED},
- };
Always drawing a gradient would be better. That avoids other fog setup problems that lead to either always fogged or never fogged quads.
Also, this can be static const in d3d8 and d3d9.
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, COLOR_CLEAR, 1.0f, 0);
ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear failed (%08x)\n", hr);
Do you need the Z buffer? Just disable the depth test, no need to clear it.
- /* Basic vertex shader with fog computation ("foggy").
- Using the vertex' x coordinate as fog coordinate so that all test cases that use vertex fog
- will have a gradient from fully fogged (green, left) to unfogged (red, right). */
- static const DWORD vertex_shader_code2[] =
- {
0xfffe0100, /* vs_1_0 */
...
0x0000ffff, /* END */
};
- /* Basic pixel shader */
Two indentation issues here. The comment needs one extra space, the closing bracket has one too many. I suspect your editor screwed this up when you copied the code from d3d9 to d3d8.
if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0))
{
hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]);
ok(SUCCEEDED(hr), "CreateVertexShader failed (%08x)\n", hr);
hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]);
ok(SUCCEEDED(hr), "CreatePixelShader failed (%08x)\n", hr);
} else {
skip("No shader model 2 support, skipping some fog tests.\n");
}
Curly bracket placement. This applies to a few other places.