Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_bindless_churn_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_buffer_uav_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_bundle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_compute_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_depth24_draw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PFN_vkGetPhysicalDeviceFormatProperties>(
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_depth_resolve_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_draw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_execute_indirect_validation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_f16_halves_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
5 changes: 5 additions & 0 deletions runtime/test/d3d12_first_light_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ int main() {
EXPECT(SUCCEEDED(rt::d3d12_xs::create_device_proxy(inner, __uuidof(ID3D12Device),
reinterpret_cast<void**>(&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{};
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_geometry_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_indirect_dispatch_count_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint8_t> 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);
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_m2_formats_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_m2_textured_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_m3_frame_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_m4_compute_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_mesh_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_multi_viewport_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_pso_validation_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down
7 changes: 7 additions & 0 deletions runtime/test/d3d12_state_sweep_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,13 @@ int main() {
Ref<ID3D12Device> 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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_stores_atomics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_subgroup_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_translated_draw_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions runtime/test/d3d12_typeless_families_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions runtime/test/vk_test_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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,
Expand Down
Loading