upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthibaut <thibaut-leaux-angeli@live.fr>2026-11-23 18:37:44 +0100
committerthibaut <thibaut-leaux-angeli@live.fr>2026-11-23 18:37:44 +0100
commit4fb24d2faaa86e7287fa7da2670f54ea89e80fce (patch)
treed8c128321e260f3359d168ea2b6f0887ca313e95
parent228cb9ec6ce51e178d6d656958db013eeec8cf5c (diff)
d3d12: a texture at slot 133 gets an ordinary committed texture instead of E_NOTIMPL
The retail title places textures at slot 133 too, and asserted on the E_NOTIMPL (found in review). A texture now gets an ordinary committed DEFAULT texture of the same description, as slot 76 gives one, logged once; it is not on the title's pages. The proxy rewrites a texture's Xbox layout word to UNKNOWN (a buffer's to ROW_MAJOR), as slot 76 does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--runtime/shims/d3d12_vulkan_device.cpp11
-rw-r--r--runtime/shims/d3d12_xs_device.cpp5
-rw-r--r--runtime/test/d3d12_existing_heap_test.cpp7
3 files changed, 17 insertions, 6 deletions
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp
index 5224524fd..415844882 100644
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -6943,8 +6943,15 @@ public:
6943 HRESULT create_at_host_address(void* address, const D3D12_RESOURCE_DESC& desc, REFIID riid, void** out) { 6943 HRESULT create_at_host_address(void* address, const D3D12_RESOURCE_DESC& desc, REFIID riid, void** out) {
6944 constexpr auto method = "Xbox CreatePlacedResourceX (device slot 133)"; 6944 constexpr auto method = "Xbox CreatePlacedResourceX (device slot 133)";
6945 if (desc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER) { 6945 if (desc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER) {
6946 log_once("a title-placed texture (device slot 133) is not supported yet; dimension", int(desc.Dimension)); 6946 // A texture is not placed on the title's pages yet: it gets an ordinary committed DEFAULT texture of the
6947 return d3d12_trace::result(method, E_NOTIMPL); 6947 // same description, as slot 76 gives one, so the title has its resource instead of asserting (found in
6948 // review). What the title writes at `address` does not reach it.
6949 log_once("a title-placed texture (device slot 133) is an ordinary committed texture, not the title's pages; "
6950 "dimension",
6951 int(desc.Dimension));
6952 const D3D12_HEAP_PROPERTIES fallback{D3D12_HEAP_TYPE_DEFAULT};
6953 return d3d12_trace::result(method, create_committed(&fallback, D3D12_HEAP_FLAG_NONE, &desc,
6954 D3D12_RESOURCE_STATE_COMMON, 0, nullptr, riid, out));
6948 } 6955 }
6949 D3D12_HEAP_PROPERTIES heap{}; 6956 D3D12_HEAP_PROPERTIES heap{};
6950 heap.Type = D3D12_HEAP_TYPE_CUSTOM; 6957 heap.Type = D3D12_HEAP_TYPE_CUSTOM;
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index b565fdd4d..fe8b3896b 100644
--- a/runtime/shims/d3d12_xs_device.cpp
+++ b/runtime/shims/d3d12_xs_device.cpp
@@ -1509,7 +1509,10 @@ HRESULT proxy_create_placed_resource_x(DeviceProxy* self, void* va, const D3D12_
1509 D3D12_RESOURCE_DESC pc_desc = *xbox_desc; 1509 D3D12_RESOURCE_DESC pc_desc = *xbox_desc;
1510 const auto xbox_flags = static_cast<std::uint32_t>(pc_desc.Flags); 1510 const auto xbox_flags = static_cast<std::uint32_t>(pc_desc.Flags);
1511 pc_desc.Flags = static_cast<D3D12_RESOURCE_FLAGS>(xbox_flags & kPcResourceFlags); 1511 pc_desc.Flags = static_cast<D3D12_RESOURCE_FLAGS>(xbox_flags & kPcResourceFlags);
1512 if (pc_desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) pc_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; 1512 // The Xbox layout word (0x101 tiled, 0x1 row-major buffer) is no PC layout: ROW_MAJOR for a buffer and UNKNOWN
1513 // for everything else, as slot 76 does.
1514 pc_desc.Layout = pc_desc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER ? D3D12_TEXTURE_LAYOUT_ROW_MAJOR
1515 : D3D12_TEXTURE_LAYOUT_UNKNOWN;
1513 static std::atomic<bool> logged{false}; 1516 static std::atomic<bool> logged{false};
1514 if (!logged.exchange(true, std::memory_order_relaxed)) { 1517 if (!logged.exchange(true, std::memory_order_relaxed)) {
1515 std::fprintf(stderr, 1518 std::fprintf(stderr,
diff --git a/runtime/test/d3d12_existing_heap_test.cpp b/runtime/test/d3d12_existing_heap_test.cpp
index 378aa7819..7c10803eb 100644
--- a/runtime/test/d3d12_existing_heap_test.cpp
+++ b/runtime/test/d3d12_existing_heap_test.cpp
@@ -222,9 +222,10 @@ int check_title_placed(ID3D12Device* device, const char* kind, void* pages, UINT
222 texture.Width = texture.Height = 64; 222 texture.Width = texture.Height = 64;
223 texture.Format = DXGI_FORMAT_R8G8B8A8_UNORM; 223 texture.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
224 texture.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; 224 texture.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
225 Ref<ID3D12Resource> refused; 225 // A texture isn't placed on the pages yet: the title gets an ordinary committed texture instead of a refusal.
226 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, IID_PPV_ARGS(&refused.p)), E_NOTIMPL); 226 Ref<ID3D12Resource> placed_texture;
227 EXPECT(refused.p == nullptr); 227 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, pages, texture, IID_PPV_ARGS(&placed_texture.p)), S_OK);
228 EXPECT(placed_texture.p != nullptr && placed_texture->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D);
228 // An address off the buffer alignment can't be bound inside the import: the ordinary-buffer fallback answers. 229 // An address off the buffer alignment can't be bound inside the import: the ordinary-buffer fallback answers.
229 Ref<ID3D12Resource> fallback; 230 Ref<ID3D12Resource> fallback;
230 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, bytes + 1, desc, IID_PPV_ARGS(&fallback.p)), S_OK); 231 EXPECT_HR(rt::d3d12::create_buffer_at_host_address(device, bytes + 1, desc, IID_PPV_ARGS(&fallback.p)), S_OK);