Beispiel #1
0
        public void Create(BufferDesc desc)
        {
            mFormat = desc.Format;
            mType   = desc.Type;
            mWidth  = desc.Width;
            mHeight = desc.Height;
            mDepth  = desc.Depth;

            if (mFormat == Format.User && desc.ElemSize <= 0)
            {
                throw new Exception("Buffer Error: Invalid ElemSize for User format Buffer.");
            }


            CheckError(Api.rtBufferCreate(mContext.InternalPtr, (uint)mType, ref InternalPtr));
            CheckError(Api.rtBufferSetFormat(InternalPtr, (RTformat)mFormat));
            SetSize(mWidth, mHeight, mDepth);

            if (mFormat == Format.User)
            {
                CheckError(Api.rtBufferSetElementSize(InternalPtr, (uint)desc.ElemSize));
            }
        }
Beispiel #2
0
 public OptixBuffer(Context context, BufferDesc desc) : base(context)
 {
     Create(desc);
 }