On 29 October 2014 23:35, Joachim Priesner joachim.priesner@web.de wrote:
- /* Basic vertex shader without fog computation ("non foggy") */
- static const DWORD vertex_shader_code1[] =
- {
0xfffe0100, /* vs_1_0 */
/* output.Pos = mul(input.Pos, Projection) */
0x00000009, 0xc0010000, 0x90e40000, 0xa0e40000, /* dp4 oPos.x, v0, c0 */
0x00000009, 0xc0020000, 0x90e40000, 0xa0e40001, /* dp4 oPos.y, v0, c1 */
0x00000009, 0xc0040000, 0x90e40000, 0xa0e40002, /* dp4 oPos.z, v0, c2 */
0x00000009, 0xc0080000, 0x90e40000, 0xa0e40003, /* dp4 oPos.w, v0, c3 */
/* output.Color = input.Color */
0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */
0x0000ffff, /* END */
- };
...
- 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, 0.5f, 0.0f,
0.0f, 0.0f, 0.5f, 1.0f
- }}};
- /* Transposed version of proj_mat to pass to the vertex shaders. */
- static const D3DMATRIX proj_mat_transposed =
- {{{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.5f, 0.5f,
0.0f, 0.0f, 0.0f, 1.0f
- }}};
Instead of transposing the matrix, you can just change the multiplication in the shader. I.e., using "mul(Projection, input.Pos)" instead of "mul(input.Pos, Projection)". That would then give you a mul/mad/mad/mad sequence instead of 4 dp4's. But of course that's all just a complicated way to do "output.Pos = input.Pos * 0.5 + 0.5;".
- /* start=0.0f, end=1.0f should be the default values, set them anyway to be sure.
* These values do not affect the tests with foggy vertex shader, as the fog
* intensity is computed directly by the shader. */
- start.f = 0.0f;
- end.f = 1.0f;
- hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, start.i);
- ok(SUCCEEDED(hr), "Setting fog start failed (%#x)\n", hr);
- hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, end.i);
- ok(SUCCEEDED(hr), "Setting fog end failed (%#x)\n", hr);
You don't need this.
- static const struct test_data_t
- {
int vshader;
D3DFOGMODE vfog;
D3DFOGMODE tfog;
DWORD color_left;
DWORD color_middle_top;
DWORD color_middle_bottom;
DWORD color_right;
- }
The _t suffix is reserved by POSIX, so you shouldn't use it for your own type names. In this specific case, you don't need the structure to be named at all, and you can just use an anonymous structure instead.