Relax job constraints, add ref type support, misc fixes
Relaxed generic constraints for job scheduling/execution to allow reference types (removed struct requirement). Updated IJob, IJobParallelFor, and IJobParallel extension methods to support both value and reference types, introducing RunRef for struct-specific overloads. Adjusted JobExecutor and JobScheduler to match new constraints. Bumped assembly version to 3.1.1. Added Value property to Wrapper<T> for ref access and inlined Get(). Changed GGXMipGenerationJob sample count to linear roughness. Removed unused usings in JobInfo.cs.
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Misaki.HighPerformance.Jobs;
|
||||
internal static class JobExecutor
|
||||
{
|
||||
public static void Execute<T>(int dataID, int dataGeneration, ref JobRanges jobRanges, ref readonly JobExecutionContext ctx)
|
||||
where T : struct, IJob
|
||||
where T : IJob
|
||||
{
|
||||
ref var job = ref JobDataPool<T>.GetReference(dataID, dataGeneration, out var exists);
|
||||
Debug.Assert(exists, "Job data not found in the pool.");
|
||||
@@ -30,7 +30,7 @@ internal static class JobExecutor
|
||||
}
|
||||
|
||||
public static void ExecuteParallelFor<T>(int dataID, int dataGeneration, ref JobRanges jobRanges, ref readonly JobExecutionContext ctx)
|
||||
where T : struct, IJobParallelFor
|
||||
where T : IJobParallelFor
|
||||
{
|
||||
ref var job = ref JobDataPool<T>.GetReference(dataID, dataGeneration, out var exists);
|
||||
Debug.Assert(exists, "Job data not found in the pool.");
|
||||
@@ -50,7 +50,7 @@ internal static class JobExecutor
|
||||
}
|
||||
|
||||
public static void ExecuteParallel<T>(int dataID, int dataGeneration, ref JobRanges jobRanges, ref readonly JobExecutionContext ctx)
|
||||
where T : struct, IJobParallel
|
||||
where T : IJobParallel
|
||||
{
|
||||
ref var job = ref JobDataPool<T>.GetReference(dataID, dataGeneration, out var exists);
|
||||
Debug.Assert(exists, "Job data not found in the pool.");
|
||||
|
||||
Reference in New Issue
Block a user