Skip to content

Commit 268c167

Browse files
committed
Review
1 parent 1a2c408 commit 268c167

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

include/RED4ext/GpuApi/CommandListContext-inl.hpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ RED4EXT_INLINE void RED4ext::GpuApi::CommandListContext::FlushPendingBarriers()
2727
func(this);
2828
}
2929

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

41+
// TODO: This should be unique_ptr which function fills in and returns.
3842
RED4ext::GpuApi::CommandListContext* outContext = nullptr;
39-
func(&outContext, aType, nullptr, 0);
40-
return outContext;
43+
return func(outContext, aType, aDebugName, aHash);
4144
}

include/RED4ext/GpuApi/CommandListContext.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <RED4ext/CString.hpp>
44
#include <RED4ext/Common.hpp>
55
#include <RED4ext/DynArray.hpp>
6+
#include <RED4ext/StringView.hpp>
67

78
#include <d3d12.h>
89
#include <wrl/client.h>
@@ -45,7 +46,8 @@ RED4EXT_ASSERT_OFFSET(CommandListContext, commandList, 0x030);
4546
RED4EXT_ASSERT_OFFSET(CommandListContext, type, 0x068);
4647
RED4EXT_ASSERT_OFFSET(CommandListContext, pendingBarriers, 0x528);
4748

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

5052
} // namespace GpuApi
5153
} // namespace RED4ext

include/RED4ext/GpuApi/DeviceData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct SDeviceDataBase
6969
uint8_t unkb40af8[0xc97f20 - 0xb50af0]; // B50AF0
7070
ResourceContainer<SSwapChainData, 32> swapChains; // C97F20
7171
uint8_t unkc99678[0xd1ad80 - 0xc99570]; // C98028
72-
ResourceContainer<CommandListContext*, 128> commandLists; // D1AD80 - Uses unknown ptr wrapper.
72+
ResourceContainer<CommandListContext*, 128> commandLists; // D1AD80 - TODO: Uses unique ptr wrapper.
7373
uint8_t unkd1b598[0x13bc240 - 0xd1b690]; // D1B690
7474
};
7575
RED4EXT_ASSERT_SIZE(SDeviceDataBase, 0x13bc240);

0 commit comments

Comments
 (0)