OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Types | Public Member Functions | List of all members
optix::bufferId< T, Dim > Struct Template Reference

Detailed Description

template<typename T, int Dim>
struct optix::bufferId< T, Dim >

bufferId is a host version of the device side bufferId.

Use bufferId to define types that can be included from both the host and device code. This class provides a container that can be used to transport the buffer id back and forth between host and device code. The bufferId class is useful, because it can take a buffer id obtained from rtBufferGetId and provide accessors similar to the buffer class.

"bindless_type.h" used by both host and device code:

#include <optix_world.h>
struct BufInfo {
int val;
rtBufferId<int, 1> data;
};

Host code:

#include "bindless_type.h"
BufInfo input_buffer_info;
input_buffer_info.val = 0;
input_buffer_info.data = rtBufferId<int,1>(inputBuffer0->getId());
context["input_buffer_info"]->setUserData(sizeof(BufInfo), &input_buffer_info);

Device code:

#include "bindless_type.h"
rtBuffer<int,1> result;
rtDeclareVariable(BufInfo, input_buffer_info, ,);
RT_PROGRAM void bindless()
{
int value = input_buffer_info.data[input_buffer_info.val];
result[0] = value;
}
Inheritance diagram for optix::bufferId< T, Dim >:
optix::buffer< T, Dim >

Public Types

typedef buffer< T, Dim >
::WrapperType 
WrapperType
 
typedef buffer< T, Dim >::IndexType IndexType
 
- Public Types inherited from optix::buffer< T, Dim >
typedef VectorTypes< size_t, Dim > WrapperType
 
typedef VectorTypes< size_t,
Dim >::Type 
IndexType
 

Public Member Functions

__device__ __forceinline__ bufferId (RTbufferidnull nullid)
 
__device__ __forceinline__ bufferId (int id)
 
__device__ __forceinline__
bufferId
operator= (RTbufferidnull nullid)
 
__device__ __forceinline__
IndexType 
size () const
 
__device__ __forceinline__ T & operator[] (IndexType i) const
 
__device__ __forceinline__ int getId () const
 
__device__ __forceinline__ operator bool () const
 
 bufferId (int id)
 
int getId () const
 
- Public Member Functions inherited from optix::buffer< T, Dim >
__device__ __forceinline__
IndexType 
size () const
 
__device__ __forceinline__ T & operator[] (IndexType i)
 

Additional Inherited Members

- Static Protected Member Functions inherited from optix::buffer< T, Dim >
__inline__ static __device__
size_t4 
make_index (size_t v0)
 
__inline__ static __device__
size_t4 
make_index (size_t2 v0)
 
__inline__ static __device__
size_t4 
make_index (size_t3 v0)
 
__inline__ static __device__
size_t4 
make_index (size_t4 v0)
 
template<typename T2 >
__device__ static
__forceinline__ void * 
create (type< T2 >, void *v)
 
template<typename T2 , int Dim2>
__device__ static
__forceinline__ void * 
create (type< bufferId< T2, Dim2 > >, void *v)