1// Copyright 2009-2021 Intel Corporation
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#include "rtcore_device.h"
7
8RTC_NAMESPACE_BEGIN
9
10/* Types of buffers */
11enum RTCBufferType
12{
13 RTC_BUFFER_TYPE_INDEX = 0,
14 RTC_BUFFER_TYPE_VERTEX = 1,
15 RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE = 2,
16 RTC_BUFFER_TYPE_NORMAL = 3,
17 RTC_BUFFER_TYPE_TANGENT = 4,
18 RTC_BUFFER_TYPE_NORMAL_DERIVATIVE = 5,
19
20 RTC_BUFFER_TYPE_GRID = 8,
21
22 RTC_BUFFER_TYPE_FACE = 16,
23 RTC_BUFFER_TYPE_LEVEL = 17,
24 RTC_BUFFER_TYPE_EDGE_CREASE_INDEX = 18,
25 RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT = 19,
26 RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX = 20,
27 RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT = 21,
28 RTC_BUFFER_TYPE_HOLE = 22,
29
30 RTC_BUFFER_TYPE_FLAGS = 32
31};
32
33/* Opaque buffer type */
34typedef struct RTCBufferTy* RTCBuffer;
35
36/* Creates a new buffer. */
37RTC_API RTCBuffer rtcNewBuffer(RTCDevice device, size_t byteSize);
38
39/* Creates a new shared buffer. */
40RTC_API RTCBuffer rtcNewSharedBuffer(RTCDevice device, void* ptr, size_t byteSize);
41
42/* Returns a pointer to the buffer data. */
43RTC_API void* rtcGetBufferData(RTCBuffer buffer);
44
45/* Retains the buffer (increments the reference count). */
46RTC_API void rtcRetainBuffer(RTCBuffer buffer);
47
48/* Releases the buffer (decrements the reference count). */
49RTC_API void rtcReleaseBuffer(RTCBuffer buffer);
50
51RTC_NAMESPACE_END
52