NVIDIA OptiX 7.7 nvidia_logo_transpbg.gif Up
optix_host.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 NVIDIA Corporation. All rights reserved.
3 *
4 * NVIDIA Corporation and its licensors retain all intellectual property and proprietary
5 * rights in and to this software, related documentation and any modifications thereto.
6 * Any use, reproduction, disclosure or distribution of this software and related
7 * documentation without an express license agreement from NVIDIA Corporation is strictly
8 * prohibited.
9 *
10 * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
11 * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
12 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
13 * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
14 * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
15 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
16 * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
17 * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
18 * SUCH DAMAGES
19 */
20
27
28#ifndef OPTIX_OPTIX_HOST_H
29#define OPTIX_OPTIX_HOST_H
30
31#include "optix_types.h"
32#if !defined( OPTIX_DONT_INCLUDE_CUDA )
33// If OPTIX_DONT_INCLUDE_CUDA is defined, cuda driver types must be defined through other
34// means before including optix headers.
35#include <cuda.h>
36#endif
37
38#ifdef NV_MODULE_OPTIX
39// 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
40#include <exp/misc/optix_nvconfig_translate.h> // includes <g_nvconfig.h>
41#endif // NV_MODULE_OPTIX
42
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
50
53
54
65const char* optixGetErrorName( OptixResult result );
66
77const char* optixGetErrorString( OptixResult result );
78
80
82
83
102OptixResult optixDeviceContextCreate( CUcontext fromContext, const OptixDeviceContextOptions* options, OptixDeviceContext* context );
103
113
120OptixResult optixDeviceContextGetProperty( OptixDeviceContext context, OptixDeviceProperty property, void* value, size_t sizeInBytes );
121
136 OptixLogCallback callbackFunction,
137 void* callbackData,
138 unsigned int callbackLevel );
139
159 int enabled );
160
182
210OptixResult optixDeviceContextSetCacheDatabaseSizes( OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark );
211
223OptixResult optixDeviceContextGetCacheLocation( OptixDeviceContext context, char* location, size_t locationSize );
224
232OptixResult 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
364
377
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
441OptixResult optixTaskExecute( OptixTask task, OptixTask* additionalTasks, unsigned int maxNumAdditionalTasks, unsigned int* numAdditionalTasksCreated );
442
444
446
447
457
484 const OptixProgramGroupDesc* programDescriptions,
485 unsigned int numProgramGroups,
486 const OptixProgramGroupOptions* options,
487 char* logString,
488 size_t* logStringSize,
489 OptixProgramGroup* programGroups );
490
493
495
497
498
526 CUstream stream,
527 CUdeviceptr pipelineParams,
528 size_t pipelineParamsSize,
529 const OptixShaderBindingTable* sbt,
530 unsigned int width,
531 unsigned int height,
532 unsigned int depth );
533
536OptixResult optixSbtRecordPackHeader( OptixProgramGroup programGroup, void* sbtRecordHeaderHostPointer );
537
539
541
542
549 const OptixAccelBuildOptions* accelOptions,
550 const OptixBuildInput* buildInputs,
551 unsigned int numBuildInputs,
552 OptixAccelBufferSizes* bufferSizes );
553
567 CUstream stream,
568 const OptixAccelBuildOptions* accelOptions,
569 const OptixBuildInput* buildInputs,
570 unsigned int numBuildInputs,
571 CUdeviceptr tempBuffer,
572 size_t tempBufferSizeInBytes,
573 CUdeviceptr outputBuffer,
574 size_t outputBufferSizeInBytes,
575 OptixTraversableHandle* outputHandle,
576 const OptixAccelEmitDesc* emittedProperties,
577 unsigned int numEmittedProperties );
578
597
610
649 CUstream stream,
650 const OptixRelocationInfo* info,
651 const OptixRelocateInput* relocateInputs,
652 size_t numRelocateInputs,
653 CUdeviceptr targetAccel,
654 size_t targetAccelSizeInBytes,
655 OptixTraversableHandle* targetHandle );
656
675 CUstream stream,
676 OptixTraversableHandle inputHandle,
677 CUdeviceptr outputBuffer,
678 size_t outputBufferSizeInBytes,
679 OptixTraversableHandle* outputHandle );
680
690 CUstream stream,
692 const OptixAccelEmitDesc* emittedProperty );
693
699 CUdeviceptr pointer,
700 OptixTraversableType traversableType,
701 OptixTraversableHandle* traversableHandle );
702
703
710 const OptixOpacityMicromapArrayBuildInput* buildInput,
711 OptixMicromapBufferSizes* bufferSizes );
712
736 CUstream stream,
737 const OptixOpacityMicromapArrayBuildInput* buildInput,
738 const OptixMicromapBuffers* buffers );
739
756
784 CUstream stream,
785 const OptixRelocationInfo* info,
786 CUdeviceptr targetOpacityMicromapArray,
787 size_t targetOpacityMicromapArraySizeInBytes );
788
796 OptixMicromapBufferSizes* bufferSizes );
797
812 CUstream stream,
814 const OptixMicromapBuffers* buffers );
815
816
818
820
821
834 OptixDenoiserModelKind modelKind,
835 const OptixDenoiserOptions* options,
836 OptixDenoiser* denoiser );
837
851 const void* userData, size_t userDataSizeInBytes, OptixDenoiser* denoiser );
852
855
876 unsigned int outputWidth,
877 unsigned int outputHeight,
878 OptixDenoiserSizes* returnSizes );
879
897 CUstream stream,
898 unsigned int inputWidth,
899 unsigned int inputHeight,
900 CUdeviceptr denoiserState,
901 size_t denoiserStateSizeInBytes,
902 CUdeviceptr scratch,
903 size_t scratchSizeInBytes );
904
971 CUstream stream,
972 const OptixDenoiserParams* params,
973 CUdeviceptr denoiserState,
974 size_t denoiserStateSizeInBytes,
975 const OptixDenoiserGuideLayer* guideLayer,
976 const OptixDenoiserLayer* layers,
977 unsigned int numLayers,
978 unsigned int inputOffsetX,
979 unsigned int inputOffsetY,
980 CUdeviceptr scratch,
981 size_t scratchSizeInBytes );
982
1007 CUstream stream,
1008 const OptixImage2D* inputImage,
1009 CUdeviceptr outputIntensity,
1010 CUdeviceptr scratch,
1011 size_t scratchSizeInBytes );
1012
1028 CUstream stream,
1029 const OptixImage2D* inputImage,
1030 CUdeviceptr outputAverageColor,
1031 CUdeviceptr scratch,
1032 size_t scratchSizeInBytes );
1033
1035
1036#ifdef __cplusplus
1037}
1038#endif
1039
1040#include "optix_function_table.h"
1041
1042#endif // OPTIX_OPTIX_HOST_H
struct OptixProgramGroup_t * OptixProgramGroup
Opaque type representing a program group.
Definition: optix_types.h:65
struct OptixDenoiser_t * OptixDenoiser
Opaque type representing a denoiser instance.
Definition: optix_types.h:71
OptixDeviceProperty
Parameters used for optixDeviceContextGetProperty()
Definition: optix_types.h:200
unsigned long long CUdeviceptr
CUDA device pointer.
Definition: optix_types.h:52
OptixResult
Result codes returned from API functions.
Definition: optix_types.h:152
OptixModuleCompileState
Module compilation state.
Definition: optix_types.h:1898
struct OptixModule_t * OptixModule
Opaque type representing a module.
Definition: optix_types.h:62
OptixDenoiserModelKind
Model kind used by the denoiser.
Definition: optix_types.h:1595
struct OptixPipeline_t * OptixPipeline
Opaque type representing a pipeline.
Definition: optix_types.h:68
unsigned long long OptixTraversableHandle
Traversable handle.
Definition: optix_types.h:77
OptixTraversableType
Traversable Handles.
Definition: optix_types.h:1542
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:261
struct OptixTask_t * OptixTask
Opaque type representing a work task.
Definition: optix_types.h:74
struct OptixDeviceContext_t * OptixDeviceContext
Opaque type representing a device context.
Definition: optix_types.h:59
OptiX public API header.
OptixResult optixConvertPointerToTraversableHandle(OptixDeviceContext onDevice, CUdeviceptr pointer, OptixTraversableType traversableType, OptixTraversableHandle *traversableHandle)
OptixResult optixSbtRecordPackHeader(OptixProgramGroup programGroup, void *sbtRecordHeaderHostPointer)
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.
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...
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...
OptixResult optixDeviceContextGetCacheEnabled(OptixDeviceContext context, int *enabled)
Indicates whether the disk cache is enabled or disabled.
OptixResult optixPipelineDestroy(OptixPipeline pipeline)
Thread safety: A pipeline must not be destroyed while it is still in use by concurrent API calls in o...
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...
OptixResult optixDisplacementMicromapArrayComputeMemoryUsage(OptixDeviceContext context, const OptixDisplacementMicromapArrayBuildInput *buildInput, OptixMicromapBufferSizes *bufferSizes)
Determine the amount of memory necessary for a Displacement Micromap Array build.
OptixResult optixDenoiserComputeMemoryResources(const OptixDenoiser denoiser, unsigned int outputWidth, unsigned int outputHeight, OptixDenoiserSizes *returnSizes)
Computes the GPU memory resources required to execute the denoiser.
OptixResult optixDeviceContextSetCacheEnabled(OptixDeviceContext context, int enabled)
Enables or disables the disk cache.
OptixResult optixDenoiserCreate(OptixDeviceContext context, OptixDenoiserModelKind modelKind, const OptixDenoiserOptions *options, OptixDenoiser *denoiser)
Creates a denoiser object with the given options, using built-in inference models.
OptixResult optixDeviceContextSetLogCallback(OptixDeviceContext context, OptixLogCallback callbackFunction, void *callbackData, unsigned int callbackLevel)
Sets the current log callback method.
OptixResult optixDeviceContextDestroy(OptixDeviceContext context)
Destroys all CPU and GPU state associated with the device.
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...
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 ...
OptixResult optixOpacityMicromapArrayGetRelocationInfo(OptixDeviceContext context, CUdeviceptr opacityMicromapArray, OptixRelocationInfo *info)
Obtain relocation information, stored in OptixRelocationInfo, for a given context and opacity microma...
OptixResult optixDeviceContextSetCacheLocation(OptixDeviceContext context, const char *location)
Sets the location of the disk cache.
OptixResult optixAccelGetRelocationInfo(OptixDeviceContext context, OptixTraversableHandle handle, OptixRelocationInfo *info)
Obtain relocation information, stored in OptixRelocationInfo, for a given context and acceleration st...
OptixResult optixOpacityMicromapArrayBuild(OptixDeviceContext context, CUstream stream, const OptixOpacityMicromapArrayBuildInput *buildInput, const OptixMicromapBuffers *buffers)
Construct an array of Opacity Micromaps.
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.
OptixResult optixOpacityMicromapArrayComputeMemoryUsage(OptixDeviceContext context, const OptixOpacityMicromapArrayBuildInput *buildInput, OptixMicromapBufferSizes *bufferSizes)
Determine the amount of memory necessary for a Opacity Micromap Array build.
const char * optixGetErrorString(OptixResult result)
Returns the description string for an error code.
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....
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...
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.
OptixResult optixDenoiserDestroy(OptixDenoiser denoiser)
Destroys the denoiser object and any associated host resources.
const char * optixGetErrorName(OptixResult result)
Returns a string containing the name of an error code in the enum.
OptixResult optixDeviceContextGetProperty(OptixDeviceContext context, OptixDeviceProperty property, void *value, size_t sizeInBytes)
Query properties of a device context.
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 ...
OptixResult optixAccelComputeMemoryUsage(OptixDeviceContext context, const OptixAccelBuildOptions *accelOptions, const OptixBuildInput *buildInputs, unsigned int numBuildInputs, OptixAccelBufferSizes *bufferSizes)
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....
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)
OptixResult optixModuleGetCompilationState(OptixModule module, OptixModuleCompileState *state)
When creating a module with tasks, the current state of the module can be queried using this function...
OptixResult optixDisplacementMicromapArrayBuild(OptixDeviceContext context, CUstream stream, const OptixDisplacementMicromapArrayBuildInput *buildInput, const OptixMicromapBuffers *buffers)
FIXME Construct an array of Displacement Micromap (DMMs).
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...
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...
OptixResult optixDeviceContextSetCacheDatabaseSizes(OptixDeviceContext context, size_t lowWaterMark, size_t highWaterMark)
Sets the low and high water marks for disk cache garbage collection.
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....
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.
OptixResult optixDeviceContextCreate(CUcontext fromContext, const OptixDeviceContextOptions *options, OptixDeviceContext *context)
Create a device context associated with the CUDA context specified with 'fromContext'.
OptixResult optixModuleDestroy(OptixModule module)
Call for OptixModule objects created with optixModuleCreate and optixModuleDeserialize.
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 ...
OptixResult optixPipelineSetStackSize(OptixPipeline pipeline, unsigned int directCallableStackSizeFromTraversal, unsigned int directCallableStackSizeFromState, unsigned int continuationStackSize, unsigned int maxTraversableGraphDepth)
Sets the stack sizes for a pipeline.
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...
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...
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,...
OptixResult optixProgramGroupDestroy(OptixProgramGroup programGroup)
Thread safety: A program group must not be destroyed while it is still in use by concurrent API calls...
OptiX public API header.
Struct for querying builder allocation requirements.
Definition: optix_types.h:1339
Build options for acceleration structures.
Definition: optix_types.h:1317
Specifies a type and output destination for emitted post-build properties.
Definition: optix_types.h:1371
Build inputs.
Definition: optix_types.h:1018
Specifies the options for retrieving an intersection program for a built-in primitive type....
Definition: optix_types.h:2434
Guide layer for the denoiser.
Definition: optix_types.h:1635
Input/Output layers for the denoiser.
Definition: optix_types.h:1676
Options used by the denoiser.
Definition: optix_types.h:1623
Definition: optix_types.h:1708
Various sizes related to the denoiser.
Definition: optix_types.h:1740
Parameters used for optixDeviceContextCreate()
Definition: optix_types.h:280
Inputs to displacement micromaps array construction.
Definition: optix_types.h:519
Image descriptor used by the denoiser.
Definition: optix_types.h:1573
Conservative memory requirements for building a opacity/displacement micromap array.
Definition: optix_types.h:1245
Buffer inputs for opacity/displacement micromap array builds.
Definition: optix_types.h:1252
Compilation options for module.
Definition: optix_types.h:2025
Inputs to opacity micromap array construction.
Definition: optix_types.h:1220
Compilation options for all modules of a pipeline.
Definition: optix_types.h:2309
Descriptor for program groups.
Definition: optix_types.h:2136
Program group options.
Definition: optix_types.h:2162
Relocation inputs.
Definition: optix_types.h:1042
Used to store information related to relocation of optix data structures.
Definition: optix_types.h:1384
Describes the shader binding table (SBT)
Definition: optix_types.h:2355
Describes the stack size requirements of a program group.
Definition: optix_types.h:2395