Skip to content

Commit

Permalink
Ogre: fixed Metal rendering on Simulator running on Arm Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
dyunchik authored and eugenegff committed Sep 14, 2023
1 parent 6ca0bde commit afee2d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions RenderSystems/Metal/src/OgreMetalRenderSystem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ of this software and associated documentation files (the "Software"), to deal
}

// Setup baseInstance.
# if TARGET_OS_SIMULATOR == 0
# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM
[mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 4u atIndex:15];
# else
[mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 256u atIndex:15];
Expand Down Expand Up @@ -2324,7 +2324,7 @@ of this software and associated documentation files (the "Software"), to deal
{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
// Setup baseInstance.
# if TARGET_OS_SIMULATOR == 0
# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM
[mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 4u atIndex:15];
# else
[mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 256u atIndex:15];
Expand Down Expand Up @@ -2407,7 +2407,7 @@ of this software and associated documentation files (the "Software"), to deal
# endif

// Setup baseInstance.
# if TARGET_OS_SIMULATOR == 0
# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM
[mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 4u atIndex:15];
# else
[mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 256u atIndex:15];
Expand Down Expand Up @@ -2437,7 +2437,7 @@ of this software and associated documentation files (the "Software"), to deal
{
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
// Setup baseInstance.
# if TARGET_OS_SIMULATOR == 0
# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM
[mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 4u atIndex:15];
# else
[mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 256u atIndex:15];
Expand Down
4 changes: 2 additions & 2 deletions RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ of this software and associated documentation files (the "Software"), to deal
// On iOS alignment must match "the maximum accessed object" type. e.g.
// if it's all float, then alignment = 4. if it's a float2, then alignment = 8.
// The max. object is float4, so alignment = 16
# if TARGET_OS_SIMULATOR == 0
# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM
mConstBufferAlignment = 16;
mTexBufferAlignment = 16;
# else
Expand Down Expand Up @@ -200,7 +200,7 @@ of this software and associated documentation files (the "Software"), to deal
mSupportsPersistentMapping = true;

const uint32 maxNumInstances = 4096u * 2u;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS && TARGET_OS_SIMULATOR == 0
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS && (TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM)
uint32 *drawIdPtr = static_cast<uint32 *>(
OGRE_MALLOC_SIMD( maxNumInstances * sizeof( uint32 ), MEMCATEGORY_GEOMETRY ) );
for( uint32 i = 0; i < maxNumInstances; ++i )
Expand Down

0 comments on commit afee2d2

Please sign in to comment.