rtcore_buffer.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include "rtcore_device.h"
  5. RTC_NAMESPACE_BEGIN
  6. /* Types of buffers */
  7. enum RTCBufferType
  8. {
  9. RTC_BUFFER_TYPE_INDEX = 0,
  10. RTC_BUFFER_TYPE_VERTEX = 1,
  11. RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE = 2,
  12. RTC_BUFFER_TYPE_NORMAL = 3,
  13. RTC_BUFFER_TYPE_TANGENT = 4,
  14. RTC_BUFFER_TYPE_NORMAL_DERIVATIVE = 5,
  15. RTC_BUFFER_TYPE_GRID = 8,
  16. RTC_BUFFER_TYPE_FACE = 16,
  17. RTC_BUFFER_TYPE_LEVEL = 17,
  18. RTC_BUFFER_TYPE_EDGE_CREASE_INDEX = 18,
  19. RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT = 19,
  20. RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX = 20,
  21. RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT = 21,
  22. RTC_BUFFER_TYPE_HOLE = 22,
  23. RTC_BUFFER_TYPE_TRANSFORM = 23,
  24. RTC_BUFFER_TYPE_FLAGS = 32
  25. };
  26. /* Opaque buffer type */
  27. typedef struct RTCBufferTy* RTCBuffer;
  28. /* Creates a new buffer. */
  29. RTC_API RTCBuffer rtcNewBuffer(RTCDevice device, size_t byteSize);
  30. /* Creates a new buffer using explicit host device memory. */
  31. RTC_API RTCBuffer rtcNewBufferHostDevice(RTCDevice device, size_t byteSize);
  32. /* Creates a new shared buffer. */
  33. RTC_API RTCBuffer rtcNewSharedBuffer(RTCDevice device, void* ptr, size_t byteSize);
  34. /* Creates a new shared buffer using explicit host device memory. */
  35. RTC_API RTCBuffer rtcNewSharedBufferHostDevice(RTCDevice device, void* ptr, size_t byteSize);
  36. /* Synchronize host and device memory by copying data from host to device. */
  37. RTC_API void rtcCommitBuffer(RTCBuffer buffer);
  38. #if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
  39. RTC_API_CPP sycl::event rtcCommitBufferWithQueue(RTCBuffer buffer, sycl::queue queue);
  40. #endif
  41. /* Returns a pointer to the buffer data. */
  42. RTC_API void* rtcGetBufferData(RTCBuffer buffer);
  43. /* Returns a pointer to the buffer data on the device. Returns the same pointer as
  44. rtcGetBufferData if the device is no SYCL device or if Embree is executed on a
  45. system with unified memory (e.g., iGPUs). */
  46. RTC_API void* rtcGetBufferDataDevice(RTCBuffer buffer);
  47. /* Retains the buffer (increments the reference count). */
  48. RTC_API void rtcRetainBuffer(RTCBuffer buffer);
  49. /* Releases the buffer (decrements the reference count). */
  50. RTC_API void rtcReleaseBuffer(RTCBuffer buffer);
  51. RTC_NAMESPACE_END