Ejemplo n.º 1
0
        protected override AddReferenceImageJobState ScheduleAddImageWithValidationJobImpl(NativeSlice <byte> imageBytes,
                                                                                           Vector2Int sizeInPixels, TextureFormat format, XRReferenceImage referenceImage, JobHandle inputDeps)
        {
            var grayscaleImage = new NativeArray <byte>(
                sizeInPixels.x * sizeInPixels.y,
                Allocator.Persistent,
                NativeArrayOptions.UninitializedMemory);

            inputDeps = ConversionJob.Schedule(imageBytes, sizeInPixels, format, grayscaleImage, inputDeps);

            // Add a reference in case we are destroyed while the job is running
            RcoApi.Retain(m_Self);

            var validator = CreateValidator(m_Self);

            inputDeps = new AddImageJob
            {
                database              = m_Self,
                validator             = validator,
                managedReferenceImage = new ManagedReferenceImage(referenceImage),
                grayscaleImage        = grayscaleImage,
                width  = sizeInPixels.x,
                height = sizeInPixels.y,
                name   = GetUTF8Bytes(referenceImage.name),
            }.Schedule(inputDeps);

            return(CreateAddJobState(validator, inputDeps));
        }