Skip to content
Closed
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
7 changes: 7 additions & 0 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME)
shims/registry.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_link_libraries(root_sig_test PRIVATE gta6rt_d3d12_xs_rootsig ${D3D12_LIBRARY})
target_compile_definitions(root_sig_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
Expand All @@ -190,6 +191,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME)
shims/registry.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_link_libraries(device_proxy_test PRIVATE gta6rt_d3d12_xs_rootsig ${D3D12_LIBRARY} ${DXGI_LIBRARY})
target_compile_definitions(device_proxy_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
Expand All @@ -203,6 +205,7 @@ if(WIN32 AND LEONIDA_BUILD_WINDOWS_RUNTIME)
add_executable(xs_proxy_mock_test
test/xs_proxy_mock_test.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_compile_definitions(xs_proxy_mock_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
target_compile_options(xs_proxy_mock_test PRIVATE /W4 /permissive- /utf-8 /EHsc)
Expand Down Expand Up @@ -615,6 +618,7 @@ if(BUILD_TESTING)
shims/xmem.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_include_directories(pe_loader_test PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
Expand Down Expand Up @@ -756,6 +760,7 @@ if(BUILD_TESTING)
shims/xmem.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_include_directories(test_pe_loader_bounds PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
Expand All @@ -780,6 +785,7 @@ if(BUILD_TESTING)
shims/xmem.cpp
shims/d3d12_xs.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_include_directories(pe_loader_fuzz PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
Expand Down Expand Up @@ -1302,6 +1308,7 @@ if(LEONIDA_D3D12_SHIM_TESTS)
shims/d3d12_xs.cpp
shims/registry.cpp
shims/d3d12_xs_device.cpp
shims/d3d12_console_heap_stub.cpp
)
target_include_directories(d3d12_xs_root_signature_test PRIVATE shims)
target_compile_definitions(d3d12_xs_root_signature_test PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX)
Expand Down
4 changes: 2 additions & 2 deletions runtime/shims/acphal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ struct SHAPE_XMA_CONTEXT {
uint32_t reserved1 : 6;
uint32_t loopStartOffset : 26;
uint32_t loopEndOffset : 6;
uint32_t reserved[10];
uint32_t reserved[11];
};
static_assert(sizeof(SHAPE_XMA_CONTEXT) == 64, "SHAPE_XMA_CONTEXT is 64 bytes per GDK");

Expand All @@ -162,7 +162,7 @@ struct SHAPE_PCM_CONTEXT {
uint32_t reserved6 : 15;
uint32_t format : 2;
uint32_t reserved7 : 14;
uint32_t reserved[1];
uint32_t reserved[2];
};
static_assert(sizeof(SHAPE_PCM_CONTEXT) == 32, "SHAPE_PCM_CONTEXT is 32 bytes per GDK");

Expand Down
22 changes: 22 additions & 0 deletions runtime/shims/d3d12_console_heap_stub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// The standalone proxy tests (root_sig_test, device_proxy_test, xs_proxy_mock_test) compile shims/d3d12_xs_device.cpp,
// whose Xbox slot-14 console path calls rt::d3d12::create_console_descriptor_heap. The real definition lives in
// d3d12_vulkan_device.cpp, which those tests do not link (it pulls in the Vulkan device). They never create a console
// descriptor heap, so this inert definition satisfies the reference. The runtime links the real one instead.
#include <windows.h>
#include <d3d12.h>

#include <cstdint>

namespace rt::d3d12 {
HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIPTOR_HEAP_DESC* desc,
D3D12_GPU_VIRTUAL_ADDRESS console_address, std::uint64_t console_size,
REFIID riid, void** out) {
(void)device;
(void)desc;
(void)console_address;
(void)console_size;
(void)riid;
if (out) *out = nullptr;
return E_NOTIMPL;
}
} // namespace rt::d3d12
3 changes: 2 additions & 1 deletion runtime/shims/d3d12_vulkan_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5499,6 +5499,7 @@ class Device final
leonida::VulkanContext& context() { return *state_.context; }
const leonida::BindlessSet* bindless() const { return state_.bindless.get(); }
const DeviceState& state() const { return state_; }
DeviceState& state() { return state_; }
IUnknown* holder() { return identity(); }
bool bind_sampler(const leonida::gfx10::SamplerWords& words) { return state_.bind_sampler(words); }
void own(const OwnedRuntime& owned) { owned_ = owned; }
Expand Down Expand Up @@ -9999,7 +10000,7 @@ HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIP
if (!d) return E_INVALIDARG;

auto* heap = new DescriptorHeap(d->state(), *desc, console_address, console_size);
heap->attach_device(d->identity());
heap->attach_device(d->holder());
if (!heap->ok()) {
heap->Release();
return E_OUTOFMEMORY;
Expand Down
10 changes: 10 additions & 0 deletions runtime/shims/d3d12_xs_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
#include <memory>
#include <utility>

// Xbox slot 14's console CreateDescriptorHeap helper: defined in d3d12_vulkan_device.cpp and declared in
// d3d12_com.h. Declared here instead of including d3d12_com.h, because that header pulls in gfx10_descriptors.h and
// vulkan_backend.h, and this translation unit is also compiled by the standalone proxy tests, which do not carry the
// Vulkan include path.
namespace rt::d3d12 {
HRESULT create_console_descriptor_heap(ID3D12Device* device, const D3D12_DESCRIPTOR_HEAP_DESC* desc,
D3D12_GPU_VIRTUAL_ADDRESS console_address, std::uint64_t console_size,
REFIID riid, void** out);
} // namespace rt::d3d12

namespace rt::d3d12_xs {
namespace {

Expand Down