NVIDIA OptiX 8.1 nvidia_logo_transpbg.gif Up
optix_host.h
Go to the documentation of this file.
1/*
2* SPDX-FileCopyrightText: Copyright (c) 2010 - 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3* SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4*
5* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6* property and proprietary rights in and to this material, related
7* documentation and any modifications thereto. Any use, reproduction
8* disclosure or distribution of this material and related documentation
9* without an express license agreement from NVIDIA CORPORATION or
10* its affiliates is strictly prohibited.
11*/
18
19#ifndef OPTIX_OPTIX_HOST_H
20#define OPTIX_OPTIX_HOST_H
21
24#ifndef OPTIXAPI
25# ifdef OPTIX_ENABLE_SDK_MIXING
26# define OPTIXAPI static
27# else // OPTIX_ENABLE_SDK_MIXING
28# ifdef __cplusplus
29# define OPTIXAPI extern "C"
30# else // __cplusplus
31# define OPTIXAPI
32# endif // __cplusplus
33# endif // OPTIX_ENABLE_SDK_MIXING
34#endif // OPTIXAPI
35
36#include "optix_types.h"
37#if !defined( OPTIX_DONT_INCLUDE_CUDA )
38// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other
39// means before including optix headers.
40#include <cuda.h>
41#endif
42
43#ifdef NV_MODULE_OPTIX
44// This is a mechanism to include <g_nvconfig.h> in driver builds only and translate any nvconfig macro to a custom OPTIX-specific macro, that can also be used in SDK builds/installs
45#include <exp/misc/optix_nvconfig_translate.h> // includes <g_nvconfig.h>
46#endif // NV_MODULE_OPTIX
47
48
51
54
55
67
79
81
83
84
104
114
122
137 OptixLogCallback callbackFunction,
138 void* callbackData,
139 unsigned int callbackLevel );
140
160
182
210OPTIXAPI OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark );
211
223OPTIXAPI OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize );
224
232OPTIXAPI OptixResult optixDeviceContextGetCacheDatabaseSizes( OptixDeviceContext context, size_t* lowWaterMark, size_t* highWaterMark );
233
235
237
238
263 const OptixPipelineCompileOptions* pipelineCompileOptions,
264 const OptixPipelineLinkOptions* pipelineLinkOptions,
265 const OptixProgramGroup* programGroups,
266 unsigned int numProgramGroups,
267 char* logString,
268 size_t* logStringSize,
269 OptixPipeline* pipeline );
270
273
297 unsigned int directCallableStackSizeFromTraversal,
298 unsigned int directCallableStackSizeFromState,
299 unsigned int continuationStackSize,
300 unsigned int maxTraversableGraphDepth );
301
303
305
306
337 const OptixModuleCompileOptions* moduleCompileOptions,
338 const OptixPipelineCompileOptions* pipelineCompileOptions,
339 const char* input,
340 size_t inputSize,
341 char* logString,
342 size_t* logStringSize,
343 OptixModule* module );
344
386 const OptixModuleCompileOptions* moduleCompileOptions,
387 const OptixPipelineCompileOptions* pipelineCompileOptions,
388 const char* input,
389 size_t inputSize,
390 char* logString,
391 size_t* logStringSize,
392 OptixModule* module,
393 OptixTask* firstTask );
394
402
409
414 const OptixModuleCompileOptions* moduleCompileOptions,
415 const OptixPipelineCompileOptions* pipelineCompileOptions,
416 const OptixBuiltinISOptions* builtinISOptions,
417 OptixModule* builtinModule );
418
420
422
423
442 OptixTask* additionalTasks,
443 unsigned int maxNumAdditionalTasks,
444 unsigned int* numAdditionalTasksCreated );
445
447
449
450
460
487 const OptixProgramGroupDesc* programDescriptions,
488 unsigned int numProgramGroups,
489 const OptixProgramGroupOptions* options,
490 char* logString,
491 size_t* logStringSize,
492 OptixProgramGroup* programGroups );
493
496
498
500
501
529 CUstream stream,
530 CUdeviceptr pipelineParams,
531 size_t pipelineParamsSize,
532 const OptixShaderBindingTable* sbt,
533 unsigned int width,
534 unsigned int height,
535 unsigned int depth );
536
539OPTIXAPI OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer );
540
542
544
545
552 const OptixAccelBuildOptions* accelOptions,
553 const OptixBuildInput* buildInputs,
554 unsigned int numBuildInputs,
555 OptixAccelBufferSizes* bufferSizes );
556
570 CUstream stream,
571 const OptixAccelBuildOptions* accelOptions,
572 const OptixBuildInput* buildInputs,
573 unsigned int numBuildInputs,
574 CUdeviceptr tempBuffer,
575 size_t tempBufferSizeInBytes,
576 CUdeviceptr outputBuffer,
577 size_t outputBufferSizeInBytes,
578 OptixTraversableHandle* outputHandle,
579 const OptixAccelEmitDesc* emittedProperties,
580 unsigned int numEmittedProperties );
581
600
613
652 CUstream stream,
653 const OptixRelocationInfo* info,
654 const OptixRelocateInput* relocateInputs,
655 size_t numRelocateInputs,
656 CUdeviceptr targetAccel,
657 size_t targetAccelSizeInBytes,
658 OptixTraversableHandle* targetHandle );
659
678 CUstream stream,
679 OptixTraversableHandle inputHandle,
680 CUdeviceptr outputBuffer,
681 size_t outputBufferSizeInBytes,
682 OptixTraversableHandle* outputHandle );
683
693 CUstream stream,
695 const OptixAccelEmitDesc* emittedProperty );
696
702 CUdeviceptr pointer,
703 OptixTraversableType traversableType,
704 OptixTraversableHandle* traversableHandle );
705
706
713 const OptixOpacityMicromapArrayBuildInput* buildInput,
714 OptixMicromapBufferSizes* bufferSizes );
715
739 CUstream stream,
740 const OptixOpacityMicromapArrayBuildInput* buildInput,
741 const OptixMicromapBuffers* buffers );
742
759 CUdeviceptr opacityMicromapArray,
760 OptixRelocationInfo* info );
761
789 CUstream stream,
790 const OptixRelocationInfo* info,
791 CUdeviceptr targetOpacityMicromapArray,
792 size_t targetOpacityMicromapArraySizeInBytes );
793
801 OptixMicromapBufferSizes* bufferSizes );
802
816 CUstream stream,
818 const OptixMicromapBuffers* buffers );
819
820
822
824
825
838 OptixDenoiserModelKind modelKind,
839 const OptixDenoiserOptions* options,
840 OptixDenoiser* denoiser );
841
855 const void* userData,
856 size_t userDataSizeInBytes,
857 OptixDenoiser* denoiser );
858
861
882 unsigned int outputWidth,
883 unsigned int outputHeight,
884 OptixDenoiserSizes* returnSizes );
885
903 CUstream stream,
904 unsigned int inputWidth,
905 unsigned int inputHeight,
906 CUdeviceptr denoiserState,
907 size_t denoiserStateSizeInBytes,
908 CUdeviceptr scratch,
909 size_t scratchSizeInBytes );
910
977 CUstream stream,
978 const OptixDenoiserParams* params,
979 CUdeviceptr denoiserState,
980 size_t denoiserStateSizeInBytes,
981 const OptixDenoiserGuideLayer* guideLayer,
982 const OptixDenoiserLayer* layers,
983 unsigned int numLayers,
984 unsigned int inputOffsetX,
985 unsigned int inputOffsetY,
986 CUdeviceptr scratch,
987 size_t scratchSizeInBytes );
988
1013 CUstream stream,
1014 const OptixImage2D* inputImage,
1015 CUdeviceptr outputIntensity,
1016 CUdeviceptr scratch,
1017 size_t scratchSizeInBytes );
1018
1034 CUstream stream,
1035 const OptixImage2D* inputImage,
1036 CUdeviceptr outputAverageColor,
1037 CUdeviceptr scratch,
1038 size_t scratchSizeInBytes );
1039
1041
1042#include "optix_function_table.h"
1043
1044#endif // OPTIX_OPTIX_HOST_H
struct OptixProgramGroup_t * OptixProgramGroup
Opaque type representing a program group.
Definition: optix_types.h:56
struct OptixDenoiser_t * OptixDenoiser
Opaque type representing a denoiser instance.
Definition: optix_types.h:62
OptixDeviceProperty
Parameters used for optixDeviceContextGetProperty()
Definition: optix_types.h:191
unsigned long long CUdeviceptr
CUDA device pointer.
Definition: optix_types.h:43
OptixResult
Result codes returned from API functions.
Definition: optix_types.h:143
OptixModuleCompileState
Module compilation state.
Definition: optix_types.h:1917
struct OptixModule_t * OptixModule
Opaque type representing a module.
Definition: optix_types.h:53
OptixDenoiserModelKind
Model kind used by the denoiser.
Definition: optix_types.h:1608
struct OptixPipeline_t * OptixPipeline
Opaque type representing a pipeline.
Definition: optix_types.h:59
unsigned long long OptixTraversableHandle
Traversable handle.
Definition: optix_types.h:68
OptixTraversableType
Traversable Handles.
Definition: optix_types.h:1555
void(* OptixLogCallback)(unsigned int level, const char *tag, const char *message, void *cbdata)
Type of the callback function used for log messages.
Definition: optix_types.h:257
struct OptixTask_t * OptixTask
Opaque type representing a work task.
Definition: optix_types.h:65
struct OptixDeviceContext_t * OptixDeviceContext
Opaque type representing a device context.
Definition: optix_types.h:50
OptiX public API header.
OPTIXAPI OptixResult optixOpacityMicromapArrayBuild(OptixDeviceContext context, CUstream stream, const OptixOpacityMicromapArrayBuildInput *buildInput, const OptixMicromapBuffers *buffers)
Construct an array of Opacity Micromaps.
OPTIXAPI OptixResult optixOpacityMicromapArrayComputeMemoryUsage(OptixDeviceContext context, const OptixOpacityMicromapArrayBuildInput *buildInput, OptixMicromapBufferSizes *bufferSizes)
Determine the amount of memory necessary for a Opacity Micromap Array build.
OPTIXAPI OptixResult optixDeviceContextCreate(CUcontext fromContext, const OptixDeviceContextOptions *options, OptixDeviceContext *context)
Create a device context associated with the CUDA context specified with 'fromContext'.
OPTIXAPI OptixResult optixPipelineCreate(OptixDeviceContext context, const OptixPipelineCompileOptions *pipelineCompileOptions, const OptixPipelineLinkOptions *pipelineLinkOptions, const OptixProgramGroup *programGroups, unsigned int numProgramGroups, char *logString, size_t *logStringSize, OptixPipeline *pipeline)
logString is an optional buffer that contains compiler feedback and errors. This information is also ...
OPTIXAPI const char * optixGetErrorString(OptixResult result)
Returns the description string for an error code.
#define OPTIXAPI
Mixing multiple SDKs in a single application will result in symbol collisions. To enable different co...
Definition: optix_host.h:31
OPTIXAPI OptixResult optixDeviceContextSetLogCallback(OptixDeviceContext context, OptixLogCallback callbackFunction, void *callbackData, unsigned int callbackLevel)
Sets the current log callback method.
OPTIXAPI OptixResult optixDeviceContextDestroy(OptixDeviceContext context)
Destroys all CPU and GPU state associated with the device.
OPTIXAPI OptixResult optixAccelEmitProperty(OptixDeviceContext context, CUstream stream, OptixTraversableHandle handle, const OptixAccelEmitDesc *emittedProperty)
Emit a single property after an acceleration structure was built. The result buffer of the ' emittedP...
OPTIXAPI OptixResult optixAccelBuild(OptixDeviceContext context, CUstream stream, const OptixAccelBuildOptions *accelOptions, const OptixBuildInput *buildInputs, unsigned int numBuildInputs, CUdeviceptr tempBuffer, size_t tempBufferSizeInBytes, CUdeviceptr outputBuffer, size_t outputBufferSizeInBytes, OptixTraversableHandle *outputHandle, const OptixAccelEmitDesc *emittedProperties, unsigned int numEmittedProperties)
OPTIXAPI OptixResult optixBuiltinISModuleGet(OptixDeviceContext context, const OptixModuleCompileOptions *moduleCompileOptions, const OptixPipelineCompileOptions *pipelineCompileOptions, const OptixBuiltinISOptions *builtinISOptions, OptixModule *builtinModule)
Returns a module containing the intersection program for the built-in primitive type specified by the...
OPTIXAPI OptixResult optixDenoiserCreate(OptixDeviceContext context, OptixDenoiserModelKind modelKind, const OptixDenoiserOptions *options, OptixDenoiser *denoiser)
Creates a denoiser object with the given options, using built-in inference models.
OPTIXAPI OptixResult optixDeviceContextGetCacheLocation(OptixDeviceContext context, char *location, size_t locationSize)
Returns the location of the disk cache. If the cache has been disabled by setting the environment var...
OPTIXAPI OptixResult optixLaunch(OptixPipeline pipeline, CUstream stream, CUdeviceptr pipelineParams, size_t pipelineParamsSize, const OptixShaderBindingTable *sbt, unsigned int width, unsigned int height, unsigned int depth)
Where the magic happens.
OPTIXAPI OptixResult optixPipelineDestroy(OptixPipeline pipeline)
Thread safety: A pipeline must not be destroyed while it is still in use by concurrent API calls in o...
OPTIXAPI OptixResult optixDenoiserCreateWithUserModel(OptixDeviceContext context, const void *userData, size_t userDataSizeInBytes, OptixDenoiser *denoiser)
Creates a denoiser object with the given options, using a provided inference model.
OPTIXAPI OptixResult optixDeviceContextGetCacheEnabled(OptixDeviceContext context, int *enabled)
Indicates whether the disk cache is enabled or disabled.
OPTIXAPI OptixResult optixDisplacementMicromapArrayComputeMemoryUsage(OptixDeviceContext context, const OptixDisplacementMicromapArrayBuildInput *buildInput, OptixMicromapBufferSizes *bufferSizes)
Determine the amount of memory necessary for a Displacement Micromap Array build.
OPTIXAPI OptixResult optixDenoiserComputeAverageColor(OptixDenoiser denoiser, CUstream stream, const OptixImage2D *inputImage, CUdeviceptr outputAverageColor, CUdeviceptr scratch, size_t scratchSizeInBytes)
Compute average logarithmic for each of the first three channels for the given image....
OPTIXAPI OptixResult optixModuleCreate(OptixDeviceContext context, const OptixModuleCompileOptions *moduleCompileOptions, const OptixPipelineCompileOptions *pipelineCompileOptions, const char *input, size_t inputSize, char *logString, size_t *logStringSize, OptixModule *module)
Compiling programs into a module. These programs can be passed in as either PTX or OptiX-IR.
OPTIXAPI OptixResult optixSbtRecordPackHeader(OptixProgramGroup programGroup, void *sbtRecordHeaderHostPointer)
OPTIXAPI OptixResult optixModuleDestroy(OptixModule module)
Call for OptixModule objects created with optixModuleCreate and optixModuleDeserialize.
OPTIXAPI OptixResult optixConvertPointerToTraversableHandle(OptixDeviceContext onDevice, CUdeviceptr pointer, OptixTraversableType traversableType, OptixTraversableHandle *traversableHandle)
OPTIXAPI OptixResult optixDenoiserDestroy(OptixDenoiser denoiser)
Destroys the denoiser object and any associated host resources.
OPTIXAPI const char * optixGetErrorName(OptixResult result)
Returns a string containing the name of an error code in the enum.
OPTIXAPI OptixResult optixAccelComputeMemoryUsage(OptixDeviceContext context, const OptixAccelBuildOptions *accelOptions, const OptixBuildInput *buildInputs, unsigned int numBuildInputs, OptixAccelBufferSizes *bufferSizes)
OPTIXAPI OptixResult optixDenoiserSetup(OptixDenoiser denoiser, CUstream stream, unsigned int inputWidth, unsigned int inputHeight, CUdeviceptr denoiserState, size_t denoiserStateSizeInBytes, CUdeviceptr scratch, size_t scratchSizeInBytes)
Initializes the state required by the denoiser.
OPTIXAPI OptixResult optixAccelRelocate(OptixDeviceContext context, CUstream stream, const OptixRelocationInfo *info, const OptixRelocateInput *relocateInputs, size_t numRelocateInputs, CUdeviceptr targetAccel, size_t targetAccelSizeInBytes, OptixTraversableHandle *targetHandle)
optixAccelRelocate is called to update the acceleration structure after it has been relocated....
OPTIXAPI OptixResult optixAccelGetRelocationInfo(OptixDeviceContext context, OptixTraversableHandle handle, OptixRelocationInfo *info)
Obtain relocation information, stored in OptixRelocationInfo, for a given context and acceleration st...
OPTIXAPI OptixResult optixProgramGroupDestroy(OptixProgramGroup programGroup)
Thread safety: A program group must not be destroyed while it is still in use by concurrent API calls...
OPTIXAPI OptixResult optixDeviceContextGetProperty(OptixDeviceContext context, OptixDeviceProperty property, void *value, size_t sizeInBytes)
Query properties of a device context.
OPTIXAPI OptixResult optixAccelCompact(OptixDeviceContext context, CUstream stream, OptixTraversableHandle inputHandle, CUdeviceptr outputBuffer, size_t outputBufferSizeInBytes, OptixTraversableHandle *outputHandle)
After building an acceleration structure, it can be copied in a compacted form to reduce memory....
OPTIXAPI OptixResult optixProgramGroupCreate(OptixDeviceContext context, const OptixProgramGroupDesc *programDescriptions, unsigned int numProgramGroups, const OptixProgramGroupOptions *options, char *logString, size_t *logStringSize, OptixProgramGroup *programGroups)
logString is an optional buffer that contains compiler feedback and errors. This information is also ...
OPTIXAPI OptixResult optixOpacityMicromapArrayRelocate(OptixDeviceContext context, CUstream stream, const OptixRelocationInfo *info, CUdeviceptr targetOpacityMicromapArray, size_t targetOpacityMicromapArraySizeInBytes)
optixOpacityMicromapArrayRelocate is called to update the opacity micromap array after it has been re...
OPTIXAPI OptixResult optixDenoiserComputeMemoryResources(const OptixDenoiser denoiser, unsigned int outputWidth, unsigned int outputHeight, OptixDenoiserSizes *returnSizes)
Computes the GPU memory resources required to execute the denoiser.
OPTIXAPI OptixResult optixDeviceContextSetCacheLocation(OptixDeviceContext context, const char *location)
Sets the location of the disk cache.
OPTIXAPI OptixResult optixOpacityMicromapArrayGetRelocationInfo(OptixDeviceContext context, CUdeviceptr opacityMicromapArray, OptixRelocationInfo *info)
Obtain relocation information, stored in OptixRelocationInfo, for a given context and opacity microma...
OPTIXAPI OptixResult optixModuleCreateWithTasks(OptixDeviceContext context, const OptixModuleCompileOptions *moduleCompileOptions, const OptixPipelineCompileOptions *pipelineCompileOptions, const char *input, size_t inputSize, char *logString, size_t *logStringSize, OptixModule *module, OptixTask *firstTask)
This function is designed to do just enough work to create the OptixTask return parameter and is expe...
OPTIXAPI OptixResult optixProgramGroupGetStackSize(OptixProgramGroup programGroup, OptixStackSizes *stackSizes, OptixPipeline pipeline)
Returns the stack sizes for the given program group. When programs in this programGroup are relying o...
OPTIXAPI OptixResult optixModuleGetCompilationState(OptixModule module, OptixModuleCompileState *state)
When creating a module with tasks, the current state of the module can be queried using this function...
OPTIXAPI OptixResult optixDisplacementMicromapArrayBuild(OptixDeviceContext context, CUstream stream, const OptixDisplacementMicromapArrayBuildInput *buildInput, const OptixMicromapBuffers *buffers)
Construct an array of Displacement Micromaps (DMMs).
OPTIXAPI OptixResult optixDenoiserInvoke(OptixDenoiser denoiser, CUstream stream, const OptixDenoiserParams *params, CUdeviceptr denoiserState, size_t denoiserStateSizeInBytes, const OptixDenoiserGuideLayer *guideLayer, const OptixDenoiserLayer *layers, unsigned int numLayers, unsigned int inputOffsetX, unsigned int inputOffsetY, CUdeviceptr scratch, size_t scratchSizeInBytes)
Invokes denoiser on a set of input data and produces at least one output image. State memory must be ...
OPTIXAPI OptixResult optixDenoiserComputeIntensity(OptixDenoiser denoiser, CUstream stream, const OptixImage2D *inputImage, CUdeviceptr outputIntensity, CUdeviceptr scratch, size_t scratchSizeInBytes)
Computes the logarithmic average intensity of the given image. The returned value 'outputIntensity' i...
OPTIXAPI OptixResult optixDeviceContextSetCacheEnabled(OptixDeviceContext context, int enabled)
Enables or disables the disk cache.
OPTIXAPI OptixResult optixDeviceContextGetCacheDatabaseSizes(OptixDeviceContext context, size_t *lowWaterMark, size_t *highWaterMark)
Returns the low and high water marks for disk cache garbage collection. If the cache has been disable...
OPTIXAPI OptixResult optixTaskExecute(OptixTask task, OptixTask *additionalTasks, unsigned int maxNumAdditionalTasks, unsigned int *numAdditionalTasksCreated)
Each OptixTask should be executed with optixTaskExecute(). If additional parallel work is found,...
OPTIXAPI OptixResult optixCheckRelocationCompatibility(OptixDeviceContext context, const OptixRelocationInfo *info, int *compatible)
Checks if an optix data structure built using another OptixDeviceContext (that was used to fill in 'i...
OPTIXAPI OptixResult optixPipelineSetStackSize(OptixPipeline pipeline, unsigned int directCallableStackSizeFromTraversal, unsigned int directCallableStackSizeFromState, unsigned int continuationStackSize, unsigned int maxTraversableGraphDepth)
Sets the stack sizes for a pipeline.
OPTIXAPI OptixResult optixDeviceContextSetCacheDatabaseSizes(OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark)
Sets the low and high water marks for disk cache garbage collection.
OptiX public API header.
Struct for querying builder allocation requirements.
Definition: optix_types.h:1352
Build options for acceleration structures.
Definition: optix_types.h:1330
Specifies a type and output destination for emitted post-build properties.
Definition: optix_types.h:1384
Build inputs.
Definition: optix_types.h:1031
Specifies the options for retrieving an intersection program for a built-in primitive type....
Definition: optix_types.h:2372
Guide layer for the denoiser.
Definition: optix_types.h:1663
Input/Output layers for the denoiser.
Definition: optix_types.h:1707
Options used by the denoiser.
Definition: optix_types.h:1648
Various parameters used by the denoiser.
Definition: optix_types.h:1728
Various sizes related to the denoiser.
Definition: optix_types.h:1759
Parameters used for optixDeviceContextCreate()
Definition: optix_types.h:276
Inputs to displacement micromaps array construction.
Definition: optix_types.h:532
Image descriptor used by the denoiser.
Definition: optix_types.h:1586
Conservative memory requirements for building a opacity/displacement micromap array.
Definition: optix_types.h:1258
Buffer inputs for opacity/displacement micromap array builds.
Definition: optix_types.h:1265
Compilation options for module.
Definition: optix_types.h:2044
Inputs to opacity micromap array construction.
Definition: optix_types.h:1233
Compilation options for all modules of a pipeline.
Definition: optix_types.h:2247
Descriptor for program groups.
Definition: optix_types.h:2155
Program group options.
Definition: optix_types.h:2181
Relocation inputs.
Definition: optix_types.h:1055
Used to store information related to relocation of optix data structures.
Definition: optix_types.h:1397
Describes the shader binding table (SBT)
Definition: optix_types.h:2293
Describes the stack size requirements of a program group.
Definition: optix_types.h:2333