-- v5: tests: Mark some sampling tests as buggy on MoltenVK.
From: Giovanni Mascellani gmascellani@codeweavers.com
This fixes a crash on MoltenVK. --- libs/vkd3d/resource.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 609c67102..356c2f099 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -3444,6 +3444,7 @@ static void vkd3d_create_null_uav(struct d3d12_desc *descriptor, vkd3d_desc.miplevel_count = 1; vkd3d_desc.layer_idx = 0; vkd3d_desc.layer_count = 1; + vkd3d_desc.vk_image_aspect = VK_IMAGE_ASPECT_COLOR_BIT; vkd3d_desc.components.r = VK_COMPONENT_SWIZZLE_R; vkd3d_desc.components.g = VK_COMPONENT_SWIZZLE_G; vkd3d_desc.components.b = VK_COMPONENT_SWIZZLE_B;
From: Giovanni Mascellani gmascellani@codeweavers.com
This fixes a failure in MoltenVK. --- tests/d3d12.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 1126d9749..3324eef80 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -35376,7 +35376,7 @@ static void test_bufinfo_instruction(void)
memset(&desc, 0, sizeof(desc)); desc.rt_width = desc.rt_height = 64; - desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT; + desc.rt_format = DXGI_FORMAT_R32G32B32A32_UINT; desc.no_root_signature = true; desc.no_pipeline = true; if (!init_test_context(&context, &desc))
From: Giovanni Mascellani gmascellani@codeweavers.com
Bit field instructions in SPIR-V do not specify what happens when offset + count exceeds the type bit width. After this commit we refine the emitted code's behavior to match TPF.
This fixes a few failures on MoltenVK. --- libs/vkd3d-shader/spirv.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 45f46a91c..0e961293c 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1764,6 +1764,15 @@ static uint32_t vkd3d_spirv_build_op_glsl_std450_max(struct vkd3d_spirv_builder GLSLstd450NMax, operands, ARRAY_SIZE(operands)); }
+static uint32_t vkd3d_spirv_build_op_glsl_std450_umin(struct vkd3d_spirv_builder *builder, + uint32_t result_type, uint32_t x, uint32_t y) +{ + uint32_t glsl_std450_id = vkd3d_spirv_get_glsl_std450_instr_set(builder); + uint32_t operands[] = {x, y}; + return vkd3d_spirv_build_op_ext_inst(builder, result_type, glsl_std450_id, + GLSLstd450UMin, operands, ARRAY_SIZE(operands)); +} + static uint32_t vkd3d_spirv_build_op_glsl_std450_nclamp(struct vkd3d_spirv_builder *builder, uint32_t result_type, uint32_t x, uint32_t min, uint32_t max) { @@ -7321,7 +7330,7 @@ static void spirv_compiler_emit_ftou(struct spirv_compiler *compiler, static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { - uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id; + uint32_t src_ids[4], constituents[VKD3D_VEC4_SIZE], type_id, mask_id, size_id, max_count_id; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; const struct vkd3d_shader_dst_param *dst = instruction->dst; const struct vkd3d_shader_src_param *src = instruction->src; @@ -7336,6 +7345,7 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp component_type = vkd3d_component_type_from_data_type(dst->reg.data_type); type_id = vkd3d_spirv_get_type_id(builder, component_type, 1); mask_id = spirv_compiler_get_constant_uint(compiler, 0x1f); + size_id = spirv_compiler_get_constant_uint(compiler, 0x20);
switch (instruction->handler_idx) { @@ -7364,6 +7374,9 @@ static void spirv_compiler_emit_bitfield_instruction(struct spirv_compiler *comp { src_ids[j] = vkd3d_spirv_build_op_and(builder, type_id, src_ids[j], mask_id); } + max_count_id = vkd3d_spirv_build_op_isub(builder, type_id, size_id, src_ids[src_count - 2]); + src_ids[src_count - 1] = vkd3d_spirv_build_op_glsl_std450_umin(builder, type_id, + src_ids[src_count - 1], max_count_id);
constituents[k++] = vkd3d_spirv_build_op_trv(builder, &builder->function_stream, op, type_id, src_ids, src_count);
From: Giovanni Mascellani gmascellani@codeweavers.com
Apparently Metal doesn't support specifying a bias directly in the sampler, and, with "nearest" mip filtering, it doesn't switch precisely at LOD 0.5 (though still between 0.5 and 0.6). --- tests/d3d12.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 3324eef80..35dbc755f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -13908,6 +13908,7 @@ static void test_sample_instructions(void) float max_lod; float ps_constants[4]; const unsigned int *expected_data; + bool bug_on_mvk; } tests[] = { @@ -13919,7 +13920,7 @@ static void test_sample_instructions(void) {&ps_sample_b, &r8g8b8a8_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.0f}, r8g8b8a8_data}, {&ps_sample_b, &a8_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.0f}, a8_expected_data}, {&ps_sample_b, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.0f}, rgba_level_0}, - {&ps_sample_b, &rgba_texture, POINT, 8.0f, 0.0f, MIP_MAX, {0.0f}, level_1_colors}, + {&ps_sample_b, &rgba_texture, POINT, 8.0f, 0.0f, MIP_MAX, {0.0f}, level_1_colors, true}, {&ps_sample_b, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {8.0f}, level_1_colors}, {&ps_sample_b, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {8.4f}, level_1_colors}, {&ps_sample_b, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {8.5f}, level_2_colors}, @@ -13937,19 +13938,21 @@ static void test_sample_instructions(void) {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {-1.0f}, rgba_level_0}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.0f}, rgba_level_0}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.4f}, rgba_level_0}, - {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.5f}, level_1_colors}, + {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.5f}, level_1_colors, true}, + {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {0.6f}, level_1_colors}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {1.0f}, level_1_colors}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {1.4f}, level_1_colors}, - {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {1.5f}, level_2_colors}, + {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {1.5f}, level_2_colors, true}, + {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {1.6f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {2.0f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {3.0f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT, 0.0f, 0.0f, MIP_MAX, {4.0f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT_LINEAR, 0.0f, 0.0f, MIP_MAX, {1.5f}, lerp_1_2_colors}, {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {-2.0f}, rgba_level_0}, - {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {-1.0f}, level_1_colors}, - {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {0.0f}, level_2_colors}, - {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {1.0f}, level_2_colors}, - {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {1.5f}, level_2_colors}, + {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {-1.0f}, level_1_colors, true}, + {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {0.0f}, level_2_colors, true}, + {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {1.0f}, level_2_colors, true}, + {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 0.0f, MIP_MAX, {1.5f}, level_2_colors, true}, {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 2.0f, 2.0f, {-9.0f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 2.0f, 2.0f, {-1.0f}, level_2_colors}, {&ps_sample_l, &rgba_texture, POINT_LINEAR, 2.0f, 2.0f, 2.0f, {0.0f}, level_2_colors}, @@ -14015,6 +14018,9 @@ static void test_sample_instructions(void)
for (i = 0; i < ARRAY_SIZE(tests); ++i) { + unsigned int color; + bool fail = false; + vkd3d_test_push_context("Test %u", i);
memset(&sampler_desc, 0, sizeof(sampler_desc)); @@ -14070,12 +14076,20 @@ static void test_sample_instructions(void) { for (x = 0; x < tests[i].texture->width; ++x) { - unsigned int color = get_readback_uint(&rb.rb, x * x_step + x_step / 2, y * y_step + y_step / 2, 0); - ok(compare_color(color, tests[i].expected_data[tests[i].texture->width * y + x], 1), - "Got color 0x%08x, expected 0x%08x at (%u, %u).\n", - color, tests[i].expected_data[tests[i].texture->width * y + x], x, y); + color = get_readback_uint(&rb.rb, x * x_step + x_step / 2, y * y_step + y_step / 2, 0); + if (!compare_color(color, tests[i].expected_data[tests[i].texture->width * y + x], 1)) + { + fail = true; + break; + } } + + if (fail) + break; } + bug_if(tests[i].bug_on_mvk && is_mvk_device(device)) + ok(!fail, "Got color 0x%08x, expected 0x%08x at (%u, %u).\n", + color, tests[i].expected_data[tests[i].texture->width * y + x], x, y); release_resource_readback(&rb);
ID3D12Resource_Release(texture);