mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Simplify GetObjcArray implementation
PR Feedback. Remove optimisation of the array of pointers on the stack resize the to array when adding a valid object
This commit is contained in:
committed by
Baldur Karlsson
parent
ddf56d7b0d
commit
cef722a3d8
@@ -125,25 +125,13 @@ static NS::Array *CreateUnwrappedNSArray(rdcarray<typename UnwrapHelper<MTL_TYPE
|
||||
template <typename RDMTL_TYPE, typename MTLARRAY_TYPE, typename MTL_TYPE, int MAX_COUNT>
|
||||
static void GetObjcArray(rdcarray<RDMTL_TYPE> &to, MTLARRAY_TYPE *from, bool (*validData)(MTL_TYPE *))
|
||||
{
|
||||
MTL_TYPE *objcData[MAX_COUNT];
|
||||
int count = 0;
|
||||
for(int i = 0; i < MAX_COUNT; ++i)
|
||||
{
|
||||
objcData[i] = from->object(i);
|
||||
if(objcData[i] && validData(objcData[i]))
|
||||
MTL_TYPE *el = from->object(i);
|
||||
if(el && validData(el))
|
||||
{
|
||||
count = i + 1;
|
||||
}
|
||||
}
|
||||
if(count)
|
||||
{
|
||||
to.resize(count);
|
||||
for(int i = 0; i < count; ++i)
|
||||
{
|
||||
if(objcData[i] && validData(objcData[i]))
|
||||
{
|
||||
to[i] = RDMTL_TYPE(objcData[i]);
|
||||
}
|
||||
to.resize_for_index(i);
|
||||
to[i] = RDMTL_TYPE(el);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user