From 4233d69cf88f1623cb573c8edb61456b24dc5339 Mon Sep 17 00:00:00 2001 From: "Harsh Aggarwal (NVIDIA)" Date: Fri, 4 Apr 2025 12:27:08 +0530 Subject: fix(d3d11): correct parameter in VSSetConstantBuffers1 from uavCount … (#6690) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(d3d11): correct parameter in VSSetConstantBuffers1 from uavCount to cbvCount (fixes #6531) Root cause - Incorrect parameter passing in slang-rhi 1. slang-rhi #281 - Add the correct cbvCount for setting Constant Buffer 2. Prevent render tests from overwriting reference images * Add missing tests/render/multiple-stage-io-locations.slang.3.expected.png * Add more expected images from texture2d-gather * Add new option: skipReferenceImageGeneration For Github CI we set this to true - So we don't overwrite the expected images --------- Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> --- .github/workflows/ci.yml | 4 +++ external/slang-rhi | 2 +- tests/bugs/texture2d-gather.hlsl.2.expected.png | Bin 0 -> 33552 bytes tests/bugs/texture2d-gather.hlsl.3.expected.png | Bin 0 -> 33552 bytes tests/bugs/texture2d-gather.hlsl.expected.png | Bin 0 -> 33552 bytes ...ultiple-stage-io-locations.slang.3.expected.png | Bin 0 -> 36676 bytes tools/slang-test/options.cpp | 5 ++++ tools/slang-test/options.h | 3 +++ tools/slang-test/slang-test-main.cpp | 29 +++++++++++++++------ 9 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 tests/bugs/texture2d-gather.hlsl.2.expected.png create mode 100644 tests/bugs/texture2d-gather.hlsl.3.expected.png create mode 100644 tests/bugs/texture2d-gather.hlsl.expected.png create mode 100644 tests/render/multiple-stage-io-locations.slang.3.expected.png diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 611b40179..a8526dcaf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,6 +170,7 @@ jobs: -category ${{ matrix.test-category }} \ -api all-cpu \ -expected-failure-list tests/expected-failure-github.txt \ + -skip-reference-image-generation \ -show-adapter-info elif [[ "${{matrix.has-gpu}}" == "true" ]]; then "$bin_dir/slang-test" \ @@ -179,6 +180,7 @@ jobs: -expected-failure-list tests/expected-failure-github.txt \ -expected-failure-list tests/expected-failure-record-replay-tests.txt \ -expected-failure-list tests/expected-failure-github-runner.txt \ + -skip-reference-image-generation \ -show-adapter-info else "$bin_dir/slang-test" \ @@ -188,6 +190,7 @@ jobs: -expected-failure-list tests/expected-failure-github.txt \ -expected-failure-list tests/expected-failure-record-replay-tests.txt \ -expected-failure-list tests/expected-failure-github-runner.txt \ + -skip-reference-image-generation \ -show-adapter-info fi - name: Run Slang examples @@ -215,6 +218,7 @@ jobs: -emit-spirv-via-glsl \ -api vk \ -expected-failure-list tests/expected-failure.txt \ + -skip-reference-image-generation \ -show-adapter-info - uses: actions/upload-artifact@v4 if: steps.filter.outputs.should-run == 'true' && ! matrix.full-gpu-tests diff --git a/external/slang-rhi b/external/slang-rhi index 6b6cc8f95..c1cc2a216 160000 --- a/external/slang-rhi +++ b/external/slang-rhi @@ -1 +1 @@ -Subproject commit 6b6cc8f9513732c2f8627eeefce7ea7e1a95415d +Subproject commit c1cc2a2163525e55da85af32ad17b80b66730e19 diff --git a/tests/bugs/texture2d-gather.hlsl.2.expected.png b/tests/bugs/texture2d-gather.hlsl.2.expected.png new file mode 100644 index 000000000..a20b53acf Binary files /dev/null and b/tests/bugs/texture2d-gather.hlsl.2.expected.png differ diff --git a/tests/bugs/texture2d-gather.hlsl.3.expected.png b/tests/bugs/texture2d-gather.hlsl.3.expected.png new file mode 100644 index 000000000..a20b53acf Binary files /dev/null and b/tests/bugs/texture2d-gather.hlsl.3.expected.png differ diff --git a/tests/bugs/texture2d-gather.hlsl.expected.png b/tests/bugs/texture2d-gather.hlsl.expected.png new file mode 100644 index 000000000..a20b53acf Binary files /dev/null and b/tests/bugs/texture2d-gather.hlsl.expected.png differ diff --git a/tests/render/multiple-stage-io-locations.slang.3.expected.png b/tests/render/multiple-stage-io-locations.slang.3.expected.png new file mode 100644 index 000000000..3333a12d7 Binary files /dev/null and b/tests/render/multiple-stage-io-locations.slang.3.expected.png differ diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index d12a9bf30..da8702031 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -81,6 +81,7 @@ static bool _isSubCommand(const char* arg) " -server-count Set number of test servers (default: 1)\n" " -show-adapter-info Show detailed adapter information\n" " -generate-hlsl-baselines Generate HLSL test baselines\n" + " -skip-reference-image-generation Skip generating reference images for render tests\n" " -emit-spirv-via-glsl Emit SPIR-V through GLSL instead of directly\n" " -expected-failure-list Specify file containing expected failures\n" " -use-shared-library Run tests in-process using shared library\n" @@ -390,6 +391,10 @@ static bool _isSubCommand(const char* arg) { optionsOut->showAdapterInfo = true; } + else if (strcmp(arg, "-skip-reference-image-generation") == 0) + { + optionsOut->skipReferenceImageGeneration = true; + } else { stdError.print("unknown option '%s'\n", arg); diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h index aec930e38..bd8ee5499 100644 --- a/tools/slang-test/options.h +++ b/tools/slang-test/options.h @@ -72,6 +72,9 @@ struct Options // force generation of baselines for HLSL tests bool generateHLSLBaselines = false; + // Skip generation of reference images for render tests, assume they already exist + bool skipReferenceImageGeneration = false; + // Whether to skip the step of creating test devices to check if an API is actually available. bool skipApiDetection = false; diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 51dcf79ce..3f7e41cf6 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -3863,12 +3863,19 @@ TestResult runHLSLRenderComparisonTestImpl( String expectedOutput; String actualOutput; - TestResult hlslResult = - doRenderComparisonTestRun(context, input, expectedArg, ".expected", &expectedOutput); - if (hlslResult != TestResult::Pass) + // Run the expected test case only if we're not skipping reference image generation + TestResult hlslResult = TestResult::Pass; + if (!context->options.skipReferenceImageGeneration) { - return hlslResult; + hlslResult = + doRenderComparisonTestRun(context, input, expectedArg, ".expected", &expectedOutput); + if (hlslResult != TestResult::Pass) + { + return hlslResult; + } } + + // Always run the actual test case TestResult slangResult = doRenderComparisonTestRun(context, input, actualArg, ".actual", &actualOutput); if (slangResult != TestResult::Pass) @@ -3881,7 +3888,12 @@ TestResult runHLSLRenderComparisonTestImpl( return TestResult::Pass; } - Slang::File::writeAllText(outputStem + ".expected", expectedOutput); + // Save the expected output if we generated it + if (!context->options.skipReferenceImageGeneration) + { + Slang::File::writeAllText(outputStem + ".expected", expectedOutput); + } + Slang::File::writeAllText(outputStem + ".actual", actualOutput); if (hlslResult == TestResult::Fail) @@ -3889,9 +3901,10 @@ TestResult runHLSLRenderComparisonTestImpl( if (slangResult == TestResult::Fail) return TestResult::Fail; - if (!StringUtil::areLinesEqual( - actualOutput.getUnownedSlice(), - expectedOutput.getUnownedSlice())) + // Compare text output only if we generated the expected output + if (!context->options.skipReferenceImageGeneration && !StringUtil::areLinesEqual( + actualOutput.getUnownedSlice(), + expectedOutput.getUnownedSlice())) { context->getTestReporter()->dumpOutputDifference(expectedOutput, actualOutput); -- cgit v1.2.3