sampled_coverage_hardware: Intel UHD Graphics counts discarded samples in the full-draw occlusion query #731

Open
opened 2026-11-22 23:58:42 +00:00 by romn4rch · 9 comments
romn4rch commented 2026-11-22 23:58:42 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-22T23:58:42Z.


Question

On an Intel UHD Graphics, check_sampled_coverage (tests/pixel_aot_render.cpp) reads 64 from the occlusion query around the full 8×8 draw in every case. That includes the cases where the shader discards every pixel. The 64 one-pixel scissored queries that follow are exact. NVIDIA and WARP on the same host match the reference. Under what condition does the full-draw count include discarded samples on this adapter? Should the fixture record this as an adapter exception?

Evidence so far

At 787ace7, sampled_coverage_hardware fails with Full draw coverage mismatch in 3 of 3 runs (ctest --preset dev --no-tests=error -R '^sampled_coverage_hardware$' -j 1 -V with XBOX2WINDOWS_ADAPTER=Intel). The coverage block in tests/pixel_aot_render.cpp, tests/sampled_coverage_check.py and tools/sampled_coverage_aot.py are unchanged on current main.

The test stops at the first draw and does not print the count. Locally (not committed), I added one printf of counts[0], counts[1] and the per-pixel sum before the full-draw check, then rebuilt offscreen_check. I then ran all 13 draws that tests/sampled_coverage_check.py makes: groups main, red and red_base2. Each draw ran three times on Intel and once each on NVIDIA and WARP:

Group Slot Scale Threshold Expected (sum of the 64 one-pixel queries) Full draw, Intel (3 runs) Full draw, NVIDIA Full draw, WARP
main 0 1 0.5 26 64 ×3 26 26
main 0 0.5 0.375 12 64 ×3 12 12
main 0 1 0 64 64 ×3 64 64
main 0 0 0.25 0 64 ×3 0 0
main 0 -1 -0.5 38 64 ×3 38 38
main 1 1 0.5 38 64 ×3 38 38
main 1 0.5 0.375 19 64 ×3 19 19
main 1 1 0 64 64 ×3 64 64
main 1 0 0.25 0 64 ×3 0 0
main 1 -1 -0.5 26 64 ×3 26 26
red 0 1 0.75 64 64 ×3 64 64
red 1 1 0.75 0 64 ×3 0 0
red_base2 0 1 0.75 64 64 ×3 64 64

Measured:

  • On Intel, every one-pixel query matched the reference. The renderer checks those before the full draw, and none failed.
  • The high word of the full-draw count was 0.
  • The full-draw count was 64 in all 39 Intel runs. NVIDIA and WARP returned the reference sum in all 13 cases.

So on this adapter, the full draw counts every covered sample whether or not the shader discards it, while a one-pixel scissored draw of the same shader counts correctly. The count is also not the number of samples in 2×2 quads that keep a live pixel; that would be 44 in the first row.

Inference: none yet about the cause. The generated pixel shader has no outputs and rejects pixels only through discard. The full draw is also the first draw after ClearRenderTargetView, and the only one with the full scissor, so these conditions cannot be separated from this data.

Completion condition

Separate the candidates on this adapter with three local variants of the same 13 draws:

  • (a) Repeat the full-draw query after the 64 scissored draws.
  • (b) Add one draw without a query before the first full-draw query.
  • (c) Add a color output to the shader next to the discard.

If (a) or (b) gives the reference sum, the miscount belongs to the first draw after the clear. If only (c) does, it belongs to a shader without outputs. If none does, it belongs to the full-extent draw.

The fixture then gets either a documented Intel exception in docs/experiments.md or a measurement change the maintainers accept. I can run (a)–(c) on this machine and bring back the counts for all 13 draws, with NVIDIA and WARP as controls.

Required environment

Windows x64 and a source build, with the Intel UHD Graphics above or another adapter that fails sampled_coverage_hardware. No game files.

  • Windows 11 build 26300.10075, MSVC 19.44.35230, SDK 10.0.26100, DXC 1.9.2602.17.
  • Adapter under test: Intel(R) UHD Graphics (8086:468B), driver 32.0.101.7026.
  • Controls on the same host: NVIDIA GeForce RTX 3050 6GB Laptop GPU (10DE:25EC, driver 32.0.16.2114) and WARP 10.0.26100.10068.
  • Debug layer: unavailable on all three (Graphics Tools not installed).

Checklist

  • The task can be reproduced with public or source-built inputs.
  • I did not include game files, dumps, distribution links or credentials.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6549490142 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-22T23:58:42Z. --- ### Question On an Intel UHD Graphics, `check_sampled_coverage` (`tests/pixel_aot_render.cpp`) reads 64 from the occlusion query around the full 8×8 draw in every case. That includes the cases where the shader discards every pixel. The 64 one-pixel scissored queries that follow are exact. NVIDIA and WARP on the same host match the reference. Under what condition does the full-draw count include discarded samples on this adapter? Should the fixture record this as an adapter exception? ### Evidence so far At `787ace7`, `sampled_coverage_hardware` fails with `Full draw coverage mismatch` in 3 of 3 runs (`ctest --preset dev --no-tests=error -R '^sampled_coverage_hardware$' -j 1 -V` with `XBOX2WINDOWS_ADAPTER=Intel`). The coverage block in `tests/pixel_aot_render.cpp`, `tests/sampled_coverage_check.py` and `tools/sampled_coverage_aot.py` are unchanged on current `main`. The test stops at the first draw and does not print the count. Locally (not committed), I added one `printf` of `counts[0]`, `counts[1]` and the per-pixel sum before the full-draw check, then rebuilt `offscreen_check`. I then ran all 13 draws that `tests/sampled_coverage_check.py` makes: groups `main`, `red` and `red_base2`. Each draw ran three times on Intel and once each on NVIDIA and WARP: | Group | Slot | Scale | Threshold | Expected (sum of the 64 one-pixel queries) | Full draw, Intel (3 runs) | Full draw, NVIDIA | Full draw, WARP | |---|---|---|---|---|---|---|---| | `main` | 0 | 1 | 0.5 | 26 | 64 ×3 | 26 | 26 | | `main` | 0 | 0.5 | 0.375 | 12 | 64 ×3 | 12 | 12 | | `main` | 0 | 1 | 0 | 64 | 64 ×3 | 64 | 64 | | `main` | 0 | 0 | 0.25 | 0 | 64 ×3 | 0 | 0 | | `main` | 0 | -1 | -0.5 | 38 | 64 ×3 | 38 | 38 | | `main` | 1 | 1 | 0.5 | 38 | 64 ×3 | 38 | 38 | | `main` | 1 | 0.5 | 0.375 | 19 | 64 ×3 | 19 | 19 | | `main` | 1 | 1 | 0 | 64 | 64 ×3 | 64 | 64 | | `main` | 1 | 0 | 0.25 | 0 | 64 ×3 | 0 | 0 | | `main` | 1 | -1 | -0.5 | 26 | 64 ×3 | 26 | 26 | | `red` | 0 | 1 | 0.75 | 64 | 64 ×3 | 64 | 64 | | `red` | 1 | 1 | 0.75 | 0 | 64 ×3 | 0 | 0 | | `red_base2` | 0 | 1 | 0.75 | 64 | 64 ×3 | 64 | 64 | Measured: - On Intel, every one-pixel query matched the reference. The renderer checks those before the full draw, and none failed. - The high word of the full-draw count was 0. - The full-draw count was 64 in all 39 Intel runs. NVIDIA and WARP returned the reference sum in all 13 cases. So on this adapter, the full draw counts every covered sample whether or not the shader discards it, while a one-pixel scissored draw of the same shader counts correctly. The count is also not the number of samples in 2×2 quads that keep a live pixel; that would be 44 in the first row. Inference: none yet about the cause. The generated pixel shader has no outputs and rejects pixels only through `discard`. The full draw is also the first draw after `ClearRenderTargetView`, and the only one with the full scissor, so these conditions cannot be separated from this data. ### Completion condition Separate the candidates on this adapter with three local variants of the same 13 draws: - (a) Repeat the full-draw query after the 64 scissored draws. - (b) Add one draw without a query before the first full-draw query. - (c) Add a color output to the shader next to the `discard`. If (a) or (b) gives the reference sum, the miscount belongs to the first draw after the clear. If only (c) does, it belongs to a shader without outputs. If none does, it belongs to the full-extent draw. The fixture then gets either a documented Intel exception in `docs/experiments.md` or a measurement change the maintainers accept. I can run (a)–(c) on this machine and bring back the counts for all 13 draws, with NVIDIA and WARP as controls. ### Required environment Windows x64 and a source build, with the Intel UHD Graphics above or another adapter that fails `sampled_coverage_hardware`. No game files. - Windows 11 build 26300.10075, MSVC 19.44.35230, SDK 10.0.26100, DXC 1.9.2602.17. - Adapter under test: Intel(R) UHD Graphics (`8086:468B`), driver `32.0.101.7026`. - Controls on the same host: NVIDIA GeForce RTX 3050 6GB Laptop GPU (`10DE:25EC`, driver `32.0.16.2114`) and WARP `10.0.26100.10068`. - Debug layer: unavailable on all three (Graphics Tools not installed). ### Checklist - [x] The task can be reproduced with public or source-built inputs. - [x] I did not include game files, dumps, distribution links or credentials. _AI-assisted._
R0Y00 commented 2026-11-24 06:48:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T00:26:43Z.


Please run the three variants as separate diagnostics on the same build and adapter. Record the full-draw count, sum of the per-pixel queries and color readback where the variant supplies one, with WARP and NVIDIA controls. The current full-draw mismatch should remain a failure. The fact that per-pixel queries agree helps localize it, but we need the first-draw and shader-output comparisons before changing the measurement or adding an adapter exception.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7088354302 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7088354302). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T00:26:43Z. --- Please run the three variants as separate diagnostics on the same build and adapter. Record the full-draw count, sum of the per-pixel queries and color readback where the variant supplies one, with WARP and NVIDIA controls. The current full-draw mismatch should remain a failure. The fact that per-pixel queries agree helps localize it, but we need the first-draw and shader-output comparisons before changing the measurement or adding an adapter exception.
romn4rch commented 2026-11-24 06:49:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-23T14:27:28Z.


Follow-up: first-draw and shader-output comparisons on one build, with NVIDIA and WARP controls

Source: 34d03c7 (main at the time of the run). A local build of offscreen_check (not committed) adds a late query, an optional warm-up draw, an optional copy of the target after the first full draw, and the printing. The full diff is at the end. Each variant is switched on by an environment variable, so all five modes ran the same binary. The Intel driver is now 32.0.101.7092.

Mode What differs from base
base Nothing. Prints the first full-draw count, the sum of the 64 one-pixel queries and the reference sum.
late X2W_COV_LATE=1: the same full draw is measured again by a query recorded after the 64 one-pixel queries (query index 65, full scissor set again).
warmup X2W_COV_WARMUP=1: one full draw without a query before the first full-draw query.
color The coverage pixel shader also returns float4(product, 0.0f, 0.0f, 1.0f) as SV_Target next to its discard. Prints a map of the pixels that differ from the clear color after all draws.
colorfirst As color, plus X2W_COV_FIRSTCOPY=1: the target is also copied right after the first full draw.

Each mode ran the 13 draws that tests/sampled_coverage_check.py makes: twice on Intel, once each on NVIDIA and WARP. A value matches when it equals the reference sum, the CPU coverage of the case. A map matches when it equals the reference coverage map.

Mode Adapter First full draw Late full draw Sum of one-pixel queries Color map after all draws Color map after the first draw
base Intel 8/26 (64 in all 26) — 26/26 — —
late Intel 8/26 (64 in all 26) 26/26 26/26 — —
warmup Intel 8/26 (64 in all 26) — 26/26 — —
color Intel 26/26 — 26/26 26/26 —
colorfirst Intel 26/26 — 26/26 26/26 26/26
each mode NVIDIA 13/13 13/13 13/13 13/13 13/13
each mode WARP 13/13 13/13 13/13 13/13 13/13

The 8 Intel matches in the first three modes are the draws whose reference is 64. Both Intel runs gave the same values, and the upper 32 bits of every query were 0.

Per draw on Intel (first full draw, unless noted):

Group Slot Scale Threshold Reference base late: first / late warmup color colorfirst: count / pixels written by the first draw
main 0 1 0.5 26 64 64 / 26 64 26 26 / 26
main 0 0.5 0.375 12 64 64 / 12 64 12 12 / 12
main 0 1 0 64 64 64 / 64 64 64 64 / 64
main 0 0 0.25 0 64 64 / 0 64 0 0 / 0
main 0 -1 -0.5 38 64 64 / 38 64 38 38 / 38
main 1 1 0.5 38 64 64 / 38 64 38 38 / 38
main 1 0.5 0.375 19 64 64 / 19 64 19 19 / 19
main 1 1 0 64 64 64 / 64 64 64 64 / 64
main 1 0 0.25 0 64 64 / 0 64 0 0 / 0
main 1 -1 -0.5 26 64 64 / 26 64 26 26 / 26
red 0 1 0.75 64 64 64 / 64 64 64 64 / 64
red 1 1 0.75 0 64 64 / 0 64 0 0 / 0
red_base2 0 1 0.75 64 64 64 / 64 64 64 64 / 64

What this separates (no cause claimed):

  • A warm-up draw does not change the first full-draw count. So "first draw after the clear" alone is not the condition.
  • The same full draw with the same shader matches in 26/26 when its query is recorded later, at index 65 after the 64 one-pixel queries. So "shader without outputs" alone is not the condition either.
  • With a color output, the first full-draw count matches in 26/26. The copy taken right after that draw equals the reference coverage map in 26/26, so the discards take effect in the first draw.

In color and colorfirst, the fixture's existing image check fails on all three adapters, with the first pixel_mismatch at x=0, 4 or 5, y=0. Its reference image expects the clear color where the variant now writes; draws whose reference is 0 still pass. This comes from the variant, not from the adapter. Nothing here changes the fixture, and the full-draw mismatch stays a failure on main.

Commands. The pixel shaders are the sources from tests/sampled_coverage_check.py, compiled with dxc -T ps_6_0 -E main. In the color modes only the entry signature changes and the return shown above is added. Each case then runs offscreen_check.exe hardware --sampled-coverage <ps.dxil> <case.bin> with XBOX2WINDOWS_ADAPTER set to Intel or NVIDIA, or offscreen_check.exe warp --sampled-coverage <ps.dxil> <case.bin>.

Environment. Windows 11 build 26300.10075, MSVC 19.44.35230, Windows SDK 10.0.26100, DXC 1.9.2602.17. Intel(R) UHD Graphics (8086:468B, driver 32.0.101.7092); NVIDIA GeForce RTX 3050 6GB Laptop GPU (10DE:25EC, driver 32.0.16.2114); WARP 10.0.26100.10068. Debug layer unavailable on all three (Graphics Tools not installed).

Local diff used for all five modes (tests/pixel_aot_render.cpp at 34d03c7)
--- a/tests/pixel_aot_render.cpp
+++ b/tests/pixel_aot_render.cpp
@@ -364,13 +364,15 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix
         ComPtr<ID3D12QueryHeap> queries;
         ComPtr<ID3D12Resource> queryResults;
+        ComPtr<ID3D12Resource> firstBack;
         if (!input.coverage.empty()) {
             const UINT pixels = width * height;
             if (pixels != input.coverage.size()) throw std::runtime_error("Coverage reference extent");
-            D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 1, 0};
+            D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 2, 0};
             check(device->CreateQueryHeap(&queryDesc, IID_PPV_ARGS(&queries)), "Coverage queries");
-            queryResults = make_buffer(device, (pixels + 1) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK,
+            queryResults = make_buffer(device, (pixels + 2) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK,
                                        D3D12_RESOURCE_STATE_COPY_DEST);
             // First measure a full draw with neighboring lanes active, then locate
             // each surviving sample with a one-pixel scissor.
+            if (GetEnvironmentVariableA("X2W_COV_WARMUP", nullptr, 0)) list->DrawInstanced(3, 1, 0, 0);
             for (UINT i = 0; i <= pixels; ++i) {
                 if (i) {
@@ -382,6 +384,23 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix
                 list->DrawInstanced(3, 1, 0, 0);
                 list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i);
+                if (!i && GetEnvironmentVariableA("X2W_COV_FIRSTCOPY", nullptr, 0)) {
+                    firstBack = make_buffer(device, resultBytes, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST);
+                    transition(list, target.Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
+                    D3D12_TEXTURE_COPY_LOCATION firstSrc{}, firstDst{};
+                    firstSrc.pResource = target.Get();
+                    firstSrc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+                    firstSrc.SubresourceIndex = 0;
+                    firstDst.pResource = firstBack.Get();
+                    firstDst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;
+                    firstDst.PlacedFootprint = resultLayout;
+                    list->CopyTextureRegion(&firstDst, 0, 0, 0, &firstSrc, nullptr);
+                    transition(list, target.Get(), D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
+                }
             }
-            list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 1, queryResults.Get(), 0);
+            list->RSSetScissorRects(1, &scissor);
+            list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, pixels + 1);
+            if (GetEnvironmentVariableA("X2W_COV_LATE", nullptr, 0)) list->DrawInstanced(3, 1, 0, 0);
+            list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, pixels + 1);
+            list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 2, queryResults.Get(), 0);
         } else if (partialTriangle) {
             const D3D12_INDEX_BUFFER_VIEW indices{partialTriangle->GetGPUVirtualAddress(),
@@ -402,5 +421,36 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix
         cmd.submit_and_wait(device);
         if (queryResults) {
-            auto counts = read(queryResults.Get(), (input.coverage.size() + 1) * 2);
+            auto counts = read(queryResults.Get(), (input.coverage.size() + 2) * 2);
+            UINT x2wMeasured = 0, x2wExpected = 0;
+            for (size_t x2wI = 0; x2wI < input.coverage.size(); ++x2wI) {
+                x2wMeasured += counts[2*x2wI+2];
+                x2wExpected += input.coverage[x2wI];
+            }
+            std::printf("full_draw_samples=%u high=%u full_last=%u last_high=%u per_pixel_sum=%u expected_sum=%u\n",
+                        unsigned(counts[0]), unsigned(counts[1]), unsigned(counts[2 * input.coverage.size() + 2]),
+                        unsigned(counts[2 * input.coverage.size() + 3]), x2wMeasured, x2wExpected);
+            ID3D12Resource* x2wMaps[2]{back.Get(), firstBack.Get()};
+            for (int x2wK = 0; x2wK < 2; ++x2wK) {
+                if (!x2wMaps[x2wK]) continue;
+                auto x2wTexels = read(x2wMaps[x2wK], resultBytes/4);
+                std::vector<char> x2wPattern;
+                UINT x2wWritten = 0;
+                for (UINT x2wY = 0; x2wY < height; ++x2wY) {
+                    for (UINT x2wX = 0; x2wX < width; ++x2wX) {
+                        const auto x2wOffset = x2wY * resultLayout.Footprint.RowPitch / 4 + x2wX * 4;
+                        bool x2wChanged = false;
+                        for (UINT x2wC = 0; x2wC < 4; ++x2wC) {
+                            float x2wValue;
+                            std::memcpy(&x2wValue, x2wTexels.data() + x2wOffset + x2wC, sizeof(x2wValue));
+                            if (x2wValue != clear.Color[x2wC]) x2wChanged = true;
+                        }
+                        x2wPattern.push_back(x2wChanged ? '1' : '0');
+                        if (x2wChanged) ++x2wWritten;
+                    }
+                }
+                x2wPattern.push_back('\0');
+                const char* x2wName = x2wK ? "color_first" : "color_final";
+                std::printf("%s_written=%u %s_map=%s\n", x2wName, x2wWritten, x2wName, x2wPattern.data());
+            }
             UINT sum = 0;
             for (size_t i = 0; i < input.coverage.size(); ++i) {

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7104026840 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7104026840). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-23T14:27:28Z. --- **Follow-up: first-draw and shader-output comparisons on one build, with NVIDIA and WARP controls** Source: `34d03c7` (`main` at the time of the run). A local build of `offscreen_check` (not committed) adds a late query, an optional warm-up draw, an optional copy of the target after the first full draw, and the printing. The full diff is at the end. Each variant is switched on by an environment variable, so all five modes ran the same binary. The Intel driver is now 32.0.101.7092. | Mode | What differs from `base` | |---|---| | `base` | Nothing. Prints the first full-draw count, the sum of the 64 one-pixel queries and the reference sum. | | `late` | `X2W_COV_LATE=1`: the same full draw is measured again by a query recorded after the 64 one-pixel queries (query index 65, full scissor set again). | | `warmup` | `X2W_COV_WARMUP=1`: one full draw without a query before the first full-draw query. | | `color` | The coverage pixel shader also returns `float4(product, 0.0f, 0.0f, 1.0f)` as `SV_Target` next to its `discard`. Prints a map of the pixels that differ from the clear color after all draws. | | `colorfirst` | As `color`, plus `X2W_COV_FIRSTCOPY=1`: the target is also copied right after the first full draw. | Each mode ran the 13 draws that `tests/sampled_coverage_check.py` makes: twice on Intel, once each on NVIDIA and WARP. A value matches when it equals the reference sum, the CPU coverage of the case. A map matches when it equals the reference coverage map. | Mode | Adapter | First full draw | Late full draw | Sum of one-pixel queries | Color map after all draws | Color map after the first draw | |---|---|---|---|---|---|---| | `base` | Intel | 8/26 (64 in all 26) | — | 26/26 | — | — | | `late` | Intel | 8/26 (64 in all 26) | 26/26 | 26/26 | — | — | | `warmup` | Intel | 8/26 (64 in all 26) | — | 26/26 | — | — | | `color` | Intel | 26/26 | — | 26/26 | 26/26 | — | | `colorfirst` | Intel | 26/26 | — | 26/26 | 26/26 | 26/26 | | each mode | NVIDIA | 13/13 | 13/13 | 13/13 | 13/13 | 13/13 | | each mode | WARP | 13/13 | 13/13 | 13/13 | 13/13 | 13/13 | The 8 Intel matches in the first three modes are the draws whose reference is 64. Both Intel runs gave the same values, and the upper 32 bits of every query were 0. Per draw on Intel (first full draw, unless noted): | Group | Slot | Scale | Threshold | Reference | `base` | `late`: first / late | `warmup` | `color` | `colorfirst`: count / pixels written by the first draw | |---|---|---|---|---|---|---|---|---|---| | `main` | 0 | 1 | 0.5 | 26 | 64 | 64 / 26 | 64 | 26 | 26 / 26 | | `main` | 0 | 0.5 | 0.375 | 12 | 64 | 64 / 12 | 64 | 12 | 12 / 12 | | `main` | 0 | 1 | 0 | 64 | 64 | 64 / 64 | 64 | 64 | 64 / 64 | | `main` | 0 | 0 | 0.25 | 0 | 64 | 64 / 0 | 64 | 0 | 0 / 0 | | `main` | 0 | -1 | -0.5 | 38 | 64 | 64 / 38 | 64 | 38 | 38 / 38 | | `main` | 1 | 1 | 0.5 | 38 | 64 | 64 / 38 | 64 | 38 | 38 / 38 | | `main` | 1 | 0.5 | 0.375 | 19 | 64 | 64 / 19 | 64 | 19 | 19 / 19 | | `main` | 1 | 1 | 0 | 64 | 64 | 64 / 64 | 64 | 64 | 64 / 64 | | `main` | 1 | 0 | 0.25 | 0 | 64 | 64 / 0 | 64 | 0 | 0 / 0 | | `main` | 1 | -1 | -0.5 | 26 | 64 | 64 / 26 | 64 | 26 | 26 / 26 | | `red` | 0 | 1 | 0.75 | 64 | 64 | 64 / 64 | 64 | 64 | 64 / 64 | | `red` | 1 | 1 | 0.75 | 0 | 64 | 64 / 0 | 64 | 0 | 0 / 0 | | `red_base2` | 0 | 1 | 0.75 | 64 | 64 | 64 / 64 | 64 | 64 | 64 / 64 | **What this separates (no cause claimed):** - A warm-up draw does not change the first full-draw count. So "first draw after the clear" alone is not the condition. - The same full draw with the same shader matches in 26/26 when its query is recorded later, at index 65 after the 64 one-pixel queries. So "shader without outputs" alone is not the condition either. - With a color output, the first full-draw count matches in 26/26. The copy taken right after that draw equals the reference coverage map in 26/26, so the discards take effect in the first draw. In `color` and `colorfirst`, the fixture's existing image check fails on all three adapters, with the first `pixel_mismatch` at x=0, 4 or 5, y=0. Its reference image expects the clear color where the variant now writes; draws whose reference is 0 still pass. This comes from the variant, not from the adapter. Nothing here changes the fixture, and the full-draw mismatch stays a failure on `main`. **Commands.** The pixel shaders are the sources from `tests/sampled_coverage_check.py`, compiled with `dxc -T ps_6_0 -E main`. In the `color` modes only the entry signature changes and the return shown above is added. Each case then runs `offscreen_check.exe hardware --sampled-coverage <ps.dxil> <case.bin>` with `XBOX2WINDOWS_ADAPTER` set to `Intel` or `NVIDIA`, or `offscreen_check.exe warp --sampled-coverage <ps.dxil> <case.bin>`. **Environment.** Windows 11 build 26300.10075, MSVC 19.44.35230, Windows SDK 10.0.26100, DXC 1.9.2602.17. Intel(R) UHD Graphics (`8086:468B`, driver 32.0.101.7092); NVIDIA GeForce RTX 3050 6GB Laptop GPU (`10DE:25EC`, driver 32.0.16.2114); WARP 10.0.26100.10068. Debug layer unavailable on all three (Graphics Tools not installed). <details><summary>Local diff used for all five modes (<code>tests/pixel_aot_render.cpp</code> at <code>34d03c7</code>)</summary> ```diff --- a/tests/pixel_aot_render.cpp +++ b/tests/pixel_aot_render.cpp @@ -364,13 +364,15 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix ComPtr<ID3D12QueryHeap> queries; ComPtr<ID3D12Resource> queryResults; + ComPtr<ID3D12Resource> firstBack; if (!input.coverage.empty()) { const UINT pixels = width * height; if (pixels != input.coverage.size()) throw std::runtime_error("Coverage reference extent"); - D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 1, 0}; + D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 2, 0}; check(device->CreateQueryHeap(&queryDesc, IID_PPV_ARGS(&queries)), "Coverage queries"); - queryResults = make_buffer(device, (pixels + 1) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK, + queryResults = make_buffer(device, (pixels + 2) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST); // First measure a full draw with neighboring lanes active, then locate // each surviving sample with a one-pixel scissor. + if (GetEnvironmentVariableA("X2W_COV_WARMUP", nullptr, 0)) list->DrawInstanced(3, 1, 0, 0); for (UINT i = 0; i <= pixels; ++i) { if (i) { @@ -382,6 +384,23 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix list->DrawInstanced(3, 1, 0, 0); list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i); + if (!i && GetEnvironmentVariableA("X2W_COV_FIRSTCOPY", nullptr, 0)) { + firstBack = make_buffer(device, resultBytes, D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST); + transition(list, target.Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + D3D12_TEXTURE_COPY_LOCATION firstSrc{}, firstDst{}; + firstSrc.pResource = target.Get(); + firstSrc.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX; + firstSrc.SubresourceIndex = 0; + firstDst.pResource = firstBack.Get(); + firstDst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; + firstDst.PlacedFootprint = resultLayout; + list->CopyTextureRegion(&firstDst, 0, 0, 0, &firstSrc, nullptr); + transition(list, target.Get(), D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + } } - list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 1, queryResults.Get(), 0); + list->RSSetScissorRects(1, &scissor); + list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, pixels + 1); + if (GetEnvironmentVariableA("X2W_COV_LATE", nullptr, 0)) list->DrawInstanced(3, 1, 0, 0); + list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, pixels + 1); + list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 2, queryResults.Get(), 0); } else if (partialTriangle) { const D3D12_INDEX_BUFFER_VIEW indices{partialTriangle->GetGPUVirtualAddress(), @@ -402,5 +421,36 @@ void draw_verified(ID3D12Device* device, const char* path, const std::vector<Pix cmd.submit_and_wait(device); if (queryResults) { - auto counts = read(queryResults.Get(), (input.coverage.size() + 1) * 2); + auto counts = read(queryResults.Get(), (input.coverage.size() + 2) * 2); + UINT x2wMeasured = 0, x2wExpected = 0; + for (size_t x2wI = 0; x2wI < input.coverage.size(); ++x2wI) { + x2wMeasured += counts[2*x2wI+2]; + x2wExpected += input.coverage[x2wI]; + } + std::printf("full_draw_samples=%u high=%u full_last=%u last_high=%u per_pixel_sum=%u expected_sum=%u\n", + unsigned(counts[0]), unsigned(counts[1]), unsigned(counts[2 * input.coverage.size() + 2]), + unsigned(counts[2 * input.coverage.size() + 3]), x2wMeasured, x2wExpected); + ID3D12Resource* x2wMaps[2]{back.Get(), firstBack.Get()}; + for (int x2wK = 0; x2wK < 2; ++x2wK) { + if (!x2wMaps[x2wK]) continue; + auto x2wTexels = read(x2wMaps[x2wK], resultBytes/4); + std::vector<char> x2wPattern; + UINT x2wWritten = 0; + for (UINT x2wY = 0; x2wY < height; ++x2wY) { + for (UINT x2wX = 0; x2wX < width; ++x2wX) { + const auto x2wOffset = x2wY * resultLayout.Footprint.RowPitch / 4 + x2wX * 4; + bool x2wChanged = false; + for (UINT x2wC = 0; x2wC < 4; ++x2wC) { + float x2wValue; + std::memcpy(&x2wValue, x2wTexels.data() + x2wOffset + x2wC, sizeof(x2wValue)); + if (x2wValue != clear.Color[x2wC]) x2wChanged = true; + } + x2wPattern.push_back(x2wChanged ? '1' : '0'); + if (x2wChanged) ++x2wWritten; + } + } + x2wPattern.push_back('\0'); + const char* x2wName = x2wK ? "color_first" : "color_final"; + std::printf("%s_written=%u %s_map=%s\n", x2wName, x2wWritten, x2wName, x2wPattern.data()); + } UINT sum = 0; for (size_t i = 0; i < input.coverage.size(); ++i) { ``` </details> _AI-assisted._
R0Y00 commented 2026-11-24 06:49:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T14:42:14Z.


The new Intel results pin down two useful controls: the no-output shader's late query matches all 26 draws, and the color variant matches both the first query and its first-draw pixel map. The regular full-draw mismatch should remain a failure.

The late run changes both recording order and query index. Can you swap slots 0 and 65 while leaving the command order unchanged, initializing both slots once? A second run with the two full queries adjacent, before any one-pixel queries, would show whether the scissored sequence matters. Please keep the no-output shader for both comparisons and report the two full counts alongside the one-pixel sum. A focused measurement record with your exact driver and commands is welcome.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7104406684 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7104406684). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T14:42:14Z. --- The new Intel results pin down two useful controls: the no-output shader's late query matches all 26 draws, and the color variant matches both the first query and its first-draw pixel map. The regular full-draw mismatch should remain a failure. The late run changes both recording order and query index. Can you swap slots 0 and 65 while leaving the command order unchanged, initializing both slots once? A second run with the two full queries adjacent, before any one-pixel queries, would show whether the scissored sequence matters. Please keep the no-output shader for both comparisons and report the two full counts alongside the one-pixel sum. A focused measurement record with your exact driver and commands is welcome.
romn4rch commented 2026-11-24 06:49:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by romn4rch on 2026-11-23T16:25:40Z.


Follow-up: indices 0 and 65 swapped, and the two full queries adjacent (no-output shader), with NVIDIA and WARP controls

Source: c639a01 (main at the time of the run). tests/pixel_aot_render.cpp is unchanged on current main. Same host and drivers as the previous follow-up. A local build of offscreen_check (not committed) changes only how draw_verified records the two full-draw queries. It also prints both full counts and the one-pixel sum before the fixture's own checks. The diff is at the end. Each mode is switched on by an environment variable, so all four modes ran the same binary. The pixel shader is the fixture's own no-output shader in every mode.

Mode Recorded in the command list First full query Second full query
base full draw; 64 one-pixel draws; index 65 begun and ended with no draw index 0 index 65, empty
late, X2W_COV_LATE=1 full draw; 64 one-pixel draws; full scissor set again, full draw index 0 index 65
swap, X2W_COV_SWAP=1 the same commands in the same order as late index 65 index 0
adjacent, X2W_COV_ADJACENT=1 full draw; full draw; 64 one-pixel draws index 0 index 65

Each index is begun and ended once per command list, and the one-pixel queries keep indices 1–64. Each mode ran the 13 draws that tests/sampled_coverage_check.py makes: twice on Intel, once each on NVIDIA and WARP. A count matches when it equals the reference sum, the CPU coverage of the case.

Mode Adapter First full query Second full query Sum of one-pixel queries
base Intel 8/26 (64 in all 26) empty: 0 in all 26 26/26
late Intel 8/26 (64 in all 26) 26/26 26/26
swap Intel 8/26 (64 in all 26) 26/26 26/26
adjacent Intel 8/26 (64 in all 26) 26/26 26/26
each mode NVIDIA 13/13 13/13; base: empty, 0 13/13
each mode WARP 13/13 13/13; base: empty, 0 13/13

The 8 Intel matches of the first query are the draws whose reference is 64. Both Intel runs gave identical values, and the upper 32 bits of every query were 0.

Per draw on Intel, first / second full count. The one-pixel sum equals the reference in every row. slot is the fixture's parameter, not a query index.

Group slot Scale Threshold Reference late (index 0 / 65) swap (index 65 / 0) adjacent (index 0 / 65)
main 0 1 0.5 26 64 / 26 64 / 26 64 / 26
main 0 0.5 0.375 12 64 / 12 64 / 12 64 / 12
main 0 1 0 64 64 / 64 64 / 64 64 / 64
main 0 0 0.25 0 64 / 0 64 / 0 64 / 0
main 0 -1 -0.5 38 64 / 38 64 / 38 64 / 38
main 1 1 0.5 38 64 / 38 64 / 38 64 / 38
main 1 0.5 0.375 19 64 / 19 64 / 19 64 / 19
main 1 1 0 64 64 / 64 64 / 64 64 / 64
main 1 0 0.25 0 64 / 0 64 / 0 64 / 0
main 1 -1 -0.5 26 64 / 26 64 / 26 64 / 26
red 0 1 0.75 64 64 / 64 64 / 64 64 / 64
red 1 1 0.75 0 64 / 0 64 / 0 64 / 0
red_base2 0 1 0.75 64 64 / 64 64 / 64 64 / 64

What this separates (no cause claimed):

  • The index does not decide the count. In swap, the first full query reads 64 at index 65, and the second matches at index 0 in 26/26.
  • The scissored one-pixel sequence is not needed for a match. In adjacent, the second full query follows the first directly, with no scissor change or other query in between, and matches in 26/26.
  • In every no-output mode so far (base, warmup and late in the previous run, swap and adjacent now), the full query recorded first in the command list reads 64. Whenever a second full query of the same draw is recorded, it matches.

Before the run I wrote down what each candidate condition predicts. Only the first fits:

Condition swap first (index 65) swap second (index 0) adjacent first (index 0) adjacent second (index 65)
the first full query recorded reads 64 64 match 64 match
index 0 reads 64 match 64 64 match
a full query matches only after the one-pixel queries 64 match 64 64
Observed on Intel 64 match 64 match

The fixture's own check reads index 0. In swap that index holds the second full query, so --sampled-coverage exits 0 for all 26 Intel draws in that mode. In base, late and adjacent, the 18 draws whose reference is not 64 fail with Full draw coverage mismatch, as on main. That difference comes from the variant. Nothing here changes the fixture, and the full-draw mismatch stays a failure on main.

Not tested: an empty query recorded before the first full query, other Intel drivers, and the debug layer.

Commands. The pixel shaders are the sources from tests/sampled_coverage_check.py, compiled with dxc -T ps_6_0 -E main. Each case then runs offscreen_check.exe hardware --sampled-coverage <ps.dxil> <case.bin> with XBOX2WINDOWS_ADAPTER set to Intel or NVIDIA, or offscreen_check.exe warp --sampled-coverage <ps.dxil> <case.bin>. The mode's variable is set to 1 for that mode's runs only.

Environment. Windows 11 build 26300.10075, on AC power. MSVC 19.44.35230 and the Windows SDK 10.0.26100 DXC 1.9.2602.17, as in the previous follow-up. Intel(R) UHD Graphics (8086:468B, driver 32.0.101.7092); NVIDIA GeForce RTX 3050 6GB Laptop GPU (10DE:25EC, driver 32.0.16.2114); WARP 10.0.26100.10068. Debug layer unavailable on all three.

Local diff used for all four modes (tests/pixel_aot_render.cpp at c639a01)
--- a/tests/pixel_aot_render.cpp
+++ b/tests/pixel_aot_render.cpp
@@ -363,26 +363,47 @@
         list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
         ComPtr<ID3D12QueryHeap> queries;
         ComPtr<ID3D12Resource> queryResults;
+        UINT x2wFirstSlot = 0, x2wSecondSlot = 0;
         if (!input.coverage.empty()) {
             const UINT pixels = width * height;
             if (pixels != input.coverage.size()) throw std::runtime_error("Coverage reference extent");
-            D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 1, 0};
+            D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 2, 0};
             check(device->CreateQueryHeap(&queryDesc, IID_PPV_ARGS(&queries)), "Coverage queries");
-            queryResults = make_buffer(device, (pixels + 1) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK,
+            queryResults = make_buffer(device, (pixels + 2) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK,
                                        D3D12_RESOURCE_STATE_COPY_DEST);
             // First measure a full draw with neighboring lanes active, then locate
             // each surviving sample with a one-pixel scissor.
-            for (UINT i = 0; i <= pixels; ++i) {
-                if (i) {
-                    LONG x = (i - 1) % width, y = (i - 1) / width;
-                    const D3D12_RECT pixel{x, y, x + 1, y + 1};
-                    list->RSSetScissorRects(1, &pixel);
-                }
+            const bool x2wLate = GetEnvironmentVariableA("X2W_COV_LATE", nullptr, 0) != 0;
+            const bool x2wSwap = GetEnvironmentVariableA("X2W_COV_SWAP", nullptr, 0) != 0;
+            const bool x2wAdjacent = GetEnvironmentVariableA("X2W_COV_ADJACENT", nullptr, 0) != 0;
+            x2wFirstSlot = x2wSwap ? pixels + 1 : 0;
+            x2wSecondSlot = x2wSwap ? 0 : pixels + 1;
+            list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wFirstSlot);
+            list->DrawInstanced(3, 1, 0, 0);
+            list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wFirstSlot);
+            if (x2wAdjacent) {
+                list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+                list->DrawInstanced(3, 1, 0, 0);
+                list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+            }
+            for (UINT i = 1; i <= pixels; ++i) {
+                LONG x = (i - 1) % width, y = (i - 1) / width;
+                const D3D12_RECT pixel{x, y, x + 1, y + 1};
+                list->RSSetScissorRects(1, &pixel);
                 list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i);
                 list->DrawInstanced(3, 1, 0, 0);
                 list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i);
             }
-            list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 1, queryResults.Get(), 0);
+            if (x2wLate || x2wSwap) {
+                list->RSSetScissorRects(1, &scissor);
+                list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+                list->DrawInstanced(3, 1, 0, 0);
+                list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+            } else if (!x2wAdjacent) {
+                list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+                list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot);
+            }
+            list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 2, queryResults.Get(), 0);
         } else if (partialTriangle) {
             const D3D12_INDEX_BUFFER_VIEW indices{partialTriangle->GetGPUVirtualAddress(),
                                                    3 * sizeof(Word), DXGI_FORMAT_R32_UINT};
@@ -401,7 +422,17 @@
         list->CopyTextureRegion(&dst, 0,0,0, &src, nullptr);
         cmd.submit_and_wait(device);
         if (queryResults) {
-            auto counts = read(queryResults.Get(), (input.coverage.size() + 1) * 2);
+            auto counts = read(queryResults.Get(), (input.coverage.size() + 2) * 2);
+            UINT x2wMeasured = 0, x2wExpected = 0;
+            for (size_t x2wI = 0; x2wI < input.coverage.size(); ++x2wI) {
+                x2wMeasured += counts[2 * x2wI + 2];
+                x2wExpected += input.coverage[x2wI];
+            }
+            std::printf("x2w_cov first_slot=%u first=%u first_high=%u second_slot=%u second=%u second_high=%u per_pixel_sum=%u expected_sum=%u\n",
+                        x2wFirstSlot, unsigned(counts[2 * x2wFirstSlot]), unsigned(counts[2 * x2wFirstSlot + 1]),
+                        x2wSecondSlot, unsigned(counts[2 * x2wSecondSlot]), unsigned(counts[2 * x2wSecondSlot + 1]),
+                        x2wMeasured, x2wExpected);
+            std::fflush(stdout);
             UINT sum = 0;
             for (size_t i = 0; i < input.coverage.size(); ++i) {
                 sum += input.coverage[i];

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7107117114 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7107117114). Originally posted by [romn4rch](https://github.com/romn4rch) on 2026-11-23T16:25:40Z. --- **Follow-up: indices 0 and 65 swapped, and the two full queries adjacent (no-output shader), with NVIDIA and WARP controls** Source: `c639a01` (`main` at the time of the run). `tests/pixel_aot_render.cpp` is unchanged on current `main`. Same host and drivers as the previous follow-up. A local build of `offscreen_check` (not committed) changes only how `draw_verified` records the two full-draw queries. It also prints both full counts and the one-pixel sum before the fixture's own checks. The diff is at the end. Each mode is switched on by an environment variable, so all four modes ran the same binary. The pixel shader is the fixture's own no-output shader in every mode. | Mode | Recorded in the command list | First full query | Second full query | |---|---|---|---| | `base` | full draw; 64 one-pixel draws; index 65 begun and ended with no draw | index 0 | index 65, empty | | `late`, `X2W_COV_LATE=1` | full draw; 64 one-pixel draws; full scissor set again, full draw | index 0 | index 65 | | `swap`, `X2W_COV_SWAP=1` | the same commands in the same order as `late` | index 65 | index 0 | | `adjacent`, `X2W_COV_ADJACENT=1` | full draw; full draw; 64 one-pixel draws | index 0 | index 65 | Each index is begun and ended once per command list, and the one-pixel queries keep indices 1–64. Each mode ran the 13 draws that `tests/sampled_coverage_check.py` makes: twice on Intel, once each on NVIDIA and WARP. A count matches when it equals the reference sum, the CPU coverage of the case. | Mode | Adapter | First full query | Second full query | Sum of one-pixel queries | |---|---|---|---|---| | `base` | Intel | 8/26 (64 in all 26) | empty: 0 in all 26 | 26/26 | | `late` | Intel | 8/26 (64 in all 26) | 26/26 | 26/26 | | `swap` | Intel | 8/26 (64 in all 26) | 26/26 | 26/26 | | `adjacent` | Intel | 8/26 (64 in all 26) | 26/26 | 26/26 | | each mode | NVIDIA | 13/13 | 13/13; `base`: empty, 0 | 13/13 | | each mode | WARP | 13/13 | 13/13; `base`: empty, 0 | 13/13 | The 8 Intel matches of the first query are the draws whose reference is 64. Both Intel runs gave identical values, and the upper 32 bits of every query were 0. Per draw on Intel, first / second full count. The one-pixel sum equals the reference in every row. `slot` is the fixture's parameter, not a query index. | Group | `slot` | Scale | Threshold | Reference | `late` (index 0 / 65) | `swap` (index 65 / 0) | `adjacent` (index 0 / 65) | |---|---|---|---|---|---|---|---| | `main` | 0 | 1 | 0.5 | 26 | 64 / 26 | 64 / 26 | 64 / 26 | | `main` | 0 | 0.5 | 0.375 | 12 | 64 / 12 | 64 / 12 | 64 / 12 | | `main` | 0 | 1 | 0 | 64 | 64 / 64 | 64 / 64 | 64 / 64 | | `main` | 0 | 0 | 0.25 | 0 | 64 / 0 | 64 / 0 | 64 / 0 | | `main` | 0 | -1 | -0.5 | 38 | 64 / 38 | 64 / 38 | 64 / 38 | | `main` | 1 | 1 | 0.5 | 38 | 64 / 38 | 64 / 38 | 64 / 38 | | `main` | 1 | 0.5 | 0.375 | 19 | 64 / 19 | 64 / 19 | 64 / 19 | | `main` | 1 | 1 | 0 | 64 | 64 / 64 | 64 / 64 | 64 / 64 | | `main` | 1 | 0 | 0.25 | 0 | 64 / 0 | 64 / 0 | 64 / 0 | | `main` | 1 | -1 | -0.5 | 26 | 64 / 26 | 64 / 26 | 64 / 26 | | `red` | 0 | 1 | 0.75 | 64 | 64 / 64 | 64 / 64 | 64 / 64 | | `red` | 1 | 1 | 0.75 | 0 | 64 / 0 | 64 / 0 | 64 / 0 | | `red_base2` | 0 | 1 | 0.75 | 64 | 64 / 64 | 64 / 64 | 64 / 64 | **What this separates (no cause claimed):** - The index does not decide the count. In `swap`, the first full query reads 64 at index 65, and the second matches at index 0 in 26/26. - The scissored one-pixel sequence is not needed for a match. In `adjacent`, the second full query follows the first directly, with no scissor change or other query in between, and matches in 26/26. - In every no-output mode so far (`base`, `warmup` and `late` in the previous run, `swap` and `adjacent` now), the full query recorded first in the command list reads 64. Whenever a second full query of the same draw is recorded, it matches. Before the run I wrote down what each candidate condition predicts. Only the first fits: | Condition | `swap` first (index 65) | `swap` second (index 0) | `adjacent` first (index 0) | `adjacent` second (index 65) | |---|---|---|---|---| | the first full query recorded reads 64 | 64 | match | 64 | match | | index 0 reads 64 | match | 64 | 64 | match | | a full query matches only after the one-pixel queries | 64 | match | 64 | 64 | | **Observed on Intel** | **64** | **match** | **64** | **match** | The fixture's own check reads index 0. In `swap` that index holds the second full query, so `--sampled-coverage` exits 0 for all 26 Intel draws in that mode. In `base`, `late` and `adjacent`, the 18 draws whose reference is not 64 fail with `Full draw coverage mismatch`, as on `main`. That difference comes from the variant. Nothing here changes the fixture, and the full-draw mismatch stays a failure on `main`. Not tested: an empty query recorded before the first full query, other Intel drivers, and the debug layer. **Commands.** The pixel shaders are the sources from `tests/sampled_coverage_check.py`, compiled with `dxc -T ps_6_0 -E main`. Each case then runs `offscreen_check.exe hardware --sampled-coverage <ps.dxil> <case.bin>` with `XBOX2WINDOWS_ADAPTER` set to `Intel` or `NVIDIA`, or `offscreen_check.exe warp --sampled-coverage <ps.dxil> <case.bin>`. The mode's variable is set to `1` for that mode's runs only. **Environment.** Windows 11 build 26300.10075, on AC power. MSVC 19.44.35230 and the Windows SDK 10.0.26100 DXC 1.9.2602.17, as in the previous follow-up. Intel(R) UHD Graphics (`8086:468B`, driver 32.0.101.7092); NVIDIA GeForce RTX 3050 6GB Laptop GPU (`10DE:25EC`, driver 32.0.16.2114); WARP 10.0.26100.10068. Debug layer unavailable on all three. <details><summary>Local diff used for all four modes (<code>tests/pixel_aot_render.cpp</code> at <code>c639a01</code>)</summary> ```diff --- a/tests/pixel_aot_render.cpp +++ b/tests/pixel_aot_render.cpp @@ -363,26 +363,47 @@ list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); ComPtr<ID3D12QueryHeap> queries; ComPtr<ID3D12Resource> queryResults; + UINT x2wFirstSlot = 0, x2wSecondSlot = 0; if (!input.coverage.empty()) { const UINT pixels = width * height; if (pixels != input.coverage.size()) throw std::runtime_error("Coverage reference extent"); - D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 1, 0}; + D3D12_QUERY_HEAP_DESC queryDesc{D3D12_QUERY_HEAP_TYPE_OCCLUSION, pixels + 2, 0}; check(device->CreateQueryHeap(&queryDesc, IID_PPV_ARGS(&queries)), "Coverage queries"); - queryResults = make_buffer(device, (pixels + 1) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK, + queryResults = make_buffer(device, (pixels + 2) * sizeof(UINT64), D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_STATE_COPY_DEST); // First measure a full draw with neighboring lanes active, then locate // each surviving sample with a one-pixel scissor. - for (UINT i = 0; i <= pixels; ++i) { - if (i) { - LONG x = (i - 1) % width, y = (i - 1) / width; - const D3D12_RECT pixel{x, y, x + 1, y + 1}; - list->RSSetScissorRects(1, &pixel); - } + const bool x2wLate = GetEnvironmentVariableA("X2W_COV_LATE", nullptr, 0) != 0; + const bool x2wSwap = GetEnvironmentVariableA("X2W_COV_SWAP", nullptr, 0) != 0; + const bool x2wAdjacent = GetEnvironmentVariableA("X2W_COV_ADJACENT", nullptr, 0) != 0; + x2wFirstSlot = x2wSwap ? pixels + 1 : 0; + x2wSecondSlot = x2wSwap ? 0 : pixels + 1; + list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wFirstSlot); + list->DrawInstanced(3, 1, 0, 0); + list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wFirstSlot); + if (x2wAdjacent) { + list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + list->DrawInstanced(3, 1, 0, 0); + list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + } + for (UINT i = 1; i <= pixels; ++i) { + LONG x = (i - 1) % width, y = (i - 1) / width; + const D3D12_RECT pixel{x, y, x + 1, y + 1}; + list->RSSetScissorRects(1, &pixel); list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i); list->DrawInstanced(3, 1, 0, 0); list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, i); } - list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 1, queryResults.Get(), 0); + if (x2wLate || x2wSwap) { + list->RSSetScissorRects(1, &scissor); + list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + list->DrawInstanced(3, 1, 0, 0); + list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + } else if (!x2wAdjacent) { + list->BeginQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + list->EndQuery(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, x2wSecondSlot); + } + list->ResolveQueryData(queries.Get(), D3D12_QUERY_TYPE_OCCLUSION, 0, pixels + 2, queryResults.Get(), 0); } else if (partialTriangle) { const D3D12_INDEX_BUFFER_VIEW indices{partialTriangle->GetGPUVirtualAddress(), 3 * sizeof(Word), DXGI_FORMAT_R32_UINT}; @@ -401,7 +422,17 @@ list->CopyTextureRegion(&dst, 0,0,0, &src, nullptr); cmd.submit_and_wait(device); if (queryResults) { - auto counts = read(queryResults.Get(), (input.coverage.size() + 1) * 2); + auto counts = read(queryResults.Get(), (input.coverage.size() + 2) * 2); + UINT x2wMeasured = 0, x2wExpected = 0; + for (size_t x2wI = 0; x2wI < input.coverage.size(); ++x2wI) { + x2wMeasured += counts[2 * x2wI + 2]; + x2wExpected += input.coverage[x2wI]; + } + std::printf("x2w_cov first_slot=%u first=%u first_high=%u second_slot=%u second=%u second_high=%u per_pixel_sum=%u expected_sum=%u\n", + x2wFirstSlot, unsigned(counts[2 * x2wFirstSlot]), unsigned(counts[2 * x2wFirstSlot + 1]), + x2wSecondSlot, unsigned(counts[2 * x2wSecondSlot]), unsigned(counts[2 * x2wSecondSlot + 1]), + x2wMeasured, x2wExpected); + std::fflush(stdout); UINT sum = 0; for (size_t i = 0; i < input.coverage.size(); ++i) { sum += input.coverage[i]; ``` </details> _AI-assisted._
R0Y00 commented 2026-11-24 06:49:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:59:38Z.


The swap and adjacent controls narrow this down. On this Intel build, the first full query still returned 64 when its slot changed and when the second full query moved before the one-pixel draws. The second query and one-pixel sum matched 26/26. WARP and NVIDIA remain useful controls. A focused experimental note linking the results and command order would be welcome. Keep the original first-query mismatch as a failure; a second draw is diagnostic evidence, not a substitute result.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7107987691 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7107987691). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T16:59:38Z. --- The swap and adjacent controls narrow this down. On this Intel build, the first full query still returned 64 when its slot changed and when the second full query moved before the one-pixel draws. The second query and one-pixel sum matched 26/26. WARP and NVIDIA remain useful controls. A focused experimental note linking the results and command order would be welcome. Keep the original first-query mismatch as a failure; a second draw is diagnostic evidence, not a substitute result.
R0Y00 commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:31:16Z.


The independent Intel UHD baseline is now in #1563. The first full-draw query failed twice on that adapter, while RTX 3060 Laptop and WARP passed. The UHD fixture did not print the failed count, so this establishes another first-query failure without establishing the earlier 64-sample value or its cause. The strict assertion remains in place. For the next reproduction, please use the adjacent-query control and include both counts and the one-pixel sum.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134510928 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7134510928). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:31:16Z. --- The independent Intel UHD baseline is now in #1563. The first full-draw query failed twice on that adapter, while RTX 3060 Laptop and WARP passed. The UHD fixture did not print the failed count, so this establishes another first-query failure without establishing the earlier 64-sample value or its cause. The strict assertion remains in place. For the next reproduction, please use the adjacent-query control and include both counts and the one-pixel sum.
RavenCurseBurg commented 2026-11-25 12:01:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T11:48:59Z.


I'll run the requested adjacent-query comparison on a desktop Intel UHD Graphics 770, with RTX 4060 and WARP controls on the same host. I'll keep the no-output shader and the original strict first-query check, report both full counts and the one-pixel sum for the published 13 cases, and link the exact instrumentation.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7161536136 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7161536136). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T11:48:59Z. --- I'll run the requested adjacent-query comparison on a desktop Intel UHD Graphics 770, with RTX 4060 and WARP controls on the same host. I'll keep the no-output shader and the original strict first-query check, report both full counts and the one-pixel sum for the published 13 cases, and link the exact instrumentation.
RavenCurseBurg commented 2026-11-25 12:01:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T11:57:25Z.


The desktop Intel UHD Graphics 770 (8086:a780, driver 32.0.101.5973) returned 64 for the first full draw on all 26 runs in each mode. Only eight of those 26 cases actually covered 64 samples. The second adjacent full draw and the sum of the 64 one-pixel queries each matched the CPU reference 26/26. The uninstrumented fixture also exited 1 on the first slot-0 case with Full draw coverage mismatch.

In the table, each vector is ordered by the five scale/threshold pairs from the fixture: (1, .5), (.5, .375), (1, 0), (0, .25), (-1, -.5). The final three cases use (1, .75). Both Intel repetitions gave the values below.

No-output shader Intel first full Intel second adjacent full Intel one-pixel sum / CPU
Main, slot 0 64, 64, 64, 64, 64 26, 12, 64, 0, 38 26, 12, 64, 0, 38
Main, slot 1 64, 64, 64, 64, 64 38, 19, 64, 0, 26 38, 19, 64, 0, 26
Red slot 0, red slot 1, red base-2 slot 0 64, 64, 64 64, 0, 64 64, 0, 64

In base mode, slot 0 covered the first full draw and slot 65 was empty after the one-pixel draws. In adjacent mode slot 65 covered a second full draw immediately after slot 0, before any scissored draw. Every individual one-pixel query matched its CPU reference in both modes. The base empty query returned 0 on all three adapters. The original first-query assertion still failed 18/26 times per Intel mode.

The RTX 4060 (10de:2882, 32.0.15.9579) and WARP (1414:008c, 10.0.26100.9711) matched all 13 first full counts in both modes and all 13 second adjacent counts. Each control ran once per mode. All three used Windows 11 build 26100.9711, Agility SDK 1.620.2 and DXC 1.9.2609.5. The D3D12 debug layer was unavailable.

Reproduction from the measurement checkout using the instrumentation diff and fixed-source renderer build:

foreach ($mode in 'base', 'adjacent') {
    python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer Intel $mode --repeat 2
    python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer NVIDIA $mode
    python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer warp $mode
}

Each call emits one JSON record per draw. The Intel calls exit 1 after collecting all cases, and the two controls exit 0.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7161728975 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7161728975). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T11:57:25Z. --- The desktop Intel UHD Graphics 770 (8086:a780, driver 32.0.101.5973) returned 64 for the first full draw on all 26 runs in each mode. Only eight of those 26 cases actually covered 64 samples. The second adjacent full draw and the sum of the 64 one-pixel queries each matched the CPU reference 26/26. The uninstrumented fixture also exited 1 on the first slot-0 case with `Full draw coverage mismatch`. In the table, each vector is ordered by the five scale/threshold pairs from the fixture: (1, .5), (.5, .375), (1, 0), (0, .25), (-1, -.5). The final three cases use (1, .75). Both Intel repetitions gave the values below. | No-output shader | Intel first full | Intel second adjacent full | Intel one-pixel sum / CPU | | --- | --- | --- | --- | | Main, slot 0 | 64, 64, 64, 64, 64 | 26, 12, 64, 0, 38 | 26, 12, 64, 0, 38 | | Main, slot 1 | 64, 64, 64, 64, 64 | 38, 19, 64, 0, 26 | 38, 19, 64, 0, 26 | | Red slot 0, red slot 1, red base-2 slot 0 | 64, 64, 64 | 64, 0, 64 | 64, 0, 64 | In base mode, slot 0 covered the first full draw and slot 65 was empty after the one-pixel draws. In adjacent mode slot 65 covered a second full draw immediately after slot 0, before any scissored draw. Every individual one-pixel query matched its CPU reference in both modes. The base empty query returned 0 on all three adapters. The original first-query assertion still failed 18/26 times per Intel mode. The RTX 4060 (10de:2882, 32.0.15.9579) and WARP (1414:008c, 10.0.26100.9711) matched all 13 first full counts in both modes and all 13 second adjacent counts. Each control ran once per mode. All three used Windows 11 build 26100.9711, Agility SDK 1.620.2 and DXC 1.9.2609.5. The D3D12 debug layer was unavailable. Reproduction from the [measurement checkout](https://github.com/RavenCurseBurg/Xbox2Windows/tree/5adc7773228e4989ecab811548964785992d54dc) using the [instrumentation diff](https://github.com/RavenCurseBurg/Xbox2Windows/commit/d527420e6bf5b76b474d8bc1fe3a2334e6dec1bb) and [fixed-source renderer build](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45608318579): ```powershell foreach ($mode in 'base', 'adjacent') { python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer Intel $mode --repeat 2 python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer NVIDIA $mode python -B tests/sampled_coverage_adjacent_measure.py $dxc $renderer warp $mode } ``` Each call emits one JSON record per draw. The Intel calls exit 1 after collecting all cases, and the two controls exit 0.
Alexofbulgaria commented 2026-11-27 07:48:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Alexofbulgaria on 2026-11-27T07:48:01Z.


Laptop UHD and RTX 2070 Max-Q comparison

I ran the stock sampled-coverage hardware fixture three times per adapter at clean d3e3ea776e4fb32401f1eed3dc109fb477d9cbd8, using the same Release offscreen_check binary on both GPUs. Windows build 26300.10075, MSVC 19.44.35230, DXC 1.9.2602.17. I selected each adapter with XBOX2WINDOWS_ADAPTER and ran python -B tests/sampled_coverage_check.py <dxc> <offscreen_check> hardware.

Actual adapter DXGI driver Result
Intel UHD Graphics (8086:9bc4) 31.0.101.2114 0/3 passed, exit 1 in each run
GeForce RTX 2070 Max-Q (10de:1f14) 32.0.15.8129 3/3 passed, exit 0 and 132 passing coverage draws per run

The Intel failure was identical in all three runs: coverage pixel=0 expected=0 actual=1, followed by Sample coverage mismatch. This per-pixel assertion stops the fixture before the full-draw check, so there is no full-draw count from this adapter in these runs. The test revision also differs from the original 787ace7 report. D3D12 debug layer enabled on both adapters with zero recorded errors or warnings. Source-built fixtures only. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7212830604 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/737#issuecomment-7212830604). Originally posted by [Alexofbulgaria](https://github.com/Alexofbulgaria) on 2026-11-27T07:48:01Z. --- ### Laptop UHD and RTX 2070 Max-Q comparison I ran the stock sampled-coverage hardware fixture three times per adapter at clean `d3e3ea776e4fb32401f1eed3dc109fb477d9cbd8`, using the same Release `offscreen_check` binary on both GPUs. Windows build `26300.10075`, MSVC 19.44.35230, DXC 1.9.2602.17. I selected each adapter with `XBOX2WINDOWS_ADAPTER` and ran `python -B tests/sampled_coverage_check.py <dxc> <offscreen_check> hardware`. | Actual adapter | DXGI driver | Result | |---|---|---| | Intel UHD Graphics (`8086:9bc4`) | `31.0.101.2114` | 0/3 passed, exit 1 in each run | | GeForce RTX 2070 Max-Q (`10de:1f14`) | `32.0.15.8129` | 3/3 passed, exit 0 and 132 passing coverage draws per run | The Intel failure was identical in all three runs: `coverage pixel=0 expected=0 actual=1`, followed by `Sample coverage mismatch`. This per-pixel assertion stops the fixture before the full-draw check, so there is no full-draw count from this adapter in these runs. The test revision also differs from the original `787ace7` report. D3D12 debug layer enabled on both adapters with zero recorded errors or warnings. Source-built fixtures only. AI-assisted.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#731
No description provided.