[PATCH 1/5] wined3d: Vertex fog uses the absolute eye position z (v2).

Henri Verbeet hverbeet at gmail.com
Thu Nov 27 03:22:54 CST 2014


On 26 November 2014 at 19:08, Stefan Dösinger <stefan at codeweavers.com> wrote:
> +        conv.f = tests[i].start;
> +        hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, conv.d);
I don't care particularly much, but it might be nicer to just add the
union to tests[], and then just use "tests[i].start.d" here.

>  START_TEST(ddraw7)
>  {
>      HMODULE module = GetModuleHandleA("ddraw.dll");
> @@ -8089,4 +8190,5 @@ START_TEST(ddraw7)
>      test_resource_priority();
>      test_surface_desc_lock();
>      fog_interpolation_test();
> +    test_negative_fixedfunction_fog();
I prefer this name, but I think it's more important that equivalent
tests have the same name between D3D versions. I'd probably just
rename the d3d8 and d3d9 versions instead. For what it's worth, I
still plan to merge device.c and visual.c at some point in the future,
and I'll probably fixup the naming of the existing tests in visual.c
around that time as well.


>              if (settings->ortho_fog)
> +            {
>                  /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */
>                  shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n");
> +            }
>              else
> +            {
>                  shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n");
> +                if (!settings->transformed)
> +                    shader_addline(buffer, "gl_FogFragCoord = abs(gl_FogFragCoord);\n");
> +            }
I think this looks pretty messy. I'd suggest

    if (settings->ortho_fog)
       shader_addline(...);
    else if (!settings->transformed)
       shader_addline(...);
    else
       shader_addline(...);



More information about the wine-devel mailing list