Skip to content

Commit

Permalink
Merge pull request #54 from CodexLabsLLC/bugfix/rhi-buffers-update
Browse files Browse the repository at this point in the history
Bugfix: Update RHI Buffers
  • Loading branch information
xxEoD2242 authored Jun 16, 2023
2 parents fb8d689 + f66d436 commit 49440f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ multi-agent autonomous systems. Check it out here: [SWARM Developer System](http
Moving forward, we are now using Unreal Engine 5 version 5.03 or greater! If you
want to use UE4.27, you can use the branch `ue4.27`.

## Unreal Engine Version for Main Branch
The main branch of this repository **only** supports Unreal Engine 5.2! Please see our other branches
for other versions that we support.

## Currently Supported Operating Systems
Below are the list of officially supported Operating Systems, with full Unreal Engine support:
### Windows
Expand Down
12 changes: 6 additions & 6 deletions Unreal/Plugins/AirSim/Source/AirBlueprintLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ std::vector<msr::airlib::MeshPositionVertexBuffersResponse> UAirBlueprintLib::Ge
ENQUEUE_RENDER_COMMAND(GetVertexBuffer)
(
[vertex_buffer, data](FRHICommandListImmediate& RHICmdList) {
FVector* indices = (FVector*)RHILockVertexBuffer(vertex_buffer->VertexBufferRHI, 0, vertex_buffer->VertexBufferRHI->GetSize(), RLM_ReadOnly);
FVector* indices = (FVector*)RHILockBuffer(vertex_buffer->VertexBufferRHI, 0, vertex_buffer->VertexBufferRHI->GetSize(), RLM_ReadOnly);
memcpy(data, indices, vertex_buffer->VertexBufferRHI->GetSize());
RHIUnlockVertexBuffer(vertex_buffer->VertexBufferRHI);
RHIUnlockBuffer(vertex_buffer->VertexBufferRHI);
});

#if ((ENGINE_MAJOR_VERSION > 4) || (ENGINE_MAJOR_VERSION == 4 && ENGINE_MINOR_VERSION >= 27))
Expand All @@ -516,9 +516,9 @@ std::vector<msr::airlib::MeshPositionVertexBuffersResponse> UAirBlueprintLib::Ge
ENQUEUE_RENDER_COMMAND(GetIndexBuffer)
(
[IndexBuffer, data_ptr](FRHICommandListImmediate& RHICmdList) {
uint16_t* indices = (uint16_t*)RHILockIndexBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly);
uint16_t* indices = (uint16_t*)RHILockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly);
memcpy(data_ptr, indices, IndexBuffer->IndexBufferRHI->GetSize());
RHIUnlockIndexBuffer(IndexBuffer->IndexBufferRHI);
RHIUnlockBuffer(IndexBuffer->IndexBufferRHI);
});

//Need to force the render command to go through cause on the next iteration the buffer no longer exists
Expand All @@ -539,9 +539,9 @@ std::vector<msr::airlib::MeshPositionVertexBuffersResponse> UAirBlueprintLib::Ge
ENQUEUE_RENDER_COMMAND(GetIndexBuffer)
(
[IndexBuffer, data_ptr](FRHICommandListImmediate& RHICmdList) {
uint32_t* indices = (uint32_t*)RHILockIndexBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly);
uint32_t* indices = (uint32_t*)RHILockBuffer(IndexBuffer->IndexBufferRHI, 0, IndexBuffer->IndexBufferRHI->GetSize(), RLM_ReadOnly);
memcpy(data_ptr, indices, IndexBuffer->IndexBufferRHI->GetSize());
RHIUnlockIndexBuffer(IndexBuffer->IndexBufferRHI);
RHIUnlockBuffer(IndexBuffer->IndexBufferRHI);
});

FlushRenderingCommands();
Expand Down

0 comments on commit 49440f9

Please sign in to comment.