diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 66af48c7da..18e8f8708a 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -3219,7 +3219,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 ce2e82325f..8891ce23a2 100644 --- a/runtime/test/d3d12_bindless_churn_test.cpp +++ b/runtime/test/d3d12_bindless_churn_test.cpp @@ -395,6 +395,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 c2ea4fb37a..60e72fb32b 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 e1dcef0fdb..fa6a720bc0 100644 --- a/runtime/test/d3d12_compute_test.cpp +++ b/runtime/test/d3d12_compute_test.cpp @@ -264,6 +264,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 9ff50b059d..63082eb718 100644 --- a/runtime/test/d3d12_depth24_draw_test.cpp +++ b/runtime/test/d3d12_depth24_draw_test.cpp @@ -214,6 +214,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 35d4259fe7..92b8e47f8c 100644 --- a/runtime/test/d3d12_depth_resolve_test.cpp +++ b/runtime/test/d3d12_depth_resolve_test.cpp @@ -325,6 +325,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 39a4961f82..16eba81669 100644 --- a/runtime/test/d3d12_execute_indirect_validation_test.cpp +++ b/runtime/test/d3d12_execute_indirect_validation_test.cpp @@ -345,6 +345,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 bbd516e5c5..d6ba0263c0 100644 --- a/runtime/test/d3d12_f16_halves_test.cpp +++ b/runtime/test/d3d12_f16_halves_test.cpp @@ -180,6 +180,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 c5aea7fd59..7c6ca8e8b4 100644 --- a/runtime/test/d3d12_first_light_test.cpp +++ b/runtime/test/d3d12_first_light_test.cpp @@ -136,6 +136,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; + } // No root parameters: the VS applies no matrix and the PS has no bindings (vk_harness pushes zeros too). D3D12_VERSIONED_ROOT_SIGNATURE_DESC root_desc{}; diff --git a/runtime/test/d3d12_geometry_test.cpp b/runtime/test/d3d12_geometry_test.cpp index 1cfe035b76..19bc9a5c8a 100644 --- a/runtime/test/d3d12_geometry_test.cpp +++ b/runtime/test/d3d12_geometry_test.cpp @@ -43,6 +43,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 f53502b5d7..b5b51a53dc 100644 --- a/runtime/test/d3d12_indirect_dispatch_count_test.cpp +++ b/runtime/test/d3d12_indirect_dispatch_count_test.cpp @@ -221,6 +221,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 bb8186fe55..bb6b027fc4 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 97a4e8600f..7a70e7362d 100644 --- a/runtime/test/d3d12_m4_compute_test.cpp +++ b/runtime/test/d3d12_m4_compute_test.cpp @@ -102,6 +102,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_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 2d9bc5212e..3d29a5e5fd 100644 --- a/runtime/test/d3d12_mesh_test.cpp +++ b/runtime/test/d3d12_mesh_test.cpp @@ -111,6 +111,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 a05b713afd..d8ddb69232 100644 --- a/runtime/test/d3d12_multi_viewport_test.cpp +++ b/runtime/test/d3d12_multi_viewport_test.cpp @@ -360,6 +360,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 2c237910bf..c78a05b714 100644 --- a/runtime/test/d3d12_state_sweep_test.cpp +++ b/runtime/test/d3d12_state_sweep_test.cpp @@ -574,6 +574,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 afc00cce2f..1a2d7319b5 100644 --- a/runtime/test/d3d12_stores_atomics_test.cpp +++ b/runtime/test/d3d12_stores_atomics_test.cpp @@ -155,6 +155,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 5601102409..c4e6843ed7 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 fd63fca665..b4918ff518 100644 --- a/runtime/test/vk_test_device.h +++ b/runtime/test/vk_test_device.h @@ -146,6 +146,8 @@ class Device { bool null_descriptor = false; // VK_EXT_robustness2 and nullDescriptor are enabled // 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; @@ -190,6 +192,18 @@ class Device { unsigned validation_errors() const { return validation_error_count(); } unsigned known_validation_errors() const { return known_validation_error_count(); } + // 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; } @@ -363,6 +377,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,