diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 765b2611a6..932eb5a627 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -4019,7 +4019,8 @@ if(TARGET Vulkan::Headers) add_test(NAME xbox_derived_mask_zero COMMAND d3d12_translated_draw_test --derived-zero) add_test(NAME xbox_derived_mask_restore COMMAND d3d12_translated_draw_test --derived-restore) - set_tests_properties(d3d12_translated_draw PROPERTIES SKIP_RETURN_CODE 77) + set_tests_properties(d3d12_translated_draw xbox_native_base_draw xbox_derived_mask_zero xbox_derived_mask_restore + PROPERTIES SKIP_RETURN_CODE 77) # Dual-source blending (RT-DUAL-SOURCE-BLEND): with lazy pipelines (the default) and built at creation. add_test(NAME d3d12_dual_source_draw COMMAND d3d12_translated_draw_test --dual-source) add_test(NAME d3d12_dual_source_draw_eager COMMAND d3d12_translated_draw_test --dual-source) diff --git a/runtime/test/d3d12_bindless_churn_test.cpp b/runtime/test/d3d12_bindless_churn_test.cpp index 5dc59bc9ae..71552090ab 100644 --- a/runtime/test/d3d12_bindless_churn_test.cpp +++ b/runtime/test/d3d12_bindless_churn_test.cpp @@ -396,6 +396,7 @@ int main(int argc, char** argv) { return 77; } if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_bindless_churn_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_buffer_uav_test.cpp b/runtime/test/d3d12_buffer_uav_test.cpp index 985a2f7b2a..93fb899f94 100644 --- a/runtime/test/d3d12_buffer_uav_test.cpp +++ b/runtime/test/d3d12_buffer_uav_test.cpp @@ -604,6 +604,7 @@ int main() { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_buffer_uav_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_bundle_test.cpp b/runtime/test/d3d12_bundle_test.cpp index 6e6be231c9..2b2c6a4a57 100644 --- a/runtime/test/d3d12_bundle_test.cpp +++ b/runtime/test/d3d12_bundle_test.cpp @@ -932,6 +932,7 @@ int main(int argc, char** argv) { return 77; } REQUIRE(device_status == vktest::DeviceStatus::ready); + if (vk.below_shader_push_constant_contract("d3d12_bundle_test")) return 77; if (layer_indirect && (!vk.enabled.drawIndirectFirstInstance || !vk.robust_index_view)) { std::fprintf(stderr, "SKIP: bundle draw pair requires drawIndirectFirstInstance and a bounded robust index view\n"); return 77; diff --git a/runtime/test/d3d12_compute_test.cpp b/runtime/test/d3d12_compute_test.cpp index 05591a780a..9d77f06ca0 100644 --- a/runtime/test/d3d12_compute_test.cpp +++ b/runtime/test/d3d12_compute_test.cpp @@ -254,6 +254,7 @@ int main() { return 77; } EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_compute_test")) return 77; // The shader program the PSO carries, and a translator index that maps its hash to the test module. constexpr std::uint32_t code_word = 5000; diff --git a/runtime/test/d3d12_depth24_draw_test.cpp b/runtime/test/d3d12_depth24_draw_test.cpp index 5512304e67..cb237d2908 100644 --- a/runtime/test/d3d12_depth24_draw_test.cpp +++ b/runtime/test/d3d12_depth24_draw_test.cpp @@ -215,6 +215,7 @@ int main() { return 77; } EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_depth24_draw_test")) return 77; bool native = true; { const auto props = reinterpret_cast( diff --git a/runtime/test/d3d12_depth_resolve_test.cpp b/runtime/test/d3d12_depth_resolve_test.cpp index 0fc11ff6ba..3a9ff636d2 100644 --- a/runtime/test/d3d12_depth_resolve_test.cpp +++ b/runtime/test/d3d12_depth_resolve_test.cpp @@ -326,6 +326,7 @@ int main() { const auto device_status = vk.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (vk.below_shader_push_constant_contract("d3d12_depth_resolve_test")) return 77; const unsigned errors_before = vk.validation_errors(); VkPhysicalDeviceDepthStencilResolveProperties resolve{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES}; VkPhysicalDeviceProperties2 properties{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, &resolve}; diff --git a/runtime/test/d3d12_draw_test.cpp b/runtime/test/d3d12_draw_test.cpp index ffbfbf718d..54bd63178f 100644 --- a/runtime/test/d3d12_draw_test.cpp +++ b/runtime/test/d3d12_draw_test.cpp @@ -104,6 +104,7 @@ int main(int argc, char** argv) { return 77; } EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_draw_test")) return 77; if (indirect_pixels && !d.enabled.drawIndirectFirstInstance) { std::fprintf(stderr, "SKIP: drawIndirectFirstInstance is unavailable\n"); return 77; diff --git a/runtime/test/d3d12_execute_indirect_validation_test.cpp b/runtime/test/d3d12_execute_indirect_validation_test.cpp index ed8cfac5b2..665aee4b1b 100644 --- a/runtime/test/d3d12_execute_indirect_validation_test.cpp +++ b/runtime/test/d3d12_execute_indirect_validation_test.cpp @@ -346,6 +346,7 @@ int main() { return 77; } REQUIRE(status == vktest::DeviceStatus::ready); + if (vk.below_shader_push_constant_contract("d3d12_execute_indirect_validation_test")) return 77; const unsigned errors_before = vk.validation_errors(); // Write minimal synthetic compute shader fixture for positive ExecuteIndirect dispatch. diff --git a/runtime/test/d3d12_f16_halves_test.cpp b/runtime/test/d3d12_f16_halves_test.cpp index 82e8c140ea..1e02e419fd 100644 --- a/runtime/test/d3d12_f16_halves_test.cpp +++ b/runtime/test/d3d12_f16_halves_test.cpp @@ -236,6 +236,7 @@ int main() { return 77; } EXPECT(status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_f16_halves_test")) return 77; const auto vs_prog = fssm_program({0x56530378, 0xbf810000}); const auto ps1_prog = fssm_program({0x50530378, 0x00000001}); diff --git a/runtime/test/d3d12_first_light_test.cpp b/runtime/test/d3d12_first_light_test.cpp index 3d1916e0bf..814b074128 100644 --- a/runtime/test/d3d12_first_light_test.cpp +++ b/runtime/test/d3d12_first_light_test.cpp @@ -176,6 +176,11 @@ int main() { EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device), reinterpret_cast(&device.p), /*console_lists=*/false))); rt::d3d12::set_device_outer(inner, device.p); + if (rt::d3d12::device_push_constants_need_fallback(inner)) { + std::printf("d3d12_first_light_test: skipped, the PSOs need 144 push-constant bytes and this GPU has %u\n", + rt::d3d12::device_max_push_constants_size(inner)); + return 77; + } // Graphics arguments start at s8. The camera VS reads the table from s9, with its CBVs // at byte offsets 0x20 and 0x60. The passthrough VS uses an empty root signature. diff --git a/runtime/test/d3d12_geometry_test.cpp b/runtime/test/d3d12_geometry_test.cpp index 36e197aff4..2e2761e76b 100644 --- a/runtime/test/d3d12_geometry_test.cpp +++ b/runtime/test/d3d12_geometry_test.cpp @@ -44,6 +44,7 @@ int main() { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU (hosted CI): ctest skips EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_geometry_test")) return 77; if (!d.enabled.geometryShader) { std::printf("SKIP: no geometryShader on this GPU\n"); return 77; // ctest's SKIP_RETURN_CODE diff --git a/runtime/test/d3d12_indirect_dispatch_count_test.cpp b/runtime/test/d3d12_indirect_dispatch_count_test.cpp index 1d87a5d451..975277741e 100644 --- a/runtime/test/d3d12_indirect_dispatch_count_test.cpp +++ b/runtime/test/d3d12_indirect_dispatch_count_test.cpp @@ -426,6 +426,7 @@ int main(int argc, char** argv) { if (status == vktest::DeviceStatus::unavailable) return 77; if (status != vktest::DeviceStatus::ready) return 1; if (!vk.buffer_device_address) return 77; + if (vk.below_shader_push_constant_contract("d3d12_indirect_dispatch_count_test")) return 77; std::vector program = fssm_program({0x1100u, 0x44u, 0x55u, 0x66u, 0x77u, 0x88u}); for (UINT i = 0; i < 12; ++i) put32(program, 0xbf810000 + i); const auto container = shader_container(program); diff --git a/runtime/test/d3d12_m2_formats_test.cpp b/runtime/test/d3d12_m2_formats_test.cpp index a9481b29ce..a2fddfc9da 100644 --- a/runtime/test/d3d12_m2_formats_test.cpp +++ b/runtime/test/d3d12_m2_formats_test.cpp @@ -157,6 +157,7 @@ int main() { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_m2_formats_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_m2_textured_test.cpp b/runtime/test/d3d12_m2_textured_test.cpp index 7148eff2c5..b200f0ccb3 100644 --- a/runtime/test/d3d12_m2_textured_test.cpp +++ b/runtime/test/d3d12_m2_textured_test.cpp @@ -119,6 +119,7 @@ int main(int argc, char** argv) { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_m2_textured_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_m3_frame_test.cpp b/runtime/test/d3d12_m3_frame_test.cpp index d7cf8e8f34..59fb70dcfd 100644 --- a/runtime/test/d3d12_m3_frame_test.cpp +++ b/runtime/test/d3d12_m3_frame_test.cpp @@ -137,6 +137,7 @@ int main(int argc, char** argv) { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_m3_frame_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_m4_compute_test.cpp b/runtime/test/d3d12_m4_compute_test.cpp index da5eea7bea..f7776978e1 100644 --- a/runtime/test/d3d12_m4_compute_test.cpp +++ b/runtime/test/d3d12_m4_compute_test.cpp @@ -117,6 +117,7 @@ int main(int argc, char** argv) { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_m4_compute_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_mesh_test.cpp b/runtime/test/d3d12_mesh_test.cpp index 1628a0ce42..0c7f361e46 100644 --- a/runtime/test/d3d12_mesh_test.cpp +++ b/runtime/test/d3d12_mesh_test.cpp @@ -116,6 +116,7 @@ int main(int argc, char** argv) { return 77; } EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_mesh_test")) return 77; const auto ms_program = fssm_program({0x4d530001, 0xbf810000}); // The same mesh shader listed without "root_window": one translated before the graphics root window (D3D-448). diff --git a/runtime/test/d3d12_multi_viewport_test.cpp b/runtime/test/d3d12_multi_viewport_test.cpp index 683578cb4f..0b22748c9f 100644 --- a/runtime/test/d3d12_multi_viewport_test.cpp +++ b/runtime/test/d3d12_multi_viewport_test.cpp @@ -361,6 +361,7 @@ int main() { std::printf("GPU lacks multiViewport or shaderOutputViewportIndex; skipping\n"); return 77; } + if (vk.below_shader_push_constant_contract("d3d12_multi_viewport_test")) return 77; const auto vs_program = d3d12test::fssm_program({0x56534d56u, 0xbf810000u}); const auto ps_program = d3d12test::fssm_program({0x50534d56u, 0xbf810000u}); diff --git a/runtime/test/d3d12_pso_validation_test.cpp b/runtime/test/d3d12_pso_validation_test.cpp index 89bee7bd26..b8bcace214 100644 --- a/runtime/test/d3d12_pso_validation_test.cpp +++ b/runtime/test/d3d12_pso_validation_test.cpp @@ -71,6 +71,7 @@ int main() { return 77; } EXPECT(status == vktest::DeviceStatus::ready); + if (vk_dev.below_shader_push_constant_contract("d3d12_pso_validation_test")) return 77; // Prepare translated shader library for our Vulkan-backed D3D12 device. const auto vs_pos_prog = fssm_program({0x56531001, 0xbf810000}); diff --git a/runtime/test/d3d12_state_sweep_test.cpp b/runtime/test/d3d12_state_sweep_test.cpp index 0d89d43d55..9c464a4f3e 100644 --- a/runtime/test/d3d12_state_sweep_test.cpp +++ b/runtime/test/d3d12_state_sweep_test.cpp @@ -589,6 +589,13 @@ int main() { Ref ours, host; std::string adapter; if (FAILED(rt::d3d12::create_vulkan_device(info, IID_PPV_ARGS(&ours.p)))) return 1; + // Every case's PSO needs the 144 push-constant bytes the index declares; on a smaller limit they all fail and + // each would count as a per-case skip, leaving a silent pass that compared nothing. + if (rt::d3d12::device_push_constants_need_fallback(ours.p)) { + std::printf("d3d12_state_sweep_test: skipped, the PSOs need 144 push-constant bytes and this GPU has %u\n", + rt::d3d12::device_max_push_constants_size(ours.p)); + return 77; + } if (!host_device(vk, host, adapter)) { std::fprintf(stderr, "no host D3D12 device on the Vulkan device's adapter\n"); return 77; diff --git a/runtime/test/d3d12_stores_atomics_test.cpp b/runtime/test/d3d12_stores_atomics_test.cpp index 967f162374..1703c98cee 100644 --- a/runtime/test/d3d12_stores_atomics_test.cpp +++ b/runtime/test/d3d12_stores_atomics_test.cpp @@ -156,6 +156,7 @@ int main() { return 77; } EXPECT(status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_stores_atomics_test")) return 77; if (!d.bindless) { std::printf("SKIP: the device lacks the descriptor indexing features of the bindless set 0\n"); return 77; diff --git a/runtime/test/d3d12_subgroup_test.cpp b/runtime/test/d3d12_subgroup_test.cpp index 7bd99d436d..089638c124 100644 --- a/runtime/test/d3d12_subgroup_test.cpp +++ b/runtime/test/d3d12_subgroup_test.cpp @@ -541,6 +541,7 @@ int main() { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips if (device_status != vktest::DeviceStatus::ready) return 1; + if (d.below_shader_push_constant_contract("d3d12_subgroup_test")) return 77; const leonida::SubgroupSizeCaps& caps = d.subgroup; leonida::SubgroupSizeCaps off = caps; // the control: the layer knows nothing of the device's sizes off.min_size = off.max_size = off.default_size = 0; diff --git a/runtime/test/d3d12_translated_draw_test.cpp b/runtime/test/d3d12_translated_draw_test.cpp index b45cc2c841..a8f2e4071d 100644 --- a/runtime/test/d3d12_translated_draw_test.cpp +++ b/runtime/test/d3d12_translated_draw_test.cpp @@ -131,6 +131,7 @@ int main(int argc, char** argv) { const auto device_status = d.initialize(); if (device_status == vktest::DeviceStatus::unavailable) return 77; // no Vulkan GPU: ctest skips EXPECT(device_status == vktest::DeviceStatus::ready); + if (d.below_shader_push_constant_contract("d3d12_translated_draw_test")) return 77; if (dual && !d.enabled.dualSrcBlend) return 77; // a device without dual-source blending: ctest skips // The translator-style library the build wrote, and the FSSM programs its index entries are keyed by. diff --git a/runtime/test/d3d12_typeless_families_test.cpp b/runtime/test/d3d12_typeless_families_test.cpp index 134edde100..ee091b82d8 100644 --- a/runtime/test/d3d12_typeless_families_test.cpp +++ b/runtime/test/d3d12_typeless_families_test.cpp @@ -243,6 +243,7 @@ int main() { if (status == vktest::DeviceStatus::unavailable) return 77; if (status != vktest::DeviceStatus::ready) return 1; if (hostwine::host_is_wine()) return 77; // the host D3D12 runtime is the reference + if (vk.below_shader_push_constant_contract("d3d12_typeless_families_test")) return 77; rt::d3d12::VulkanDeviceInfo info{}; info.get_instance_proc = vk.instance_proc; info.instance = vk.instance; diff --git a/runtime/test/vk_test_device.h b/runtime/test/vk_test_device.h index ef75b76221..93ed78e13e 100644 --- a/runtime/test/vk_test_device.h +++ b/runtime/test/vk_test_device.h @@ -157,6 +157,8 @@ class Device { bool r64ui_transfer_dst = false; // VK_FORMAT_R64_UINT supports optimal TRANSFER_DST_BIT (1x1 fallback) // VK_EXT_external_memory_host is enabled when non-zero: its minImportedHostPointerAlignment. VkDeviceSize host_pointer_alignment = 0; + // The chosen device's maxPushConstantsSize, known after initialize(); 0 before it. + std::uint32_t max_push_constants_size = 0; Device() = default; Device(const Device&) = delete; @@ -202,6 +204,18 @@ class Device { unsigned known_validation_errors() const { return known_validation_error_count(); } bool pipeline_cache_control_enabled() const { return v13_.core && v13_.pipeline_creation_cache_control; } + // The translated shaders' push-constant block is 144 bytes (ShaderUserData in src/vulkan_replay.h). A device + // below that cannot run a module built to the contract: the D3D12 layer refuses every pipeline with E_NOTIMPL + // (PipelineState::push_constants_fit; the uniform-buffer tail of #224 is not built), so a test that builds + // PSOs cannot pass there. Prints the skip line naming `test` and returns true below the contract size, the + // same condition rt::d3d12::device_push_constants_need_fallback reports on the created device. + bool below_shader_push_constant_contract(const char* test) const { + if (!physical || max_push_constants_size >= 144) return false; + std::printf("%s: skipped, the shaders' push-constant block needs 144 bytes and this GPU has %u\n", test, + max_push_constants_size); + return true; + } + // presentation: also enable VK_KHR_surface + VK_KHR_win32_surface and VK_KHR_swapchain (Windows only). bool create(bool presentation = false) { return initialize(presentation) == DeviceStatus::ready; } @@ -375,6 +389,7 @@ class Device { } std::printf("device: %s%s%s\n", chosen.deviceName, v13_.core ? "" : " (Vulkan 1.2 + KHR extensions)", validation ? " (validation on)" : ""); + max_push_constants_size = chosen.limits.maxPushConstantsSize; VkPhysicalDeviceVulkan13Features features13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; VkPhysicalDeviceVulkan11Features features11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES,