#NativeStream range patching error even with disabled safety

1 messages · Page 1 of 1 (latest)

twilit apex
#

I'm using a NativeStream inside an IJobEntity and I keep getting the following error:
System.ArgumentException: Index {0} is out of restricted IJobParallelFor range [{1}...{2}] in NativeStream.
The NativeStream however has the [NativeDisableParallelForRestriction] attribute (and I have also tried the other attributes).

Not sure why this isn't working, as I have other jobs that do the exact same thing and work fine. Are there any edge-cases where safety cannot be disabled for some reason?

I also tried converting the job to an IJobChunk, but I get the same error. In both cases I open and close the for-each index on the unfilteredChunkIndex of the current chunk.

#

(The range with burst turned off is always Index 0 ... range [-1, 0], meaning the range was not patched)

quartz socket
#

Yeah this has always been a problem, you just need to completely turn off safety for it, not just the parallel check.

#

I know you say you tested it, but it should work

twilit apex
#

Not sure what else I could put on it

#

The BeginForEachIndex here throws, I don't see anything I'm doing wrong though

#
public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
{
    Assert.IsFalse(useEnabledMask);

    if (!_piecesList.IsCreated)
        _piecesList = new NativeList<RoomBoundary.RoomPiece>(Allocator.Temp);

    if (!_boundaryRectanglesList.IsCreated)
        _boundaryRectanglesList = new NativeList<RoomBoundary.BoundaryRectangle>(Allocator.Temp);

    RectangleStream.BeginForEachIndex(unfilteredChunkIndex);

    var roomPieceAccessor = chunk.GetBufferAccessor(ref RoomPieceHandle);
    var renderedRoomAccessor = chunk.GetBufferAccessor(ref RenderedRoomHandle);

    for (int i = 0, length = chunk.Count; i < length; i++)
    {
        var roomPieces = roomPieceAccessor[i];
        var renderedRooms = renderedRoomAccessor[i];

        Execute(in roomPieces, ref renderedRooms);
    }

    RectangleStream.EndForEachIndex();
}
#

Thinking of just using UnsafeStream... really annoying :/

twilit apex
#

Nevermind, the query changed and the foreach count was 0, I never checked since the error messages are the same 🙃