Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
WSSDude committed Jan 14, 2025
1 parent 1a2c408 commit 268c167
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
17 changes: 10 additions & 7 deletions include/RED4ext/GpuApi/CommandListContext-inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::FlushPendingBarriers()
func(this);
}

RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* GetFreeCommandList(RED4ext::GpuApi::CommandListType aType)
RED4EXT_INLINE RED4ext::GpuApi::CommandListContext* AquireFreeCommandList(RED4ext::GpuApi::CommandListType aType,
RED4ext::StringView& aDebugName,
uint64_t aHash)
{
// NOTE: this function has parameters for hash and name but they appear unused.
using func_t =
RED4ext::GpuApi::CommandListContext** (*)(RED4ext::GpuApi::CommandListContext**,
RED4ext::GpuApi::CommandListType, RED4ext::CString*, uint64_t);
// NOTE: This function has parameters for debug name and hash which seem to be optional.
// Expects unique ptr as an out param and returns it by reference.
using func_t = RED4ext::GpuApi::CommandListContext*& (*)(RED4ext::GpuApi::CommandListContext*&,
RED4ext::GpuApi::CommandListType,
const RED4ext::StringView&, uint64_t);
static RED4ext::UniversalRelocFunc<func_t> func(RED4ext::Detail::AddressHashes::GetFreeCommandList);

// TODO: This should be unique_ptr which function fills in and returns.
RED4ext::GpuApi::CommandListContext* outContext = nullptr;
func(&outContext, aType, nullptr, 0);
return outContext;
return func(outContext, aType, aDebugName, aHash);
}
4 changes: 3 additions & 1 deletion include/RED4ext/GpuApi/CommandListContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <RED4ext/CString.hpp>
#include <RED4ext/Common.hpp>
#include <RED4ext/DynArray.hpp>
#include <RED4ext/StringView.hpp>

#include <d3d12.h>
#include <wrl/client.h>
Expand Down Expand Up @@ -45,7 +46,8 @@ RED4EXT_ASSERT_OFFSET(CommandListContext, commandList, 0x030);
RED4EXT_ASSERT_OFFSET(CommandListContext, type, 0x068);
RED4EXT_ASSERT_OFFSET(CommandListContext, pendingBarriers, 0x528);

CommandListContext* GetFreeCommandList(CommandListType aType);
// TODO: Change to return unique ptr.
CommandListContext* AquireFreeCommandList(CommandListType aType, const StringView& aDebugName = "", uint64_t aHash = 0);

} // namespace GpuApi
} // namespace RED4ext
Expand Down
2 changes: 1 addition & 1 deletion include/RED4ext/GpuApi/DeviceData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct SDeviceDataBase
uint8_t unkb40af8[0xc97f20 - 0xb50af0]; // B50AF0
ResourceContainer<SSwapChainData, 32> swapChains; // C97F20
uint8_t unkc99678[0xd1ad80 - 0xc99570]; // C98028
ResourceContainer<CommandListContext*, 128> commandLists; // D1AD80 - Uses unknown ptr wrapper.
ResourceContainer<CommandListContext*, 128> commandLists; // D1AD80 - TODO: Uses unique ptr wrapper.
uint8_t unkd1b598[0x13bc240 - 0xd1b690]; // D1B690
};
RED4EXT_ASSERT_SIZE(SDeviceDataBase, 0x13bc240);
Expand Down

0 comments on commit 268c167

Please sign in to comment.