Exemplo n.º 1
0
 internal new void CheckError(RTPresult result)
 {
     if (result != RTPresult.RTP_SUCCESS)
     {
         PrimeApi.rtpGetErrorString(result, out var Errormessage);
         throw new OptixException($"Optix context error : {Marshal.PtrToStringAnsi(Errormessage)}");
     }
 }
Exemplo n.º 2
0
 private void Destroy()
 {
     if (InternalPtr != IntPtr.Zero)
     {
         CheckError(PrimeApi.rtpContextDestroy(InternalPtr));
         InternalPtr = IntPtr.Zero;
     }
 }
Exemplo n.º 3
0
 public void Unlock()
 {
     if (_fmt.Type == RTPBufferType.CudaLinear)
     {
         return;
     }
     CheckError(PrimeApi.rtpHostBufferUnlock(InternalPtr));
 }
Exemplo n.º 4
0
 public void Lock()
 {
     if (_fmt.Type == RTPBufferType.CudaLinear)
     {
         return;
     }
     CheckError(PrimeApi.rtpHostBufferLock(InternalPtr, (ulong)size));
 }
Exemplo n.º 5
0
 internal void CheckError(RTPresult result)
 {
     if (result != RTPresult.RTP_SUCCESS)
     {
         PrimeApi.rtpGetErrorString(result, out var message);
         throw new OptixException($"Optix context error : {message}");
     }
 }
Exemplo n.º 6
0
 private void Destroy()
 {
     foreach (var disposable in _buffers)
     {
         disposable.Dispose();
     }
     _buffers.Clear();
     if (InternalPtr != IntPtr.Zero)
     {
         CheckError(PrimeApi.rtpContextDestroy(InternalPtr));
         InternalPtr = IntPtr.Zero;
     }
 }
Exemplo n.º 7
0
        public override void Destroy()
        {
            if (_fmt.Type == RTPBufferType.CudaLinear)
            {
                //CudaDriverApi.CudaCall(CudaDriverApi.cuMemFree(_dataPointer));
                CudaRunTimeApi.CudaCall(CudaRunTimeApi.cudaFree(_dataPointer));
            }
            else
            {
                GC.RemoveMemoryPressure(size);
                Marshal.FreeHGlobal(_dataPointer);
            }

            CheckError(PrimeApi.rtpBufferDescDestroy(InternalPtr));
        }
Exemplo n.º 8
0
 internal void CheckError(RTPresult result)
 {
     if (result != RTPresult.RTP_SUCCESS)
     {
         try
         {
             PrimeApi.rtpContextGetLastErrorString(InternalPtr, out var Errormessage);
             //PrimeApi.rtpGetErrorString(result, out var message);
             throw new OptixException($"Optix context error : {Errormessage}");
         }
         catch (Exception ex)
         {
             Console.WriteLine($"Result {result} -Error getting error from Optix - " + ex);
         }
     }
 }
Exemplo n.º 9
0
 public void SetStride(uint bytes)
 {
     CheckError(PrimeApi.rtpBufferDescSetStride(InternalPtr, bytes));
 }
Exemplo n.º 10
0
 public override void Destroy()
 {
     CheckError(PrimeApi.rtpBufferDescDestroy(InternalPtr));
 }
Exemplo n.º 11
0
 public void SetRays(PrimeBuffer rays)
 {
     CheckError(PrimeApi.rtpQuerySetRays(InternalPtr, rays.InternalPtr));
 }
Exemplo n.º 12
0
 public PrimeContext()
 {
     CheckError(PrimeApi.rtpContextCreate(RTPcontexttype.RTP_CONTEXT_TYPE_CUDA, out InternalPtr));
 }
Exemplo n.º 13
0
 public void Finish()
 {
     CheckError(PrimeApi.rtpModelFinish(InternalPtr));
 }
Exemplo n.º 14
0
 internal void Update(RTPmodelhint hints)
 {
     CheckError(PrimeApi.rtpModelUpdate(InternalPtr, (uint)hints));
 }
Exemplo n.º 15
0
 public void SetTriangles(PrimeBuffer indices, PrimeBuffer vertices)
 {
     CheckError(PrimeApi.rtpModelSetTriangles(InternalPtr,
                                              indices?.InternalPtr ?? IntPtr.Zero,
                                              vertices.InternalPtr));
 }
Exemplo n.º 16
0
 public void SetCudaStream(IntPtr cudaStream)
 {
     CheckError(PrimeApi.rtpQuerySetCudaStream(InternalPtr, cudaStream));
 }
Exemplo n.º 17
0
 public void SetRange(ulong begin, ulong end)
 {
     CheckError(PrimeApi.rtpBufferDescSetRange(InternalPtr, begin, end));
 }
Exemplo n.º 18
0
 public void SetHits(PrimeBuffer hits)
 {
     CheckError(PrimeApi.rtpQuerySetHits(InternalPtr, hits.InternalPtr));
 }
Exemplo n.º 19
0
 public override void Destroy()
 {
     CheckError(PrimeApi.rtpModelDestroy(InternalPtr));
 }
Exemplo n.º 20
0
 public PrimeQuery(PrimeContext context, PrimeModel model, QueryType queryType) : base(context)
 {
     _queryType = queryType;
     CheckError(PrimeApi.rtpQueryCreate(model.InternalPtr, (RTPquerytype)queryType, out InternalPtr));
 }
Exemplo n.º 21
0
 public void Finish()
 {
     CheckError(PrimeApi.rtpQueryFinish(InternalPtr));
 }
Exemplo n.º 22
0
 public PrimeBuffer(PrimeContext context, PrimeBufferDesc fmt, IntPtr data) : base(context)
 {
     _dataPointer = data;
     CheckError(PrimeApi.rtpBufferDescCreate(context.InternalPtr, (RTPbufferformat)fmt.Format, (RTPbuffertype)fmt.Type, data, out InternalPtr));
 }
Exemplo n.º 23
0
 public void SetInstances(PrimeBuffer instances, PrimeBuffer transforms)
 {
     CheckError(PrimeApi.rtpModelSetInstances(InternalPtr, instances.InternalPtr, transforms.InternalPtr));
 }
Exemplo n.º 24
0
 public void Update(uint hints)
 {
     CheckError(PrimeApi.rtpModelUpdate(InternalPtr, hints));
 }
Exemplo n.º 25
0
 public void Execute(uint hints)
 {
     CheckError(PrimeApi.rtpQueryExecute(InternalPtr, hints));
 }
Exemplo n.º 26
0
 public PrimeModel(PrimeContext context) : base(context)
 {
     CheckError(PrimeApi.rtpModelCreate(context.InternalPtr, out InternalPtr));
 }
Exemplo n.º 27
0
 public PrimeContext(bool useCuda = false)
 {
     _buffers = new List <IDisposable>();
     CheckError(PrimeApi.rtpContextCreate(useCuda ? RTPcontexttype.RTP_CONTEXT_TYPE_CUDA : RTPcontexttype.RTP_CONTEXT_TYPE_CPU, out InternalPtr));
     CheckError(PrimeApi.rtpContextSetCudaDeviceNumbers(InternalPtr, 0, 0));
 }