-- v3: wined3d: Always divide 1.x projected textures by W in the FFP. wined3d: Always divide 1.x projected textures by W for shaders. wined3d: Initialize all remaining FFP texture coordinates to zero. wined3d: Copy the projective divisor in the FFP vertex pipeline. wined3d: Alter the texture matrix even for non-projected textures. wined3d: Pass 3 as the attribute count for generated texcoords. wined3d: Pass the attribute coordinate count to get_texture_matrix(). wined3d: Handle all invalid values in compute_texture_matrix(). d3d9/tests: Add comprehensive D3DTSS_TEXTURETRANSFORMFLAGS tests.
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/d3d9/tests/visual.c | 1243 ++++++++++++-------------------------- 1 file changed, 396 insertions(+), 847 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 7206e0247f7..7ea2d0e0d59 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -5241,852 +5241,6 @@ static void check_rect_(unsigned int line, struct surface_readback *rb, RECT r, } }
-struct projected_textures_test_run -{ - const char *message; - DWORD flags; - IDirect3DVertexDeclaration9 *decl; - BOOL vs, ps; - RECT rect; -}; - -static void projected_textures_test(IDirect3DDevice9 *device, - struct projected_textures_test_run tests[4]) -{ - unsigned int i; - - static const DWORD vertex_shader[] = - { - 0xfffe0101, /* vs_1_1 */ - 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ - 0x0000001f, 0x80000005, 0x900f0001, /* dcl_texcoord0 v1 */ - 0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ - 0x00000001, 0xe00f0000, 0x90e40001, /* mov oT0, v1 */ - 0x0000ffff /* end */ - }; - static const DWORD pixel_shader[] = - { - 0xffff0103, /* ps_1_3 */ - 0x00000042, 0xb00f0000, /* tex t0 */ - 0x00000001, 0x800f0000, 0xb0e40000, /* mov r0, t0 */ - 0x0000ffff /* end */ - }; - IDirect3DVertexShader9 *vs = NULL; - IDirect3DPixelShader9 *ps = NULL; - IDirect3D9 *d3d; - D3DCAPS9 caps; - HRESULT hr; - IDirect3DSurface9 *backbuffer; - struct surface_readback rb; - - IDirect3DDevice9_GetDirect3D(device, &d3d); - hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - IDirect3D9_Release(d3d); - - if (caps.VertexShaderVersion >= D3DVS_VERSION(1, 1)) - { - hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader, &vs); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 3)) - { - hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader, &ps); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - - hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); - ok(SUCCEEDED(hr), "Failed to get back buffer, hr %#lx.\n", hr); - - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff203040, 0.0f, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "Failed to begin scene, hr %#lx.\n", hr); - - for (i = 0; i < 4; ++i) - { - DWORD value = 0xdeadbeef; - static const float proj_quads[] = - { - -1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 4.0f, 6.0f, - -1.0f, 0.0f, 0.1f, 0.0f, 4.0f, 4.0f, 6.0f, - 0.0f, -1.0f, 0.1f, 4.0f, 0.0f, 4.0f, 6.0f, - 0.0f, 0.0f, 0.1f, 4.0f, 4.0f, 4.0f, 6.0f, - - 0.0f, -1.0f, 0.1f, 0.0f, 0.0f, 4.0f, 6.0f, - 0.0f, 0.0f, 0.1f, 0.0f, 4.0f, 4.0f, 6.0f, - 1.0f, -1.0f, 0.1f, 4.0f, 0.0f, 4.0f, 6.0f, - 1.0f, 0.0f, 0.1f, 4.0f, 4.0f, 4.0f, 6.0f, - - -1.0f, 0.0f, 0.1f, 0.0f, 0.0f, 4.0f, 6.0f, - -1.0f, 1.0f, 0.1f, 0.0f, 4.0f, 4.0f, 6.0f, - 0.0f, 0.0f, 0.1f, 4.0f, 0.0f, 4.0f, 6.0f, - 0.0f, 1.0f, 0.1f, 4.0f, 4.0f, 4.0f, 6.0f, - - 0.0f, 0.0f, 0.1f, 0.0f, 0.0f, 4.0f, 6.0f, - 0.0f, 1.0f, 0.1f, 0.0f, 4.0f, 4.0f, 6.0f, - 1.0f, 0.0f, 0.1f, 4.0f, 0.0f, 4.0f, 6.0f, - 1.0f, 1.0f, 0.1f, 4.0f, 4.0f, 4.0f, 6.0f, - }; - - if (tests[i].vs) - { - if (!vs) - { - skip("Vertex shaders not supported, skipping\n"); - continue; - } - hr = IDirect3DDevice9_SetVertexShader(device, vs); - } - else - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (tests[i].ps) - { - if (!ps) - { - skip("Pixel shaders not supported, skipping\n"); - continue; - } - hr = IDirect3DDevice9_SetPixelShader(device, ps); - } - else - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, tests[i].decl); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, tests[i].flags); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_GetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, &value); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - ok(value == tests[i].flags, "Got value %#lx.\n", value); - - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, - &proj_quads[i * 4 * 7], 7 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - if (vs) IDirect3DVertexShader9_Release(vs); - if (ps) IDirect3DPixelShader9_Release(ps); - - get_rt_readback(backbuffer, &rb); - for (i = 0; i < 4; ++i) - { - if ((!tests[i].vs || vs) && (!tests[i].ps || ps)) - check_rect(&rb, tests[i].rect, tests[i].message); - } - release_surface_readback(&rb); - IDirect3DSurface9_Release(backbuffer); -} - -static void texture_transform_flags_test(void) -{ - HRESULT hr; - IDirect3D9 *d3d; - D3DFORMAT fmt = D3DFMT_X8R8G8B8; - D3DCAPS9 caps; - IDirect3DTexture9 *texture = NULL; - IDirect3DVolumeTexture9 *volume = NULL; - unsigned int color, x, y, z, w, h; - IDirect3DDevice9 *device; - D3DLOCKED_RECT lr; - D3DLOCKED_BOX lb; - ULONG refcount; - HWND window; - IDirect3DVertexDeclaration9 *decl, *decl2, *decl3, *decl4; - - static const D3DVERTEXELEMENT9 decl_elements[] = { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - D3DDECL_END() - }; - static const D3DVERTEXELEMENT9 decl_elements2[] = { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - D3DDECL_END() - }; - static const D3DVERTEXELEMENT9 decl_elements3[] = { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - D3DDECL_END() - }; - static const D3DVERTEXELEMENT9 decl_elements4[] = { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - D3DDECL_END() - }; - static const unsigned char proj_texdata[] = {0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; - static const D3DMATRIX identity = - {{{ - 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, - }}}; - - window = create_window(); - d3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(!!d3d, "Failed to create a D3D object.\n"); - if (!(device = create_device(d3d, window, window, TRUE))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } - - memset(&lr, 0, sizeof(lr)); - memset(&lb, 0, sizeof(lb)); - if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, - D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_A16B16G16R16) == D3D_OK) - fmt = D3DFMT_A16B16G16R16; - - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &decl); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements2, &decl2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements3, &decl3); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements4, &decl4); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_SRGBTEXTURE, FALSE); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - w = min(1024, caps.MaxTextureWidth); - h = min(1024, caps.MaxTextureHeight); - hr = IDirect3DDevice9_CreateTexture(device, w, h, 1, - 0, fmt, D3DPOOL_MANAGED, &texture, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (!texture) - { - skip("Failed to create the test texture.\n"); - IDirect3DDevice9_Release(device); - goto done; - } - - /* Unfortunately there is no easy way to set up a texture coordinate passthrough - * in d3d fixed function pipeline, so create a texture that has a gradient from 0.0 to - * 1.0 in red and green for the x and y coords - */ - hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - double r_f = (double) y / (double) h; - double g_f = (double) x / (double) w; - if(fmt == D3DFMT_A16B16G16R16) { - unsigned short r, g; - unsigned short *dst = (unsigned short *) (((char *) lr.pBits) + y * lr.Pitch + x * 8); - r = (unsigned short) (r_f * 65536.0); - g = (unsigned short) (g_f * 65536.0); - dst[0] = r; - dst[1] = g; - dst[2] = 0; - dst[3] = 65535; - } else { - unsigned char *dst = ((unsigned char *) lr.pBits) + y * lr.Pitch + x * 4; - unsigned char r = (unsigned char) (r_f * 255.0); - unsigned char g = (unsigned char) (g_f * 255.0); - dst[0] = 0; - dst[1] = g; - dst[2] = r; - dst[3] = 255; - } - } - } - hr = IDirect3DTexture9_UnlockRect(texture, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *) texture); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if(SUCCEEDED(hr)) - { - static const float quad1[] = - { - -1.0f, -1.0f, 0.1f, 1.0f, 1.0f, - -1.0f, 0.0f, 0.1f, 1.0f, 1.0f, - 0.0f, -1.0f, 0.1f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, - }; - static const float quad2[] = - { - -1.0f, 0.0f, 0.1f, 1.0f, 1.0f, - -1.0f, 1.0f, 0.1f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, - 0.0f, 1.0f, 0.1f, 1.0f, 1.0f, - }; - static const float quad3[] = - { - 0.0f, 0.0f, 0.1f, 0.5f, 0.5f, - 0.0f, 1.0f, 0.1f, 0.5f, 0.5f, - 1.0f, 0.0f, 0.1f, 0.5f, 0.5f, - 1.0f, 1.0f, 0.1f, 0.5f, 0.5f, - }; - static const float quad4[] = - { - 320.0f, 480.0f, 0.1f, 1.0f, 0.0f, 1.0f, - 320.0f, 240.0f, 0.1f, 1.0f, 0.0f, 1.0f, - 640.0f, 480.0f, 0.1f, 1.0f, 0.0f, 1.0f, - 640.0f, 240.0f, 0.1f, 1.0f, 0.0f, 1.0f, - }; - D3DMATRIX mat = - {{{ - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - }}}; - - /* What happens with the texture matrix if D3DTSS_TEXTURETRANSFORMFLAGS is disabled? */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad1, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* What happens with transforms enabled? */ - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad2, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* What happens if 4 coords are used, but only 2 given ?*/ - mat.m[2][0] = 1.0f; - mat.m[3][1] = 1.0f; - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT4); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad3, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* What happens with transformed geometry? This setup lead to 0/0 coords with untransformed - * geometry. If the same applies to transformed vertices, the quad will be black, otherwise red, - * due to the coords in the vertices. (turns out red, indeed) - */ - memset(&mat, 0, sizeof(mat)); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZRHW | D3DFVF_TEX1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad4, 6 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - color = getPixelColor(device, 160, 360); - ok(color_match(color, 0x00ffff00, 1), "quad 1 has color %08x, expected 0x00ffff00\n", color); - color = getPixelColor(device, 160, 120); - ok(color == 0x00000000, "quad 2 has color %08x, expected 0x0000000\n", color); - color = getPixelColor(device, 480, 120); - ok(color_match(color, 0x0000ff00, 1), "quad 3 has color %08x, expected 0x0000ff00\n", color); - color = getPixelColor(device, 480, 360); - ok(color_match(color, 0x00ff0000, 1), "quad 4 has color %08x, expected 0x00ff0000\n", color); - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if(SUCCEEDED(hr)) - { - static const float quad1[] = - { - -1.0f, -1.0f, 0.1f, 0.8f, 0.2f, - -1.0f, 0.0f, 0.1f, 0.8f, 0.2f, - 0.0f, -1.0f, 0.1f, 0.8f, 0.2f, - 0.0f, 0.0f, 0.1f, 0.8f, 0.2f, - }; - static const float quad2[] = - { - -1.0f, 0.0f, 0.1f, 0.5f, 1.0f, - -1.0f, 1.0f, 0.1f, 0.5f, 1.0f, - 0.0f, 0.0f, 0.1f, 0.5f, 1.0f, - 0.0f, 1.0f, 0.1f, 0.5f, 1.0f, - }; - static const float quad3[] = - { - 0.0f, 0.0f, 0.1f, 0.5f, 1.0f, - 0.0f, 1.0f, 0.1f, 0.5f, 1.0f, - 1.0f, 0.0f, 0.1f, 0.5f, 1.0f, - 1.0f, 1.0f, 0.1f, 0.5f, 1.0f, - }; - static const float quad4[] = - { - 0.0f, -1.0f, 0.1f, 0.8f, 0.2f, - 0.0f, 0.0f, 0.1f, 0.8f, 0.2f, - 1.0f, -1.0f, 0.1f, 0.8f, 0.2f, - 1.0f, 0.0f, 0.1f, 0.8f, 0.2f, - }; - D3DMATRIX mat = - {{{ - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - }}}; - - /* What happens to the default 1 in the 3rd coordinate if it is disabled? */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad1, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* D3DTFF_COUNT1 does not work on Nvidia drivers. It behaves like D3DTTFF_DISABLE. On ATI drivers - * it behaves like COUNT2 because normal textures require 2 coords. */ - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad4, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* Just to be sure, the same as quad2 above */ - memset(&mat, 0, sizeof(mat)); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad2, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* Now, what happens to the 2nd coordinate(that is disabled in the matrix) if it is not - * used? And what happens to the first? */ - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad3, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - color = getPixelColor(device, 160, 360); - ok(color_match(color, 0x00ff0000, 1), "quad 1 has color %08x, expected 0x00ff0000\n", color); - color = getPixelColor(device, 160, 120); - ok(color == 0x00000000, "quad 2 has color %08x, expected 0x0000000\n", color); - color = getPixelColor(device, 480, 120); - ok(color_match(color, 0x00ff8000, 1) || color == 0x00000000, - "quad 3 has color %08x, expected 0x00ff8000\n", color); - color = getPixelColor(device, 480, 360); - ok(color_match(color, 0x0033cc00, 1) || color_match(color, 0x00ff0000, 1), - "quad 4 has color %08x, expected 0x0033cc00\n", color); - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - IDirect3DTexture9_Release(texture); - - /* Test projected textures, without any fancy matrices */ - hr = IDirect3DDevice9_CreateTexture(device, 4, 4, 1, 0, D3DFMT_L8, D3DPOOL_MANAGED, &texture, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (SUCCEEDED(hr)) - { - struct projected_textures_test_run projected_tests_1[4] = - { - { - "D3DTTFF_COUNT4 | D3DTTFF_PROJECTED - bottom left", - D3DTTFF_COUNT4 | D3DTTFF_PROJECTED, - decl3, - FALSE, TRUE, - {120, 300, 240, 390}, - }, - { - "D3DTTFF_COUNT3 | D3DTTFF_PROJECTED - bottom right", - D3DTTFF_COUNT3 | D3DTTFF_PROJECTED, - decl3, - FALSE, TRUE, - {400, 360, 480, 420}, - }, - /* Try with some invalid values */ - { - "0xffffffff (draws like COUNT4 | PROJECTED) - top left", - 0xffffffff, - decl3, - FALSE, TRUE, - {120, 60, 240, 150} - }, - { - "D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (draws non-projected) - top right", - D3DTTFF_COUNT3 | D3DTTFF_PROJECTED, - decl4, - FALSE, TRUE, - {340, 210, 360, 225}, - } - }; - struct projected_textures_test_run projected_tests_2[4] = - { - { - "D3DTTFF_PROJECTED (like COUNT4 | PROJECTED, texcoord has 4 components) - bottom left", - D3DTTFF_PROJECTED, - decl3, - FALSE, TRUE, - {120, 300, 240, 390}, - }, - { - "D3DTTFF_PROJECTED (like COUNT3 | PROJECTED, texcoord has only 3 components) - bottom right", - D3DTTFF_PROJECTED, - decl, - FALSE, TRUE, - {400, 360, 480, 420}, - }, - { - "0xffffffff (like COUNT3 | PROJECTED, texcoord has only 3 components) - top left", - 0xffffffff, - decl, - FALSE, TRUE, - {80, 120, 160, 180}, - }, - { - "D3DTTFF_COUNT1 (draws non-projected) - top right", - D3DTTFF_COUNT1, - decl4, - FALSE, TRUE, - {340, 210, 360, 225}, - } - }; - struct projected_textures_test_run projected_tests_3[4] = - { - { - "D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom left", - D3DTTFF_PROJECTED, - decl3, - TRUE, FALSE, - {120, 300, 240, 390}, - }, - { - "D3DTTFF_COUNT3 | D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - bottom right", - D3DTTFF_COUNT3 | D3DTTFF_PROJECTED, - decl3, - TRUE, TRUE, - {440, 300, 560, 390}, - }, - { - "0xffffffff (like COUNT4 | PROJECTED) - top left", - 0xffffffff, - decl3, - TRUE, TRUE, - {120, 60, 240, 150}, - }, - { - "D3DTTFF_PROJECTED (like COUNT4 | PROJECTED) - top right", - D3DTTFF_PROJECTED, - decl3, - FALSE, FALSE, - {440, 60, 560, 150}, - }, - }; - - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &identity); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - for(x = 0; x < 4; x++) { - memcpy(((BYTE *) lr.pBits) + lr.Pitch * x, proj_texdata + 4 * x, 4 * sizeof(proj_texdata[0])); - } - hr = IDirect3DTexture9_UnlockRect(texture, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *) texture); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - projected_textures_test(device, projected_tests_1); - projected_textures_test(device, projected_tests_2); - projected_textures_test(device, projected_tests_3); - - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - IDirect3DTexture9_Release(texture); - } - - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff203040, 0.0, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - /* Use a smaller volume texture than the biggest possible size for memory and performance reasons - * Thus watch out if sampling from texels between 0 and 1. - */ - hr = IDirect3DDevice9_CreateVolumeTexture(device, 32, 32, 32, 1, 0, fmt, D3DPOOL_MANAGED, &volume, 0); - ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL, "Got hr %#lx.\n", hr); - if(!volume) { - skip("Failed to create a volume texture\n"); - goto out; - } - - hr = IDirect3DVolumeTexture9_LockBox(volume, 0, &lb, NULL, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - for(z = 0; z < 32; z++) { - for(y = 0; y < 32; y++) { - for(x = 0; x < 32; x++) { - char size = (fmt == D3DFMT_A16B16G16R16 ? 8 : 4); - void *mem = ((char *) lb.pBits) + y * lb.RowPitch + z * lb.SlicePitch + x * size; - float r_f = (float) x / 31.0; - float g_f = (float) y / 31.0; - float b_f = (float) z / 31.0; - - if(fmt == D3DFMT_A16B16G16R16) { - unsigned short *mem_s = mem; - mem_s[0] = r_f * 65535.0; - mem_s[1] = g_f * 65535.0; - mem_s[2] = b_f * 65535.0; - mem_s[3] = 65535; - } else { - unsigned char *mem_c = mem; - mem_c[0] = b_f * 255.0; - mem_c[1] = g_f * 255.0; - mem_c[2] = r_f * 255.0; - mem_c[3] = 255; - } - } - } - } - hr = IDirect3DVolumeTexture9_UnlockBox(volume, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *) volume); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if(SUCCEEDED(hr)) - { - static const float quad1[] = - { - -1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - -1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - }; - static const float quad2[] = - { - -1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - -1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, 1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - }; - static const float quad3[] = - { - 0.0f, 0.0f, 0.1f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.1f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.1f, 0.0f, 0.0f, - 1.0f, 1.0f, 0.1f, 0.0f, 0.0f, - }; - static const float quad4[] = - { - 0.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - }; - D3DMATRIX mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - }}}; - hr = IDirect3DDevice9_SetVertexDeclaration(device, decl); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* Draw a quad with all 3 coords enabled. Nothing fancy. v and w are swapped, but have the same - * values - */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad1, 6 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* Now disable the w coordinate. Does that change the input, or the output. The coordinates - * are swapped by the matrix. If it changes the input, the v coord will be missing(green), - * otherwise the w will be missing(blue). - * turns out that on nvidia cards the blue color is missing, so it is an output modification. - * On ATI cards the COUNT2 is ignored, and it behaves in the same way as COUNT3. */ - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad2, 6 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* default values? Set up the identity matrix, pass in 2 vertex coords, and enable 3 */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &identity); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad3, 5 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* D3DTTFF_COUNT1. Set a NULL matrix, and count1, pass in all values as 1.0. Nvidia has count1 == - * disable. ATI extends it up to the amount of values needed for the volume texture - */ - memset(&mat, 0, sizeof(mat)); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT1); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, decl); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad4, 6 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - - color = getPixelColor(device, 160, 360); - ok(color == 0x00ffffff, "quad 1 has color %08x, expected 0x00ffffff\n", color); - color = getPixelColor(device, 160, 120); - ok(color == 0x00ffff00 /* NV*/ || color == 0x00ffffff /* ATI */, - "quad 2 has color %08x, expected 0x00ffff00\n", color); - color = getPixelColor(device, 480, 120); - ok(color == 0x000000ff, "quad 3 has color %08x, expected 0x000000ff\n", color); - color = getPixelColor(device, 480, 360); - ok(color == 0x00ffffff || color == 0x0000ff00, "quad 4 has color %08x, expected 0x00ffffff\n", color); - - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff303030, 0.0, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - if(SUCCEEDED(hr)) - { - static const float quad1[] = - { - -1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - -1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, - 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 1.0f, - }; - static const float quad2[] = - { - -1.0f, 0.0f, 0.1f, - -1.0f, 1.0f, 0.1f, - 0.0f, 0.0f, 0.1f, - 0.0f, 1.0f, 0.1f, - }; - static const float quad3[] = - { - 0.0f, 0.0f, 0.1f, 1.0f, - 0.0f, 1.0f, 0.1f, 1.0f, - 1.0f, 0.0f, 0.1f, 1.0f, - 1.0f, 1.0f, 0.1f, 1.0f, - }; - static const D3DMATRIX mat = - {{{ - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - }}}; - static const D3DMATRIX mat2 = - {{{ - 0.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - }}}; - hr = IDirect3DDevice9_SetVertexDeclaration(device, decl); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* Default values? 4 coords used, 3 passed. What happens to the 4th? - * Use COUNT3 because newer Nvidia drivers return black when there are more (output) coords - * than being used by the texture(volume tex -> 3). Again, as shown in earlier test the COUNTx - * affects the post-transformation output, so COUNT3 plus the matrix above is OK for testing the - * 4th *input* coordinate. - */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad1, 6 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* None passed */ - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &identity); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad2, 3 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - /* 4 used, 1 passed */ - hr = IDirect3DDevice9_SetVertexDeclaration(device, decl2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &mat2); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad3, 4 * sizeof(float)); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - } - color = getPixelColor(device, 160, 360); - ok(color == 0x0000ff00, "quad 1 has color %08x, expected 0x0000ff00\n", color); - color = getPixelColor(device, 160, 120); - ok(color == 0x00000000, "quad 2 has color %08x, expected 0x00000000\n", color); - color = getPixelColor(device, 480, 120); - ok(color == 0x00ff0000, "quad 3 has color %08x, expected 0x00ff0000\n", color); - /* Quad4: unused */ - - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - IDirect3DVolumeTexture9_Release(volume); - -out: - IDirect3DVertexDeclaration9_Release(decl); - IDirect3DVertexDeclaration9_Release(decl2); - IDirect3DVertexDeclaration9_Release(decl3); - IDirect3DVertexDeclaration9_Release(decl4); - refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %lu references left.\n", refcount); -done: - IDirect3D9_Release(d3d); - DestroyWindow(window); -} - static void texdepth_test(void) { IDirect3DPixelShader9 *shader; @@ -29304,6 +28458,401 @@ todo_wine_if ((fog_mode_tests[pixel_mode] != D3DFOG_NONE && !ortho_fog && (vs_mo release_test_context(&context); }
+static void test_texture_transform_flags(void) +{ + IDirect3DPixelShader9 *ps1, *ps2, *ps_texcoord; + D3DADAPTER_IDENTIFIER9 identifier; + struct d3d9_test_context context; + struct surface_readback rb; + IDirect3DVertexShader9 *vs; + IDirect3DTexture9 *texture; + D3DLOCKED_RECT locked_rect; + const struct vec4 *colour; + IDirect3DDevice9 *device; + IDirect3DSurface9 *rt; + HRESULT hr; + + static const DWORD vs_code[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ + 0x0000001f, 0x80000005, 0x900f0001, /* dcl_texcoord0 v1 */ + 0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ + 0x00000001, 0xe00f0000, 0x90e40001, /* mov oT0, v1 */ + 0x0000ffff /* end */ + }; + + static const DWORD ps1_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000042, 0xb00f0000, /* tex t0 */ + 0x00000001, 0x800f0000, 0xb0e40000, /* mov r0, t0 */ + 0x0000ffff /* end */ + }; + + static const DWORD ps2_code[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0xb00f0000, /* dcl t0 */ + 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */ + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, /* texld r0, t0, s0 */ + 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */ + 0x0000ffff /* end */ + }; + + static const DWORD ps_texcoord_code[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0xb00f0000, /* dcl t0 */ + 0x02000001, 0x800f0800, 0xb0e40000, /* mov oC0, t0 */ + 0x0000ffff /* end */ + }; + + /* "Swapped" identity matrix; should simply reorder the components to [w, z, y, x]. */ + static const D3DMATRIX texture_matrix = + {{{ + 0.0f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.0f, 0.0f, + }}}; + + static const struct + { + struct vec3 position; + struct vec3 normal; + float texcoord[4]; + } + quad[] = + { + {{-1.0f, -1.0f, 0.5f}, {0.1f, 0.3f, 0.6f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{-1.0f, 1.0f, 0.5f}, {0.1f, 0.3f, 0.6f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{ 1.0f, -1.0f, 0.5f}, {0.1f, 0.3f, 0.6f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{ 1.0f, 1.0f, 0.5f}, {0.1f, 0.3f, 0.6f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + }; + + static const struct + { + struct vec4 position; + float texcoord[4]; + } + rhw_quad[] = + { + {{ 0.0f, 0.0f, 0.5f, 1.0f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{640.0f, 0.0f, 0.5f, 1.0f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{ 0.0f, 480.0f, 0.5f, 1.0f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + {{640.0f, 480.0f, 0.5f, 1.0f}, {0.8f, 0.2f, 0.4f, 0.5f}}, + }; + + static const D3DTEXTURETRANSFORMFLAGS flags_tests[] = + { + D3DTTFF_DISABLE, + D3DTTFF_COUNT1, + D3DTTFF_COUNT2, + D3DTTFF_COUNT3, + D3DTTFF_COUNT4, + D3DTTFF_DISABLE | D3DTTFF_PROJECTED, + D3DTTFF_COUNT1 | D3DTTFF_PROJECTED, + D3DTTFF_COUNT2 | D3DTTFF_PROJECTED, + D3DTTFF_COUNT3 | D3DTTFF_PROJECTED, + D3DTTFF_COUNT4 | D3DTTFF_PROJECTED, + 0xffffffff & ~D3DTTFF_PROJECTED, + 0xffffffff, + 0xffffff03, + }; + + enum vs_mode + { + VS_MODE_RHW, + VS_MODE_FFP, + VS_MODE_FFP_NORMAL, + VS_MODE_VS, + }; + + enum ps_mode + { + PS_MODE_FFP, + PS_MODE_PS1, + PS_MODE_PS2, + PS_MODE_TEXCOORDS, + }; + + if (!init_test_context(&context)) + return; + device = context.device; + + hr = IDirect3D9_GetAdapterIdentifier(context.d3d, D3DADAPTER_DEFAULT, 0, &identifier); + ok(hr == S_OK, "Failed to get adapter identifier, hr %#lx.\n", hr); + + hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A32B32G32R32F, + D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_CreateVertexShader(device, vs_code, &vs); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps1_code, &ps1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps2_code, &ps2); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps_texcoord_code, &ps_texcoord); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_TEXTURE0, &texture_matrix); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_CreateTexture(device, 200, 200, 1, 0, D3DFMT_A32B32G32R32F, D3DPOOL_MANAGED, &texture, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DTexture9_LockRect(texture, 0, &locked_rect, NULL, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + for (unsigned int x = 0; x < 200; ++x) + { + for (unsigned int y = 0; y < 200; ++y) + { + struct vec4 *v; + + v = (struct vec4 *)((char *)locked_rect.pBits + (y * locked_rect.Pitch)) + x; + v->x = (x / 200.0f); + v->y = (y / 200.0f); + v->z = 0.0f; + v->w = 0.0f; + } + } + hr = IDirect3DTexture9_UnlockRect(texture, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + for (unsigned int attrib_count = 1; attrib_count <= 4; ++attrib_count) + { + IDirect3DVertexDeclaration9 *vdecl, *vdecl_rhw; + + const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, + {0, 24, D3DDECLTYPE_FLOAT1 + (attrib_count - 1), D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, + D3DDECL_END() + }; + + const D3DVERTEXELEMENT9 decl_elements_rhw[] = + { + {0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITIONT, 0}, + {0, 16, D3DDECLTYPE_FLOAT1 + (attrib_count - 1), D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, + D3DDECL_END() + }; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vdecl); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_rhw, &vdecl_rhw); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + for (enum vs_mode vs_mode = 0; vs_mode < 4; ++vs_mode) + { + for (enum ps_mode ps_mode = 0; ps_mode < 4; ++ps_mode) + { + for (unsigned int i = 0; i < ARRAY_SIZE(flags_tests); ++i) + { + D3DTEXTURETRANSFORMFLAGS flags = flags_tests[i]; + float texcoords[4], expect[4]; + DWORD ret_flags; + bool equal; + + if ((flags & D3DTTFF_PROJECTED) && vs_mode == VS_MODE_RHW + && (ps_mode == PS_MODE_FFP || ps_mode == PS_MODE_PS1)) + { + /* Some cases here, but not all, texture values which + * don't make any sense. + * Assume it's a bug in native and skip them. */ + continue; + } + + winetest_push_context("attrib count %u, vs_mode %u, ps_mode %u, flags %#x", + attrib_count, vs_mode, ps_mode, flags); + + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, flags); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_GetTextureStageState(device, 0, D3DTSS_TEXTURETRANSFORMFLAGS, &ret_flags); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(ret_flags == flags, "Got flags %#lx.\n", ret_flags); + + hr = IDirect3DDevice9_SetVertexShader(device, vs_mode == VS_MODE_VS ? vs : NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_TEXCOORDINDEX, + vs_mode == VS_MODE_FFP_NORMAL ? 0 | D3DTSS_TCI_CAMERASPACENORMAL : 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + if (ps_mode == PS_MODE_FFP) + hr = IDirect3DDevice9_SetPixelShader(device, NULL); + else if (ps_mode == PS_MODE_PS1) + hr = IDirect3DDevice9_SetPixelShader(device, ps1); + else if (ps_mode == PS_MODE_PS2) + hr = IDirect3DDevice9_SetPixelShader(device, ps2); + else if (ps_mode == PS_MODE_TEXCOORDS) + hr = IDirect3DDevice9_SetPixelShader(device, ps_texcoord); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + if (vs_mode == VS_MODE_RHW) + { + hr = IDirect3DDevice9_SetVertexDeclaration(device, vdecl_rhw); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, + D3DPT_TRIANGLESTRIP, 2, rhw_quad, sizeof(*rhw_quad)); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + } + else + { + hr = IDirect3DDevice9_SetVertexDeclaration(device, vdecl); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, + D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + } + hr = IDirect3DDevice9_EndScene(device); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + if (vs_mode == VS_MODE_FFP) + { + memset(&texcoords, 0, sizeof(texcoords)); + + if ((flags & ~D3DTTFF_PROJECTED) >= D3DTTFF_COUNT2 + && (flags & ~D3DTTFF_PROJECTED) <= D3DTTFF_COUNT4) + { + float attrib[4] = {0}; + + /* Construct a pseudo "attribute" with 1 in the + * first unused component, which is then transformed + * by the texture matrix and transform flags. */ + memcpy(&attrib, &quad[0].texcoord, attrib_count * sizeof(float)); + if (attrib_count < 4) + attrib[attrib_count] = 1.0f; + + for (unsigned int k = 0; k < (flags & ~D3DTTFF_PROJECTED); ++k) + texcoords[k] = attrib[3 - k]; + + if (flags == (D3DTTFF_COUNT2 | D3DTTFF_PROJECTED)) + texcoords[3] = texcoords[1]; + else if (flags == (D3DTTFF_COUNT3 | D3DTTFF_PROJECTED)) + texcoords[3] = texcoords[2]; + } + else + { + /* For some reason this does *not* fill the W component with 1. */ + memcpy(&texcoords, &quad[0].texcoord, attrib_count * sizeof(float)); + if (flags & D3DTTFF_PROJECTED) + texcoords[3] = quad[0].texcoord[attrib_count - 1]; + } + } + else if (vs_mode == VS_MODE_FFP_NORMAL) + { + /* Same as above, only we draw from the normal instead, + * and the attribute count is therefore always 3. */ + + memset(&texcoords, 0, sizeof(texcoords)); + + if ((flags & ~D3DTTFF_PROJECTED) >= D3DTTFF_COUNT2 + && (flags & ~D3DTTFF_PROJECTED) <= D3DTTFF_COUNT4) + { + float attrib[4] = {quad[0].normal.x, quad[0].normal.y, quad[0].normal.z, 1.0f}; + + for (unsigned int k = 0; k < (flags & ~D3DTTFF_PROJECTED); ++k) + texcoords[k] = attrib[3 - k]; + + if (flags == (D3DTTFF_COUNT2 | D3DTTFF_PROJECTED)) + texcoords[3] = texcoords[1]; + else if (flags == (D3DTTFF_COUNT3 | D3DTTFF_PROJECTED)) + texcoords[3] = texcoords[2]; + } + else + { + /* For some reason this does *not* fill the W component with 1. */ + memcpy(&texcoords, &quad[0].normal, sizeof(quad[0].normal)); + if (flags & D3DTTFF_PROJECTED) + texcoords[3] = quad[0].normal.z; + } + } + else + { + texcoords[1] = texcoords[2] = 0.0f; + texcoords[3] = 1.0f; + memcpy(&texcoords, &quad[0].texcoord, attrib_count * sizeof(float)); + } + + if (ps_mode == PS_MODE_TEXCOORDS) + { + memcpy(&expect, &texcoords, sizeof(texcoords)); + } + else + { + float dummy; + + /* Default mode is WRAP. */ + if ((flags & D3DTTFF_PROJECTED) && ps_mode != PS_MODE_PS2) + { + if (texcoords[3]) + { + expect[0] = modff(texcoords[0] / texcoords[3], &dummy); + expect[1] = modff(texcoords[1] / texcoords[3], &dummy); + } + else + { + expect[0] = 0.0f; + expect[1] = 0.0f; + } + } + else + { + expect[0] = modff(texcoords[0], &dummy); + expect[1] = modff(texcoords[1], &dummy); + } + expect[2] = 0.0f; + expect[3] = 0.0f; + } + + get_rt_readback(rt, &rb); + colour = get_readback_vec4(&rb, 0, 0); + /* We use point filtering, but we might have sampled the + * neighbouring texel. */ + equal = fabsf(colour->x - expect[0]) <= 0.006f && fabsf(colour->y - expect[1]) <= 0.006f + && colour->z == expect[2] && colour->w == expect[3]; +todo_wine_if ((vs_mode == VS_MODE_VS && ps_mode == PS_MODE_FFP && flags == (D3DTTFF_PROJECTED | D3DTTFF_COUNT3)) + || ((vs_mode == VS_MODE_FFP || vs_mode == VS_MODE_FFP_NORMAL) && !equal)) + ok(equal, "Expected colour {%.8e, %.8e, %.8e, %.8e}; got {%.8e, %.8e, %.8e, %.8e}.\n", + expect[0], expect[1], expect[2], expect[3], colour->x, colour->y, colour->z, colour->w); + release_surface_readback(&rb); + + winetest_pop_context(); + } + } + } + + IDirect3DVertexDeclaration9_Release(vdecl); + IDirect3DVertexDeclaration9_Release(vdecl_rhw); + } + + IDirect3DTexture9_Release(texture); + IDirect3DVertexShader9_Release(vs); + IDirect3DPixelShader9_Release(ps1); + IDirect3DPixelShader9_Release(ps2); + IDirect3DPixelShader9_Release(ps_texcoord); + IDirect3DSurface9_Release(rt); + release_test_context(&context); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -29353,7 +28902,6 @@ START_TEST(visual) float_texture_test(); g16r16_texture_test(); pixelshader_blending_test(); - texture_transform_flags_test(); test_generate_mipmap(); test_mipmap_autogen(); fixed_function_decl_test(); @@ -29463,4 +29011,5 @@ START_TEST(visual) test_format_conversion(); test_ffp_w(); test_fog(); + test_texture_transform_flags(); }
From: Elizabeth Figura zfigura@codeweavers.com
Use an identity matrix for any count other than 2, 3, or 4. --- dlls/wined3d/utils.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 075fe4977ca..dadd1683fc6 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5682,20 +5682,15 @@ void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix) { + unsigned int count = (flags & ~WINED3D_TTFF_PROJECTED); struct wined3d_matrix mat;
- if (flags == WINED3D_TTFF_DISABLE || flags == WINED3D_TTFF_COUNT1) + if (count < 2 || count > 4) { get_identity_matrix(out_matrix); return; }
- if (flags == (WINED3D_TTFF_COUNT1 | WINED3D_TTFF_PROJECTED)) - { - ERR("Invalid texture transform flags: WINED3D_TTFF_COUNT1 | WINED3D_TTFF_PROJECTED.\n"); - return; - } - mat = *matrix;
/* When less than 4 components are provided for an attribute, the remaining
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/utils.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index dadd1683fc6..74aced11ca9 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5680,7 +5680,7 @@ void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned
/* Setup this textures matrix according to the texture flags. */ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, - enum wined3d_format_id format_id, struct wined3d_matrix *out_matrix) + unsigned int attrib_count, struct wined3d_matrix *out_matrix) { unsigned int count = (flags & ~WINED3D_TTFF_PROJECTED); struct wined3d_matrix mat; @@ -5711,44 +5711,37 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t
if (!(flags & WINED3D_TTFF_PROJECTED) && !calculated_coords) { - switch (format_id) + switch (attrib_count) { - case WINED3DFMT_R32_FLOAT: + case 1: mat._41 = mat._21; mat._42 = mat._22; mat._43 = mat._23; mat._44 = mat._24; break;
- case WINED3DFMT_R32G32_FLOAT: + case 2: mat._41 = mat._31; mat._42 = mat._32; mat._43 = mat._33; mat._44 = mat._34; break; - - case WINED3DFMT_R32G32B32_FLOAT: - case WINED3DFMT_R32G32B32A32_FLOAT: - case WINED3DFMT_UNKNOWN: - break; - default: - FIXME("Unexpected fixed function texture coord input\n"); } }
*out_matrix = mat; }
-static enum wined3d_format_id get_texcoord_format(const struct wined3d_vertex_declaration *decl, unsigned int index) +static unsigned int get_texcoord_attrib_count(const struct wined3d_vertex_declaration *decl, unsigned int index) { for (unsigned int i = 0; i < decl->element_count; ++i) { if (decl->elements[i].usage == WINED3D_DECL_USAGE_TEXCOORD && decl->elements[i].usage_idx == index) - return decl->elements[i].format->id; + return decl->elements[i].format->component_count; }
- return WINED3DFMT_UNKNOWN; + return 0; }
void get_texture_matrix(const struct wined3d_stateblock_state *state, @@ -5761,7 +5754,7 @@ void get_texture_matrix(const struct wined3d_stateblock_state *state,
compute_texture_matrix(&state->transforms[WINED3D_TS_TEXTURE0 + tex], state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS], - generated, get_texcoord_format(state->vertex_declaration, coord_idx), mat); + generated, get_texcoord_attrib_count(state->vertex_declaration, coord_idx), mat); }
static BOOL wined3d_get_primary_display(WCHAR *display)
From: Elizabeth Figura zfigura@codeweavers.com
This results in functionally identical code. --- dlls/wined3d/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 74aced11ca9..77bd256b5e8 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5679,7 +5679,7 @@ void get_modelview_matrix(const struct wined3d_stateblock_state *state, unsigned }
/* Setup this textures matrix according to the texture flags. */ -static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, BOOL calculated_coords, +static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t flags, unsigned int attrib_count, struct wined3d_matrix *out_matrix) { unsigned int count = (flags & ~WINED3D_TTFF_PROJECTED); @@ -5709,7 +5709,7 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t * actually has a value of 1. The coefficients for other columns don't need * to be modified, since the corresponding texcoord components are zero. */
- if (!(flags & WINED3D_TTFF_PROJECTED) && !calculated_coords) + if (!(flags & WINED3D_TTFF_PROJECTED)) { switch (attrib_count) { @@ -5754,7 +5754,7 @@ void get_texture_matrix(const struct wined3d_stateblock_state *state,
compute_texture_matrix(&state->transforms[WINED3D_TS_TEXTURE0 + tex], state->texture_states[tex][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS], - generated, get_texcoord_attrib_count(state->vertex_declaration, coord_idx), mat); + generated ? 3 : get_texcoord_attrib_count(state->vertex_declaration, coord_idx), mat); }
static BOOL wined3d_get_primary_display(WCHAR *display)
From: Elizabeth Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56639 --- dlls/wined3d/utils.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 77bd256b5e8..b757981f24e 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5709,24 +5709,19 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t * actually has a value of 1. The coefficients for other columns don't need * to be modified, since the corresponding texcoord components are zero. */
- if (!(flags & WINED3D_TTFF_PROJECTED)) + if (attrib_count == 1) { - switch (attrib_count) - { - case 1: - mat._41 = mat._21; - mat._42 = mat._22; - mat._43 = mat._23; - mat._44 = mat._24; - break; - - case 2: - mat._41 = mat._31; - mat._42 = mat._32; - mat._43 = mat._33; - mat._44 = mat._34; - break; - } + mat._41 = mat._21; + mat._42 = mat._22; + mat._43 = mat._23; + mat._44 = mat._24; + } + else if (attrib_count == 2) + { + mat._41 = mat._31; + mat._42 = mat._32; + mat._43 = mat._33; + mat._44 = mat._34; }
*out_matrix = mat;
From: Elizabeth Figura zfigura@codeweavers.com
By manipulating the texture matrix. --- dlls/wined3d/utils.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index b757981f24e..40bd918f3e2 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5688,6 +5688,17 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t if (count < 2 || count > 4) { get_identity_matrix(out_matrix); + + if (flags & WINED3D_TTFF_PROJECTED) + { + /* As below: effectively copy the component to divide by to W. */ + if (attrib_count == 1) + out_matrix->_14 = 1.0f; + else if (attrib_count == 2) + out_matrix->_24 = 1.0f; + else if (attrib_count == 3) + out_matrix->_34 = 1.0f; + } return; }
@@ -5724,6 +5735,28 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t mat._44 = mat._34; }
+ /* Projection is handled in two steps. In the vertex pipeline, the + * component to be divided by is copied to W. In the fragment pipeline, + * sampling the projected texture always divides by W. */ + + if (flags & WINED3D_TTFF_PROJECTED) + { + if (count == 2) + { + mat._14 = mat._12; + mat._24 = mat._22; + mat._34 = mat._32; + mat._44 = mat._42; + } + else if (count == 3) + { + mat._14 = mat._13; + mat._24 = mat._23; + mat._34 = mat._33; + mat._44 = mat._43; + } + } + *out_matrix = mat; }
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 40bd918f3e2..69d8568254b 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5688,6 +5688,8 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t if (count < 2 || count > 4) { get_identity_matrix(out_matrix); + if (attrib_count < 4) + out_matrix->_44 = 0.0f;
if (flags & WINED3D_TTFF_PROJECTED) { @@ -5735,6 +5737,24 @@ static void compute_texture_matrix(const struct wined3d_matrix *matrix, uint32_t mat._44 = mat._34; }
+ /* When using the FFP, components greater than the count are set to zero. */ + + if (count < 4) + { + mat._14 = 0.0f; + mat._24 = 0.0f; + mat._34 = 0.0f; + mat._44 = 0.0f; + } + + if (count < 3) + { + mat._13 = 0.0f; + mat._23 = 0.0f; + mat._33 = 0.0f; + mat._43 = 0.0f; + } + /* Projection is handled in two steps. In the vertex pipeline, the * component to be divided by is copied to W. In the fragment pipeline, * sampling the projected texture always divides by W. */
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/d3d9/tests/visual.c | 10 +++---- dlls/wined3d/glsl_shader.c | 50 +++----------------------------- dlls/wined3d/shader.c | 52 ++-------------------------------- dlls/wined3d/wined3d_private.h | 9 ++---- 4 files changed, 13 insertions(+), 108 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 7ea2d0e0d59..8a35c4b379a 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -28665,7 +28665,6 @@ static void test_texture_transform_flags(void) D3DTEXTURETRANSFORMFLAGS flags = flags_tests[i]; float texcoords[4], expect[4]; DWORD ret_flags; - bool equal;
if ((flags & D3DTTFF_PROJECTED) && vs_mode == VS_MODE_RHW && (ps_mode == PS_MODE_FFP || ps_mode == PS_MODE_PS1)) @@ -28827,11 +28826,10 @@ static void test_texture_transform_flags(void) colour = get_readback_vec4(&rb, 0, 0); /* We use point filtering, but we might have sampled the * neighbouring texel. */ - equal = fabsf(colour->x - expect[0]) <= 0.006f && fabsf(colour->y - expect[1]) <= 0.006f - && colour->z == expect[2] && colour->w == expect[3]; -todo_wine_if ((vs_mode == VS_MODE_VS && ps_mode == PS_MODE_FFP && flags == (D3DTTFF_PROJECTED | D3DTTFF_COUNT3)) - || ((vs_mode == VS_MODE_FFP || vs_mode == VS_MODE_FFP_NORMAL) && !equal)) - ok(equal, "Expected colour {%.8e, %.8e, %.8e, %.8e}; got {%.8e, %.8e, %.8e, %.8e}.\n", +todo_wine_if ((vs_mode == VS_MODE_VS && ps_mode == PS_MODE_FFP && flags == (D3DTTFF_PROJECTED | D3DTTFF_COUNT3))) + ok(fabsf(colour->x - expect[0]) <= 0.006f && fabsf(colour->y - expect[1]) <= 0.006f + && colour->z == expect[2] && colour->w == expect[3], + "Expected colour {%.8e, %.8e, %.8e, %.8e}; got {%.8e, %.8e, %.8e, %.8e}.\n", expect[0], expect[1], expect[2], expect[3], colour->x, colour->y, colour->z, colour->w); release_surface_readback(&rb);
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 93abadc6f6b..193badacfb0 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5364,29 +5364,11 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins)
if (shader_version < WINED3D_SHADER_VERSION(1,4)) { - DWORD flags = (priv->cur_ps_args->tex_transform >> resource_idx * WINED3D_PSARGS_TEXTRANSFORM_SHIFT) - & WINED3D_PSARGS_TEXTRANSFORM_MASK; - /* Projected cube textures don't make a lot of sense, the resulting coordinates stay the same. */ - if (flags & WINED3D_PSARGS_PROJECTED && resource_type != WINED3D_SHADER_RESOURCE_TEXTURE_CUBE) + if ((priv->cur_ps_args->projected & (1u << resource_idx)) && resource_type != WINED3D_SHADER_RESOURCE_TEXTURE_CUBE) { sample_flags |= WINED3D_GLSL_SAMPLE_PROJECTED; - switch (flags & ~WINED3D_PSARGS_PROJECTED) - { - case WINED3D_TTFF_COUNT1: - FIXME("WINED3D_TTFF_PROJECTED with WINED3D_TTFF_COUNT1?\n"); - break; - case WINED3D_TTFF_COUNT2: - mask = WINED3DSP_WRITEMASK_1; - break; - case WINED3D_TTFF_COUNT3: - mask = WINED3DSP_WRITEMASK_2; - break; - case WINED3D_TTFF_COUNT4: - case WINED3D_TTFF_DISABLE: - mask = WINED3DSP_WRITEMASK_3; - break; - } + mask = WINED3DSP_WRITEMASK_3; } } else if (shader_version < WINED3D_SHADER_VERSION(2,0)) @@ -6756,12 +6738,9 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins) struct glsl_src_param coord_param; unsigned int sampler_idx; DWORD mask; - DWORD flags; char coord_mask[6];
sampler_idx = ins->dst[0].reg.idx[0].offset; - flags = (priv->cur_ps_args->tex_transform >> sampler_idx * WINED3D_PSARGS_TEXTRANSFORM_SHIFT) - & WINED3D_PSARGS_TEXTRANSFORM_MASK;
/* Dependent read, not valid with conditional NP2 */ shader_glsl_get_sample_function(ins->ctx, sampler_idx, sampler_idx, 0, &sample_function); @@ -6771,29 +6750,8 @@ static void shader_glsl_texbem(const struct wined3d_shader_instruction *ins)
/* With projected textures, texbem only divides the static texture coord, * not the displacement, so we can't let GL handle this. */ - if (flags & WINED3D_PSARGS_PROJECTED) - { - DWORD div_mask=0; - char coord_div_mask[3]; - switch (flags & ~WINED3D_PSARGS_PROJECTED) - { - case WINED3D_TTFF_COUNT1: - FIXME("WINED3D_TTFF_PROJECTED with WINED3D_TTFF_COUNT1?\n"); - break; - case WINED3D_TTFF_COUNT2: - div_mask = WINED3DSP_WRITEMASK_1; - break; - case WINED3D_TTFF_COUNT3: - div_mask = WINED3DSP_WRITEMASK_2; - break; - case WINED3D_TTFF_COUNT4: - case WINED3D_TTFF_DISABLE: - div_mask = WINED3DSP_WRITEMASK_3; - break; - } - shader_glsl_write_mask_to_str(div_mask, coord_div_mask); - shader_addline(ins->ctx->buffer, "T%u%s /= T%u%s;\n", sampler_idx, coord_mask, sampler_idx, coord_div_mask); - } + if (priv->cur_ps_args->projected & (1u << sampler_idx)) + shader_addline(ins->ctx->buffer, "T%u%s /= T%u.w;\n", sampler_idx, coord_mask, sampler_idx);
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1, &coord_param);
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index a8245ce59d3..3d7d546b9de 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -2863,7 +2863,6 @@ void find_gs_compile_args(const struct wined3d_state *state, const struct wined3 void find_ps_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, BOOL position_transformed, struct ps_compile_args *args, const struct wined3d_context *context) { - const struct wined3d_shader *vs = state->shader[WINED3D_SHADER_TYPE_VERTEX]; const struct wined3d_d3d_info *d3d_info = context->d3d_info; struct wined3d_shader_resource_view *view; struct wined3d_texture *texture; @@ -2885,55 +2884,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 { for (i = 0; i < shader->limits->sampler; ++i) { - uint32_t flags = state->extra_ps_args.texture_transform_flags[i]; - - if (flags & WINED3D_TTFF_PROJECTED) - { - uint32_t tex_transform = flags & ~WINED3D_TTFF_PROJECTED; - - if (!vs || vs->is_ffp_vs) - { - enum wined3d_shader_resource_type resource_type = shader->reg_maps.resource_info[i].type; - unsigned int j; - unsigned int index = state->extra_ps_args.texcoord_index[i]; - uint32_t max_valid = WINED3D_TTFF_COUNT4; - - for (j = 0; j < state->vertex_declaration->element_count; ++j) - { - struct wined3d_vertex_declaration_element *element = - &state->vertex_declaration->elements[j]; - - if (element->usage == WINED3D_DECL_USAGE_TEXCOORD - && element->usage_idx == index) - { - max_valid = element->format->component_count; - break; - } - } - if (!tex_transform || tex_transform > max_valid) - { - WARN("Fixing up projected texture transform flags from %#x to %#x.\n", - tex_transform, max_valid); - tex_transform = max_valid; - } - if ((resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_1D && tex_transform > WINED3D_TTFF_COUNT1) - || (resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_2D - && tex_transform > WINED3D_TTFF_COUNT2) - || (resource_type == WINED3D_SHADER_RESOURCE_TEXTURE_3D - && tex_transform > WINED3D_TTFF_COUNT3)) - tex_transform |= WINED3D_PSARGS_PROJECTED; - else - { - WARN("Application requested projected texture with unsuitable texture coordinates.\n"); - WARN("(texture unit %u, transform flags %#x, sampler type %u).\n", - i, tex_transform, resource_type); - } - } - else - tex_transform = WINED3D_TTFF_COUNT4 | WINED3D_PSARGS_PROJECTED; - - args->tex_transform |= tex_transform << i * WINED3D_PSARGS_TEXTRANSFORM_SHIFT; - } + if (state->extra_ps_args.texture_transform_flags[i] & WINED3D_TTFF_PROJECTED) + args->projected |= (1u << i); } } if (shader->reg_maps.shader_version.major == 1 diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 275ed80b43d..d3ab5b646f4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1458,9 +1458,6 @@ enum wined3d_ffp_ps_fog_mode * into the shader code */
-#define WINED3D_PSARGS_PROJECTED (1u << 3) -#define WINED3D_PSARGS_TEXTRANSFORM_SHIFT 4 -#define WINED3D_PSARGS_TEXTRANSFORM_MASK 0xfu #define WINED3D_PSARGS_TEXTYPE_SHIFT 2 #define WINED3D_PSARGS_TEXTYPE_MASK 0x3u
@@ -1479,16 +1476,16 @@ struct ps_compile_args enum wined3d_vertex_processing_mode vp_mode; enum wined3d_ffp_ps_fog_mode fog; DWORD tex_types; /* ps 1 - 3, 16 textures */ - WORD tex_transform; /* ps 1.0-1.3, 4 textures */ - WORD srgb_correction; WORD shadow; /* WINED3D_MAX_FRAGMENT_SAMPLERS, 16 */ WORD texcoords_initialized; /* WINED3D_MAX_FFP_TEXTURES, 8 */ + DWORD srgb_correction : 1; DWORD pointsprite : 1; DWORD flatshading : 1; DWORD alpha_test_func : 3; DWORD rt_alpha_swizzle : 8; /* WINED3D_MAX_RENDER_TARGETS, 8 */ DWORD dual_source_blend : 1; - DWORD padding : 18; + DWORD projected : 4; + DWORD padding : 13; };
enum fog_src_type
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/d3d9/tests/visual.c | 1 - dlls/wined3d/ffp_hlsl.c | 36 ++++--------------------------- dlls/wined3d/glsl_shader.c | 39 +++++----------------------------- dlls/wined3d/utils.c | 19 +++-------------- dlls/wined3d/wined3d_private.h | 14 ++---------- 5 files changed, 14 insertions(+), 95 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 8a35c4b379a..edadc7016d4 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -28826,7 +28826,6 @@ static void test_texture_transform_flags(void) colour = get_readback_vec4(&rb, 0, 0); /* We use point filtering, but we might have sampled the * neighbouring texel. */ -todo_wine_if ((vs_mode == VS_MODE_VS && ps_mode == PS_MODE_FFP && flags == (D3DTTFF_PROJECTED | D3DTTFF_COUNT3))) ok(fabsf(colour->x - expect[0]) <= 0.006f && fabsf(colour->y - expect[1]) <= 0.006f && colour->z == expect[2] && colour->w == expect[3], "Expected colour {%.8e, %.8e, %.8e, %.8e}; got {%.8e, %.8e, %.8e, %.8e}.\n", diff --git a/dlls/wined3d/ffp_hlsl.c b/dlls/wined3d/ffp_hlsl.c index a0d848a9c8f..dd03eeea793 100644 --- a/dlls/wined3d/ffp_hlsl.c +++ b/dlls/wined3d/ffp_hlsl.c @@ -740,26 +740,11 @@ static bool ffp_hlsl_generate_pixel_shader(const struct ffp_frag_settings *setti for (i = 0; i < WINED3D_MAX_FFP_TEXTURES && settings->op[i].cop != WINED3D_TOP_DISABLE; ++i) { const char *texture_function, *coord_mask; - bool proj; + bool proj = settings->op[i].projected;
if (!(tex_map & (1u << i))) continue;
- if (settings->op[i].projected == WINED3D_PROJECTION_NONE) - { - proj = false; - } - else if (settings->op[i].projected == WINED3D_PROJECTION_COUNT4 - || settings->op[i].projected == WINED3D_PROJECTION_COUNT3) - { - proj = true; - } - else - { - FIXME("Unexpected projection mode %d.\n", settings->op[i].projected); - proj = true; - } - switch (settings->op[i].tex_type) { case WINED3D_GL_RES_TYPE_TEX_1D: @@ -798,18 +783,10 @@ static bool ffp_hlsl_generate_pixel_shader(const struct ffp_frag_settings *setti /* With projective textures, texbem only divides the static texture * coordinate, not the displacement, so multiply the displacement * with the dividing parameter before sampling. */ - if (settings->op[i].projected != WINED3D_PROJECTION_NONE) + if (settings->op[i].projected) { - if (settings->op[i].projected == WINED3D_PROJECTION_COUNT4) - { - shader_addline(buffer, "ret.xy = (ret.xy * texcoord[%u].w) + texcoord[%u].xy;\n", i, i); - shader_addline(buffer, "ret.zw = texcoord[%u].ww;\n", i); - } - else - { - shader_addline(buffer, "ret.xy = (ret.xy * texcoord[%u].z) + texcoord[%u].xy;\n", i, i); - shader_addline(buffer, "ret.zw = texcoord[%u].zz;\n", i); - } + shader_addline(buffer, "ret.xy = (ret.xy * texcoord[%u].w) + texcoord[%u].xy;\n", i, i); + shader_addline(buffer, "ret.zw = texcoord[%u].ww;\n", i); } else { @@ -825,11 +802,6 @@ static bool ffp_hlsl_generate_pixel_shader(const struct ffp_frag_settings *setti i, i - 1, (i - 1) / 4, (i - 1) % 4, (i - 1) / 4, (i - 1) % 4); } } - else if (settings->op[i].projected == WINED3D_PROJECTION_COUNT3) - { - shader_addline(buffer, " tex%u = %s%s(ps_sampler%u, texcoord[%u].xyzz);\n", - i, texture_function, proj ? "proj" : "", i, i); - } else { shader_addline(buffer, " tex%u = %s%s(ps_sampler%u, texcoord[%u].%s);\n", diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 193badacfb0..97cdfa9f532 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -9867,26 +9867,11 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * for (stage = 0; stage < WINED3D_MAX_FFP_TEXTURES && settings->op[stage].cop != WINED3D_TOP_DISABLE; ++stage) { const char *texture_function, *coord_mask; - BOOL proj; + BOOL proj = settings->op[stage].projected;
if (!(tex_map & (1u << stage))) continue;
- if (settings->op[stage].projected == WINED3D_PROJECTION_NONE) - { - proj = FALSE; - } - else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4 - || settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) - { - proj = TRUE; - } - else - { - FIXME("Unexpected projection mode %d\n", settings->op[stage].projected); - proj = TRUE; - } - if (settings->op[stage].tex_type == WINED3D_GL_RES_TYPE_TEX_CUBE) proj = FALSE;
@@ -9928,20 +9913,11 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * * texture coordinate, not the displacement, so multiply the * displacement with the dividing parameter before passing it to * TXP. */ - if (settings->op[stage].projected != WINED3D_PROJECTION_NONE) + if (settings->op[stage].projected) { - if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT4) - { - shader_addline(buffer, "ret.xy = (ret.xy * ffp_texcoord[%u].w) + ffp_texcoord[%u].xy;\n", - stage, stage); - shader_addline(buffer, "ret.zw = ffp_texcoord[%u].ww;\n", stage); - } - else - { - shader_addline(buffer, "ret.xy = (ret.xy * ffp_texcoord[%u].z) + ffp_texcoord[%u].xy;\n", - stage, stage); - shader_addline(buffer, "ret.zw = ffp_texcoord[%u].zz;\n", stage); - } + shader_addline(buffer, "ret.xy = (ret.xy * ffp_texcoord[%u].w) + ffp_texcoord[%u].xy;\n", + stage, stage); + shader_addline(buffer, "ret.zw = ffp_texcoord[%u].ww;\n", stage); } else { @@ -9955,11 +9931,6 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv * shader_addline(buffer, "tex%u *= clamp(tex%u.z * bumpenv_lum_scale%u + bumpenv_lum_offset%u, 0.0, 1.0);\n", stage, stage - 1, stage - 1, stage - 1); } - else if (settings->op[stage].projected == WINED3D_PROJECTION_COUNT3) - { - shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].xyz);\n", - stage, texture_function, proj ? "Proj" : "", stage, stage); - } else { shader_addline(buffer, "tex%u = %s%s(ps_sampler%u, ffp_texcoord[%u].%s%s);\n", diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 69d8568254b..5c37dbba0e9 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6240,7 +6240,6 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, /* D3DTOP_LERP */ ARG1 | ARG2 | ARG0 }; unsigned int i; - DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; struct wined3d_texture *texture;
@@ -6258,7 +6257,7 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY; settings->op[i].tmp_dst = 0; settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D; - settings->op[i].projected = WINED3D_PROJECTION_NONE; + settings->op[i].projected = 0; i++; break; } @@ -6350,21 +6349,9 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_state *state, aop = WINED3D_TOP_SELECT_ARG1; }
- if (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE + settings->op[i].projected = (carg1 == WINED3DTA_TEXTURE || carg2 == WINED3DTA_TEXTURE || carg0 == WINED3DTA_TEXTURE || aarg1 == WINED3DTA_TEXTURE || aarg2 == WINED3DTA_TEXTURE || aarg0 == WINED3DTA_TEXTURE) - { - ttff = state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS]; - if (ttff == (WINED3D_TTFF_PROJECTED | WINED3D_TTFF_COUNT3)) - settings->op[i].projected = WINED3D_PROJECTION_COUNT3; - else if (ttff & WINED3D_TTFF_PROJECTED) - settings->op[i].projected = WINED3D_PROJECTION_COUNT4; - else - settings->op[i].projected = WINED3D_PROJECTION_NONE; - } - else - { - settings->op[i].projected = WINED3D_PROJECTION_NONE; - } + && (state->texture_states[i][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS] & WINED3D_TTFF_PROJECTED);
settings->op[i].cop = cop; settings->op[i].aop = aop; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d3ab5b646f4..1a53ab9b151 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2633,16 +2633,6 @@ BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter); ssize_t adapter_adjust_mapped_memory(struct wined3d_adapter *adapter, ssize_t size); UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount);
-enum wined3d_projection_type -{ - WINED3D_PROJECTION_NONE = 0, - WINED3D_PROJECTION_COUNT3 = 1, - WINED3D_PROJECTION_COUNT4 = 2 -}; - -/***************************************************************************** - * Fixed function pipeline replacements - */ #define ARG_UNUSED 0xff struct texture_stage_op { @@ -2659,8 +2649,8 @@ struct texture_stage_op struct color_fixup_desc color_fixup; unsigned tex_type : 3; unsigned tmp_dst : 1; - unsigned projected : 2; - unsigned padding : 10; + unsigned projected : 1; + unsigned padding : 11; };
struct ffp_frag_settings
This merge request was approved by Jan Sikorski.