[PATCH 0/3] MR10023: wined3d/spirv: Pass vkd3d_shader_d3dbc_source_info.
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/d3d9/tests/visual.c | 110 +++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 11b31c9ba13..9e588b0768e 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -15861,7 +15861,7 @@ done: static void shadow_test(void) { - static const DWORD ps_code[] = + static const DWORD ps2_code[] = { 0xffff0200, /* ps_2_0 */ 0x0200001f, 0x90000000, 0xa00f0800, /* dcl_2d s0 */ @@ -15874,6 +15874,22 @@ static void shadow_test(void) 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */ 0x0000ffff, /* end */ }; + + static const DWORD ps14_code[] = + { + 0xffff0104, /* ps_1_4 */ + 0x00000042, 0x800f0000, 0xb0e40000, /* texld r0, t0 */ + 0x0000ffff, /* end */ + }; + + static const DWORD ps1_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000042, 0xb00f0000, /* tex t0 */ + 0x00000001, 0x800f0000, 0xb0e40000, /* mov r0, t0 */ + 0x0000ffff, /* end */ + }; + struct { D3DFORMAT format; @@ -15905,23 +15921,23 @@ static void shadow_test(void) }; struct { - unsigned int x, y, color; + unsigned int x, y, color, ps2_color; } expected_colors[] = { - {400, 60, 0x00000000}, - {560, 180, 0xffff00ff}, - {560, 300, 0xffff00ff}, - {400, 420, 0xffffffff}, - {240, 420, 0xffffffff}, - { 80, 300, 0x00000000}, - { 80, 180, 0x00000000}, - {240, 60, 0x00000000}, + {400, 60, 0x00000000, 0x00000000}, + {560, 180, 0xffffffff, 0xffff00ff}, + {560, 300, 0xffffffff, 0xffff00ff}, + {400, 420, 0xffffffff, 0xffffffff}, + {240, 420, 0xffffffff, 0xffffffff}, + { 80, 300, 0x00000000, 0x00000000}, + { 80, 180, 0x00000000, 0x00000000}, + {240, 60, 0x00000000, 0x00000000}, }; IDirect3DSurface9 *original_ds, *original_rt, *rt; + IDirect3DPixelShader9 *ps[4]; struct surface_readback rb; - IDirect3DPixelShader9 *ps; IDirect3DDevice9 *device; IDirect3D9 *d3d; ULONG refcount; @@ -15956,8 +15972,13 @@ static void shadow_test(void) hr = IDirect3DDevice9_CreateRenderTarget(device, 1024, 1024, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL); ok(SUCCEEDED(hr), "CreateRenderTarget failed, hr %#lx.\n", hr); - hr = IDirect3DDevice9_CreatePixelShader(device, ps_code, &ps); + hr = IDirect3DDevice9_CreatePixelShader(device, ps2_code, &ps[0]); + ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps14_code, &ps[1]); ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreatePixelShader(device, ps1_code, &ps[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#lx.\n", hr); + ps[3] = NULL; hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE4(0)); ok(SUCCEEDED(hr), "SetFVF failed, hr %#lx.\n", hr); @@ -15992,6 +16013,8 @@ static void shadow_test(void) D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, format))) continue; + winetest_push_context("%s", formats[i].name); + hr = IDirect3DDevice9_CreateTexture(device, 1024, 1024, 1, D3DUSAGE_DEPTHSTENCIL, format, D3DPOOL_DEFAULT, &texture, NULL); ok(SUCCEEDED(hr), "CreateTexture failed, hr %#lx.\n", hr); @@ -16029,41 +16052,48 @@ static void shadow_test(void) hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture); ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, ps); - ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#lx.\n", hr); + for (unsigned int p = 0; p < 4; ++p) + { + winetest_push_context("ps %u", p); - /* Do the actual shadow mapping. */ - hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "BeginScene failed, hr %#lx.\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); - ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#lx.\n", hr); - hr = IDirect3DDevice9_EndScene(device); - ok(SUCCEEDED(hr), "EndScene failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetPixelShader(device, ps[p]); + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); - IDirect3DTexture9_Release(texture); + /* Do the actual shadow mapping. */ + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed, hr %#lx.\n", hr); - get_rt_readback(original_rt, &rb); - for (j = 0; j < ARRAY_SIZE(expected_colors); ++j) - { - unsigned int color = get_readback_color(&rb, expected_colors[j].x, expected_colors[j].y); - /* Geforce 7 on Windows returns 1.0 in alpha when the depth format is D24S8 or D24X8, - * whereas other GPUs (all AMD, newer Nvidia) return the same value they return in .rgb. - * Accept alpha mismatches as broken but make sure to check the color channels. */ - ok(color_match(color, expected_colors[j].color, 0) - || broken(color_match(color & 0x00ffffff, expected_colors[j].color & 0x00ffffff, 0)), - "Expected color 0x%08x at (%u, %u) for format %s, got 0x%08x.\n", - expected_colors[j].color, expected_colors[j].x, expected_colors[j].y, - formats[i].name, color); + get_rt_readback(original_rt, &rb); + for (j = 0; j < ARRAY_SIZE(expected_colors); ++j) + { + unsigned int color = get_readback_color(&rb, expected_colors[j].x, expected_colors[j].y); + unsigned int expect = (p == 0 ? expected_colors[j].ps2_color : expected_colors[j].color); + + /* Geforce 7 on Windows returns 1.0 in alpha when the depth format is D24S8 or D24X8, + * whereas other GPUs (all AMD, newer Nvidia) return the same value they return in .rgb. + * Accept alpha mismatches as broken but make sure to check the color channels. */ + todo_wine_if (p == 3) ok(color_match(color, expect, 0) + || broken(color_match(color & 0x00ffffff, expect & 0x00ffffff, 0)), + "Expected color 0x%08x at (%u, %u), got 0x%08x.\n", + expect, expected_colors[j].x, expected_colors[j].y, color); + } + release_surface_readback(&rb); + + winetest_pop_context(); } - release_surface_readback(&rb); - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(SUCCEEDED(hr), "Present failed, hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetTexture(device, 0, NULL); + ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); + IDirect3DTexture9_Release(texture); + winetest_pop_context(); } - IDirect3DPixelShader9_Release(ps); + for (unsigned int p = 0; p < 3; ++p) + IDirect3DPixelShader9_Release(ps[p]); IDirect3DSurface9_Release(original_ds); IDirect3DSurface9_Release(original_rt); IDirect3DSurface9_Release(rt); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10023
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/d3d8/tests/visual.c | 97 +++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 4f4273a8159..310a16cb153 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -4148,12 +4148,12 @@ static void shadow_test(void) IDirect3D8 *d3d; ULONG refcount; D3DCAPS8 caps; + DWORD ps[3]; HWND window; HRESULT hr; - DWORD ps; UINT i; - static const DWORD ps_code[] = + static const DWORD ps1_code[] = { 0xffff0101, /* ps_1_1 */ 0x00000051, 0xa00f0000, 0x3f800000, 0x00000000, 0x3f800000, 0x3f800000, /* def c0, 1.0, 0.0, 1.0, 1.0 */ @@ -4164,6 +4164,14 @@ static void shadow_test(void) 0x00000004, 0x800f0000, 0xa0e40001, 0xb0e40001, 0xb0e40000, /* mad r0, c1, t1, t0 */ 0x0000ffff, /* end */ }; + + static const DWORD ps14_code[] = + { + 0xffff0104, /* ps_1_4 */ + 0x00000042, 0x800f0000, 0xb0e40000, /* texld r0, t0 */ + 0x0000ffff, /* end */ + }; + static const struct { D3DFORMAT format; @@ -4194,18 +4202,18 @@ static void shadow_test(void) }; static const struct { - unsigned int x, y, color; + unsigned int x, y, color, ps1_color; } expected_colors[] = { - {400, 60, 0x00000000}, - {560, 180, 0xffff00ff}, - {560, 300, 0xffff00ff}, - {400, 420, 0xffffffff}, - {240, 420, 0xffffffff}, - { 80, 300, 0x00000000}, - { 80, 180, 0x00000000}, - {240, 60, 0x00000000}, + {400, 60, 0x00000000, 0x00000000}, + {560, 180, 0xffffffff, 0xffff00ff}, + {560, 300, 0xffffffff, 0xffff00ff}, + {400, 420, 0xffffffff, 0xffffffff}, + {240, 420, 0xffffffff, 0xffffffff}, + { 80, 300, 0x00000000, 0x00000000}, + { 80, 180, 0x00000000, 0x00000000}, + {240, 60, 0x00000000, 0x00000000}, }; window = create_window(); @@ -4232,8 +4240,11 @@ static void shadow_test(void) hr = IDirect3DDevice8_CreateRenderTarget(device, 1024, 1024, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, FALSE, &rt); ok(SUCCEEDED(hr), "CreateRenderTarget failed, hr %#lx.\n", hr); - hr = IDirect3DDevice8_CreatePixelShader(device, ps_code, &ps); + hr = IDirect3DDevice8_CreatePixelShader(device, ps1_code, &ps[0]); ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#lx.\n", hr); + hr = IDirect3DDevice8_CreatePixelShader(device, ps14_code, &ps[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed, hr %#lx.\n", hr); + ps[2] = 0; hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX2 | D3DFVF_TEXCOORDSIZE3(0) | D3DFVF_TEXCOORDSIZE4(1)); @@ -4314,44 +4325,48 @@ static void shadow_test(void) hr = IDirect3DDevice8_SetTexture(device, 1, (IDirect3DBaseTexture8 *)texture); ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); - hr = IDirect3DDevice8_SetPixelShader(device, ps); - ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#lx.\n", hr); + for (unsigned int p = 0; p < 3; ++p) + { + winetest_push_context("ps %u", p); - /* Do the actual shadow mapping. */ - hr = IDirect3DDevice8_BeginScene(device); - ok(SUCCEEDED(hr), "BeginScene failed, hr %#lx.\n", hr); - hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); - ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#lx.\n", hr); - hr = IDirect3DDevice8_EndScene(device); - ok(SUCCEEDED(hr), "EndScene failed, hr %#lx.\n", hr); + hr = IDirect3DDevice8_SetPixelShader(device, ps[p]); + ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#lx.\n", hr); + + /* Do the actual shadow mapping. */ + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed, hr %#lx.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed, hr %#lx.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed, hr %#lx.\n", hr); + + get_surface_readback(original_rt, &rb); + for (j = 0; j < ARRAY_SIZE(expected_colors); ++j) + { + unsigned int color = get_readback_color(&rb, expected_colors[j].x, expected_colors[j].y); + unsigned int expect = (p == 0 ? expected_colors[j].ps1_color : expected_colors[j].color); + + /* Geforce 7 on Windows returns 1.0 in alpha when the depth format is D24S8 or D24X8, + * whereas other GPUs (all AMD, newer Nvidia) return the same value they return in .rgb. + * Accept alpha mismatches as broken but make sure to check the color channels. */ + todo_wine_if (p == 2) ok(color_match(color, expect, 0) + || broken(color_match(color & 0x00ffffff, expect & 0x00ffffff, 0)), + "Expected color 0x%08x at (%u, %u), got 0x%08x.\n", + expect, expected_colors[j].x, expected_colors[j].y, color); + } + release_surface_readback(&rb); + + winetest_pop_context(); + } hr = IDirect3DDevice8_SetTexture(device, 0, NULL); ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); hr = IDirect3DDevice8_SetTexture(device, 1, NULL); ok(SUCCEEDED(hr), "SetTexture failed, hr %#lx.\n", hr); IDirect3DTexture8_Release(texture); - - get_surface_readback(original_rt, &rb); - for (j = 0; j < ARRAY_SIZE(expected_colors); ++j) - { - unsigned int color = get_readback_color(&rb, expected_colors[j].x, expected_colors[j].y); - /* Geforce 7 on Windows returns 1.0 in alpha when the depth format is D24S8 or D24X8, - * whereas other GPUs (all AMD, newer Nvidia) return the same value they return in .rgb. - * Accept alpha mismatches as broken but make sure to check the color channels. */ - ok(color_match(color, expected_colors[j].color, 0) - || broken(color_match(color & 0x00ffffff, expected_colors[j].color & 0x00ffffff, 0)), - "Expected color 0x%08x at (%u, %u) for format %s, got 0x%08x.\n", - expected_colors[j].color, expected_colors[j].x, expected_colors[j].y, - formats[i].name, color); - } - release_surface_readback(&rb); - - hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); - ok(SUCCEEDED(hr), "Present failed, hr %#lx.\n", hr); + winetest_pop_context(); } - hr = IDirect3DDevice8_DeletePixelShader(device, ps); - ok(SUCCEEDED(hr), "DeletePixelShader failed, hr %#lx.\n", hr); IDirect3DSurface8_Release(original_rt); IDirect3DSurface8_Release(rt); refcount = IDirect3DDevice8_Release(device); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10023
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/wined3d/shader_spirv.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index 9d3dc2b2650..42f8307432f 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -104,6 +104,7 @@ struct wined3d_shader_spirv_compile_args struct vkd3d_shader_varying_map_info varying_map; struct vkd3d_shader_spirv_target_info spirv_target; struct vkd3d_shader_parameter_info parameter_info; + struct vkd3d_shader_d3dbc_source_info d3dbc_info; enum vkd3d_shader_spirv_extension extensions[1]; struct vkd3d_shader_parameter1 parameters[12]; unsigned int ps_alpha_swizzle[WINED3D_MAX_RENDER_TARGETS]; @@ -258,7 +259,10 @@ static void shader_spirv_init_compile_args(const struct wined3d_vk_info *vk_info args->spirv_target.environment = environment; args->parameter_info.type = VKD3D_SHADER_STRUCTURE_TYPE_PARAMETER_INFO; - args->parameter_info.next = vkd3d_interface; + args->parameter_info.next = &args->d3dbc_info; + + args->d3dbc_info.type = VKD3D_SHADER_STRUCTURE_TYPE_D3DBC_SOURCE_INFO; + args->d3dbc_info.next = vkd3d_interface; args->spirv_target.extensions = args->extensions; @@ -284,6 +288,21 @@ static void shader_spirv_init_compile_args(const struct wined3d_vk_info *vk_info args->spirv_target.output_swizzles = args->ps_alpha_swizzle; args->spirv_target.output_swizzle_count = ARRAY_SIZE(args->ps_alpha_swizzle); + + for (i = 0; i < ARRAY_SIZE(args->d3dbc_info.texture_dimensions); ++i) + { + enum wined3d_shader_tex_types type = (compile_args->u.fs.args.tex_types + >> (i * WINED3D_PSARGS_TEXTYPE_SHIFT)) & WINED3D_PSARGS_TEXTYPE_MASK; + + if (type == WINED3D_SHADER_TEX_3D) + args->d3dbc_info.texture_dimensions[i] = VKD3D_SHADER_RESOURCE_TEXTURE_3D; + else if (type == WINED3D_SHADER_TEX_CUBE) + args->d3dbc_info.texture_dimensions[i] = VKD3D_SHADER_RESOURCE_TEXTURE_CUBE; + else + args->d3dbc_info.texture_dimensions[i] = VKD3D_SHADER_RESOURCE_TEXTURE_2D; + } + + args->d3dbc_info.shadow_samplers = compile_args->u.fs.args.shadow; } else if (shader_type == WINED3D_SHADER_TYPE_VERTEX) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10023
participants (2)
-
Elizabeth Figura -
Elizabeth Figura (@zfigura)