Skip to content

runtime/README: typeless RTV and 1D-texture lines follow the code - #4469

Open
Pierre-Kookis wants to merge 2 commits into
ItsNotRexed:mainfrom
Pierre-Kookis:docs/runtime-readme-rtv-1d
Open

Pierre-Kookis wants to merge 2 commits into
ItsNotRexed:mainfrom
Pierre-Kookis:docs/runtime-readme-rtv-1d

Conversation

@Pierre-Kookis

Copy link
Copy Markdown

Claimed in the coordination issue: #4257 (item 2 of my claiming: comment).

Problem

Three passages of runtime/README.md said MSAA RTVs, SINT/SNORM views, mip/array ranges, typed-resource casts and 1D textures were not supported (:342-344, :367, :374 at 03b09a08). The runtime and its tests say otherwise:

  • CreateRenderTargetView handles TEXTURE2DMS/TEXTURE2DMSARRAY and family-compatible typeless views (runtime/shims/d3d12_vulkan_device.cpp:5037-5104, D3D-275).
  • A typed R8G8B8A8_UNORM resource with a castable-format list takes listed views (:5063-5071, D3D-85/D3D-90).
  • 1D textures are created; only 1D attachments are refused (:6913-6917; runtime/test/d3d12_texture1d_test.cpp).
  • d3d12_typeless_rtv_test compares mip slices, array-layer ranges, 4x MSAA and SINT/SNORM with WARP; typeless_rtv_test covers the replay side.

Change

Doc only: those sentences now say what the code does, including what is still refused (1D attachments, 3D typeless view reinterpretation, typed casts outside RGBA8 UNORM with a castable list). No other text changed.

Tested

python -I -m unittest discover -s tests -p "test_docs*.py": OK. No code changed, so no GPU run.

AI-assisted (Claude Code + Codex: a second model drafted the wording with file:line evidence for each sentence; I checked the code ranges and trimmed it). No game files.

Three sentences said MSAA RTVs, SINT/SNORM views, mip/array ranges, typed-resource casts and 1D
textures were not supported. CreateRenderTargetView handles TEXTURE2DMS/TEXTURE2DMSARRAY and
family-compatible typeless views, a typed R8G8B8A8_UNORM resource with a castable-format list
takes listed views, 1D textures are created (only 1D attachments are refused), and
d3d12_typeless_rtv_test / typeless_rtv_test cover mips, arrays, 4x MSAA and SINT/SNORM.
Doc only.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at c01e909b on Windows 11: test_docs_links.py 6 OK; git diff --check clean.

The runtime README's typeless-RTV and 1D-texture lines now match the code. No blocking issue.

@paratustra

Copy link
Copy Markdown

Code read at the PR head. One of the new lines contradicts the code. runtime/README.md:370 now says "1D attachments and 3D typeless view reinterpretation remain refused", but 1D render-target views are built:

  • CreateRenderTargetView handles D3D12_RTV_DIMENSION_TEXTURE1D and TEXTURE1DARRAY through line_target_view (runtime/shims/d3d12_vulkan_device.cpp ~5030-5034).
  • The typeless path counts them as valid (plain_1d / array_1d, ~5073-5081).
  • runtime/test/d3d12_texture1d_test.cpp covers 1D RTV/DSV creation.

The 3D half is right: volume_rtv refuses typeless reinterpretation. The PR already dropped "(1D textures today)" from the paragraph above for this reason, so this sentence probably only needs "1D attachments and" removed.

No game files. AI-assisted (Claude Code).

@Atomic258

Atomic258 commented Nov 23, 2026 •

Copy link
Copy Markdown

Checked c01e909b8a on Linux, CPU only, no game files: pass (docs accuracy review).

  • The updated paragraph matches runtime/test/d3d12_typeless_rtv_test.cpp as it stands: mip slices (MipLevels 3 for array/mip_chain/automatic_mips), array-layer ranges (Texture2DArray with first_layer/layer_count), MSAA (SampleDesc.Count), and SINT/SNORM clears (DXGI_FORMAT_R8G8B8A8_SINT in the clear table) are all exercised.
  • Dropping the "not added" line is correct — those cases are now in the test.

AI-assisted (Devin).

@mrbean56

Copy link
Copy Markdown

Read on Linux, checked the new sentences against the code: pass, with one cross-PR interaction to keep in mind.

  • "Typed-resource RTV casts are limited to R8G8B8A8_UNORM resources whose castable-format list allows the view": d3d12_vulkan_device.cpp gates typed casts on R8G8B8A8_UNORM/_SRGB/_UINT (lines 5052-5071) and keeps the DXGI castable list in keep_castable_formats/lists_castable_format, so the limitation is real (the wording names UNORM but the gate also covers the SRGB and UINT members of that family, which is fine).
  • "SINT/SNORM clears are compared where both Vulkan and WARP report render-target support": the format table maps the SINT/SNORM families (lines 143-196), and the comparison is conditional on host support, which is what the sentence says.
  • "1D attachments and 3D typeless view reinterpretation remain refused": matches the current code (only 2D/3D image selection at line 362, and the 1D refusal in the resource-description path). Heads-up: d3d12: 1D render targets and depth buffers (created as the host does, 1D attachment views) #4454 ("d3d12: 1D render targets and depth buffers") adds 1D attachments, so whichever of the two lands second should update this line; as written, merging both leaves the README claiming a refusal that no longer exists.
  • Removing "Other typeless families … are not added" and replacing it with "other typeless color families also accept same-family typed RTVs, subject to Vulkan color-attachment support" is the right direction: the old sentence is a stale negative that the code no longer satisfies.

Docs only; no game data. AI-assisted.

@SebSilent

Copy link
Copy Markdown

Read c01e909b against main 03b09a08 (docs-only, so the code cited is main's; Linux, CPU only): pass, and I think the sentence paratustra flagged should stay.

What I checked in runtime/shims/d3d12_vulkan_device.cpp:

  • CreateRenderTargetView does handle TEXTURE2DMS and TEXTURE2DMSARRAY (~5038-5046), and the typeless branch is now any color family, not just RGBA8 (the D3D-275 comment at ~5050 says exactly that).
  • The typed-cast sentence matches the code: a cast only goes through when the resource is plain R8G8B8A8_UNORM with a view-format list that allows the requested format (D3D-85/D3D-90 path, ~5063-5078). Not SRGB, not UINT, matches "whose castable-format list allows the view".
  • "subject to Vulkan color-attachment support" is real, ~5104 refuses the view when COLOR_ATTACHMENT_BIT is missing.
  • 3D: volume_rtv (~322-324) refuses any view format that differs from the resource format, so "3D typeless view reinterpretation remain refused" is right.
  • The test claims check out too: d3d12_typeless_rtv_test.cpp has mip-slice and array-layer ranges, SampleDesc.Count = 4 (~297/310), an explicit "4x MSAA typeless and castable RGBA8 RTVs ... compared against WARP" block (~668) and SINT/SNORM cases.

On the flagged line: the README says 1D attachments remain refused, not 1D views. Building a view for a well-formed 1D desc and refusing the attachment are both true at once. CreateCommittedResource rejects a 1D texture carrying ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL with "1D texture cannot be an attachment" (~6913-6917), and the RTV/DSV section of d3d12_texture1d_test.cpp is bounds validation that expects null descriptors for out-of-range slices (~155-170), not a working 1D attachment. The typeless RTV branch also checks the flag itself. Dropping "1D attachments and" would make the paragraph less precise, so I'd keep it as written.

No game files. AI-assisted.

The view path builds TEXTURE1D/TEXTURE1DARRAY RTVs (line_target_view); what is refused is creating a
1D texture with ALLOW_RENDER_TARGET or ALLOW_DEPTH_STENCIL. Name that instead of "1D attachments".
@Pierre-Kookis

Copy link
Copy Markdown
Author

Thanks all. Pushed ffddfedd, which makes the 1D part precise instead of dropping it:

A 1D texture cannot be created as a render target or depth buffer (CreateCommittedResource refuses ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL on it), and 3D typeless view reinterpretation remains refused.

test_docs*.py: OK.

@paratustra

Copy link
Copy Markdown

Correction to my earlier note: I was wrong. CreateCommittedResource refuses a 1D texture with ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL (runtime/shims/d3d12_vulkan_device.cpp ~6916, "1D texture cannot be an attachment"). So the 1D RTV/DSV code in CreateRenderTargetView never gets a resource it can use as an attachment, and "1D attachments remain refused" was accurate. ffddfed says where the refusal is, which reads better than the original. Thanks @Pierre-Kookis and @SebSilent.

AI-assisted (Claude Code).

@kapitche

kapitche commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested ffddfed merged with main 98fa503 on Linux (WSL2), Python 3.12.16, CPU only: pass (docs accuracy; the C++ tests need a GPU/WARP and were not run)

  • tests/test_docs_*.py (discover): 30 tests OK.
  • Checked the new README sentences against runtime/shims/d3d12_vulkan_device.cpp at the merged tree:
    • MSAA: CreateRenderTargetView handles TEXTURE2DMS and TEXTURE2DMSARRAY (5274, 5279) and the typeless branch takes ms/ms_array when SampleDesc.Count > 1 (5314-5315).
    • Any color family: typeless_color (5287) is not RGBA8-only; the view must match the resource's typeless_view_family (5331-5336).
    • "subject to Vulkan color-attachment support": view dropped if COLOR_ATTACHMENT_BIT is missing (5341).
    • Typed casts limited to R8G8B8A8_UNORM with a castable list that allows the view (5304-5308).
    • 3D: dim_ok only accepts 1D/2D resources (5318-5320), so 3D views stay refused.
    • 1D: CreateCommittedResource refuses ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL on a 1D texture (7272-7276, "1D texture cannot be an attachment").
    • test/d3d12_typeless_rtv_test.cpp: SINT/SNORM are added only when both Vulkan reports COLOR_ATTACHMENT_BIT and WARP reports render-target support (443-458); mip/array and SampleDesc.Count = 4 cases are present (297, 310, 490).
  • Negative control: not applicable (docs only). No issues found; the PR text cites no line numbers.
  • Linux only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants