Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ jobs:
tests/startup_gfx2hlsl_sop2_complement_check.py \
tests/startup_gfx2hlsl_pack_absdiff_check.py \
tests/startup_gfx2hlsl_sopk_accum_check.py \
tests/startup_gfx2hlsl_bfm_b64_check.py \
tests/startup_gfx2hlsl_f32_lg_check.py \
tests/startup_gfx2hlsl_f32_nan_check.py \
tests/startup_gfx2hlsl_f32_sdwa_check.py \
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ python3 -m venv out/pe-env
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_int_med3_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_cselect_mask_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_mask_overwrite_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_bfm_b64_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_mask_data_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_image_get_lod_check.py
./out/pe-env/bin/python -B tests/startup_gfx2hlsl_add_sub_co_check.py
Expand Down
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3477,6 +3477,9 @@ if(EXISTS "${INTAKE_PYTHON}")
# Scalar sign-extends and conditional moves (batch 3 #2).
add_test(NAME startup_gfx2hlsl_s_sext_cmov COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_s_sext_cmov_check.py")
# s_bfm_b64 (#1723).
add_test(NAME startup_gfx2hlsl_bfm_b64 COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_bfm_b64_check.py")
# SDWA forms of the float-result conversions (#1727).
add_test(NAME startup_gfx2hlsl_sdwa_cvt COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_CURRENT_SOURCE_DIR}/tests/startup_gfx2hlsl_sdwa_cvt_check.py")
Expand Down Expand Up @@ -3893,6 +3896,15 @@ if(EXISTS "${INTAKE_PYTHON}")
"$<TARGET_FILE:offscreen_check>" ${adapter} $<$<BOOL:${STARTUP_FXC}>:${STARTUP_FXC}>)
set_tests_properties(startup_gfx2hlsl_bit_alu_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77)
endforeach()
# s_bfm_b64 read back on a desktop adapter: widths 0/1/31/32/33/63 x offsets 0/1/31/32/63 from run-time root
# constants against the bit-loop reference (FXC 5_1 and DXC 6_0), with an uncapped reference and a mutated lowering
# that the draw must reject. The startup_gfx2hlsl_bfm_b64 test above holds the CPU controls.
foreach(adapter IN ITEMS warp hardware)
add_test(NAME startup_gfx2hlsl_bfm_b64_${adapter} COMMAND "${INTAKE_PYTHON}" -B
"${CMAKE_SOURCE_DIR}/tests/startup_gfx2hlsl_bfm_b64_check.py" draw "${DXC_EXECUTABLE}"
"$<TARGET_FILE:offscreen_check>" ${adapter} $<$<BOOL:${STARTUP_FXC}>:${STARTUP_FXC}>)
set_tests_properties(startup_gfx2hlsl_bfm_b64_${adapter} PROPERTIES TIMEOUT 300 SKIP_RETURN_CODE 77)
endforeach()
# gfx2hlsl two- and one-source integer vector operations (VEC_U): translation controls, then the same draw
# of the translated pairs with reference words and one mutated lowering per operation.
add_test(NAME startup_gfx2hlsl_int_alu_controls COMMAND "${INTAKE_PYTHON}" -B
Expand Down
2 changes: 1 addition & 1 deletion tests/desktop_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int check_startup_image_store(ID3D12Device* device, const char* vertex_path, con
void check_startup_flat_param(ID3D12Device* device, const char* vertex_path, const char* pixel_path,
std::uint32_t* words, UINT width = 1, UINT height = 1,
D3D12_CULL_MODE cull = D3D12_CULL_MODE_NONE, BOOL front_ccw = FALSE,
UINT vertices = 3);
UINT vertices = 3, const std::uint32_t* constants = nullptr);
void check_startup_entry_words(ID3D12Device* device, const char* vertex_path, const char* pixel_path,
const std::uint32_t* entry, UINT entry_count, std::uint32_t* words,
UINT width = 1, UINT height = 1);
Expand Down
12 changes: 9 additions & 3 deletions tests/offscreen_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,14 +1513,20 @@ OperationResult run_startup_pixel_words(const OperationContext& ctx)

// --startup-flat-param <vs.cso> <ps.cso> <expected words>: draws one pixel with a gfx2hlsl vertex and
// pixel stage pair (tests/startup_flat_param.cpp). The expected value is four 8-digit hex words,
// comma separated.
// comma separated. An optional fourth argument sets the four entry constants (ud0..ud3) as four hex words;
// without it they are all 0.
OperationResult run_startup_flat_param(const OperationContext& ctx)
{
std::uint32_t expected[4]{};
if (std::sscanf(ctx.argv[5], "%8x,%8x,%8x,%8x", &expected[0], &expected[1], &expected[2], &expected[3]) != 4)
return {OutcomeKind::fail, "expected value is not four hex words"};
std::uint32_t words[4]{};
check_startup_flat_param(ctx.device, ctx.argv[3], ctx.argv[4], words);
std::uint32_t constants[4]{};
if (ctx.argc == 7 && std::sscanf(ctx.argv[6], "%8x,%8x,%8x,%8x", &constants[0], &constants[1], &constants[2],
&constants[3]) != 4)
return {OutcomeKind::fail, "entry constants are not four hex words"};
check_startup_flat_param(ctx.device, ctx.argv[3], ctx.argv[4], words, 1, 1,
D3D12_CULL_MODE_NONE, FALSE, 3, ctx.argc == 7 ? constants : nullptr);
if (std::memcmp(words, expected, sizeof(words)) != 0) {
std::fprintf(stderr, "startup_flat_param mismatch expected=%08x,%08x,%08x,%08x actual=%08x,%08x,%08x,%08x\n",
expected[0], expected[1], expected[2], expected[3], words[0], words[1], words[2], words[3]);
Expand Down Expand Up @@ -1692,7 +1698,7 @@ const OperationSpec kOperations[] = {
{"--startup-image-load-d16", 7, 7, nullptr, kNoGate, run_startup_image_load_d16},
{"--startup-packed-position", 5, 5, nullptr, kNoGate, run_startup_packed_position},
{"--startup-sharedexp-target", 3, 3, nullptr, kNoGate, run_startup_sharedexp_target},
{"--startup-flat-param", 6, 6, nullptr, kNoGate, run_startup_flat_param},
{"--startup-flat-param", 6, 7, nullptr, kNoGate, run_startup_flat_param},
{"--startup-entry-words", 7, 7, nullptr, kNoGate, run_startup_entry_words},
{"--startup-pixel-words", 8, 8, validate_pixel_words_args, kNoGate, run_startup_pixel_words},
{"--raster-reference", 10, 10, validate_raster_args, kNoGate, run_startup_pixel_words},
Expand Down
9 changes: 5 additions & 4 deletions tests/startup_flat_param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Draws one pixel with a translated vertex and pixel stage and returns the four 32-bit words of
// the colour. The entry constants (cbuffer entry : register(b0)) are visible to both stages, because
// the translated vertex stage reads ud0, the rectangle-list switch; they are all 0 here (plain
// triangles). The target is R32G32B32A32_FLOAT, so the readback is the raw words the pixel stage
// triangles) unless the caller passes four words. The target is R32G32B32A32_FLOAT, so the readback is the raw words the pixel stage
// exported.
#include "desktop_gpu.h"

Expand Down Expand Up @@ -33,7 +33,8 @@ std::vector<char> read_blob(const char* path)

void check_startup_flat_param(ID3D12Device* device, const char* vertex_path, const char* pixel_path,
std::uint32_t* words, UINT width, UINT height,
D3D12_CULL_MODE cull, BOOL front_ccw, UINT vertices)
D3D12_CULL_MODE cull, BOOL front_ccw, UINT vertices,
const std::uint32_t* constants)
{
const auto vs = read_blob(vertex_path);
const auto ps = read_blob(pixel_path);
Expand Down Expand Up @@ -96,8 +97,8 @@ void check_startup_flat_param(ID3D12Device* device, const char* vertex_path, con
auto* list = commands.list.Get();
list->ClearRenderTargetView(rtv, clear.Color, 0, nullptr);
list->SetGraphicsRootSignature(root.Get());
const std::uint32_t constants[entry_constants] = {0, 0, 0, 0};
list->SetGraphicsRoot32BitConstants(0, entry_constants, constants, 0);
const std::uint32_t zeros[entry_constants] = {0, 0, 0, 0};
list->SetGraphicsRoot32BitConstants(0, entry_constants, constants ? constants : zeros, 0);
const D3D12_VIEWPORT viewport{0, 0, static_cast<float>(width), static_cast<float>(height), 0, 1};
const D3D12_RECT scissor{0, 0, static_cast<LONG>(width), static_cast<LONG>(height)};
list->RSSetViewports(1, &viewport);
Expand Down
Loading
Loading