@@ -3,14 +3,22 @@ from .context cimport OptixDeviceContext, OptixContextObject
33from libcpp.vector cimport vector
44from .base cimport OptixObject
55from libc.stdint cimport uintptr_t
6+ from libcpp cimport bool
67
78cdef extern from " optix_includes.h" nogil:
8- cdef enum OptixDenoiserModelKind:
9- OPTIX_DENOISER_MODEL_KIND_LDR
10- OPTIX_DENOISER_MODEL_KIND_HDR
11- OPTIX_DENOISER_MODEL_KIND_AOV
12- OPTIX_DENOISER_MODEL_KIND_TEMPORAL
13- OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV
9+ IF _OPTIX_VERSION > 70300 :
10+ cdef enum OptixDenoiserModelKind:
11+ OPTIX_DENOISER_MODEL_KIND_LDR
12+ OPTIX_DENOISER_MODEL_KIND_HDR
13+ OPTIX_DENOISER_MODEL_KIND_AOV
14+ OPTIX_DENOISER_MODEL_KIND_TEMPORAL
15+ OPTIX_DENOISER_MODEL_KIND_TEMPORAL_AOV
16+ ELSE :
17+ cdef enum OptixDenoiserModelKind:
18+ OPTIX_DENOISER_MODEL_KIND_LDR
19+ OPTIX_DENOISER_MODEL_KIND_HDR
20+ OPTIX_DENOISER_MODEL_KIND_AOV
21+ OPTIX_DENOISER_MODEL_KIND_TEMPORAL
1422
1523
1624 cdef struct OptixDenoiserOptions:
@@ -57,7 +65,8 @@ cdef extern from "optix_includes.h" nogil:
5765 OptixImage2D normal
5866 OptixImage2D flow
5967
60- ctypedef uintptr_t OptixDenoiser
68+ ctypedef struct OptixDenoiser:
69+ pass
6170
6271 OptixResult optixDenoiserCreate(OptixDeviceContext context,
6372 OptixDenoiserModelKind modelKind,
@@ -118,18 +127,66 @@ cdef extern from "optix_includes.h" nogil:
118127 CUdeviceptr scratch,
119128 size_t scratchSizeInBytes)
120129
130+ cdef extern from " optix_denoiser_tiling.h" nogil:
131+ OptixResult optixUtilDenoiserInvokeTiled(OptixDenoiser denoiser,
132+ CUstream stream,
133+ const OptixDenoiserParams * params,
134+ CUdeviceptr denoiserState,
135+ size_t denoiserStateSizeInBytes,
136+ const OptixDenoiserGuideLayer * guideLayer,
137+ const OptixDenoiserLayer * layers,
138+ unsigned int numLayers,
139+ CUdeviceptr scratch,
140+ size_t scratchSizeInBytes,
141+ unsigned int overlapWindowSizeInPixels,
142+ unsigned int tileWidth,
143+ unsigned int tileHeight)
144+
145+ cdef struct OptixUtilDenoiserImageTile:
146+ OptixImage2D input
147+ OptixImage2D output
148+ unsigned int inputOffsetX
149+ unsigned int inputOffsetY
150+
151+ OptixResult optixUtilDenoiserSplitImage(const OptixImage2D & input ,
152+ const OptixImage2D & output,
153+ unsigned int overlapWindowSizeInPixels, unsigned int tileWidth,
154+ unsigned int tileHeight,
155+ vector[OptixUtilDenoiserImageTile]& tiles)
156+
157+ unsigned int optixUtilGetPixelStride(const OptixImage2D & image)
121158
122- class Image2D (OptixObject ):
159+
160+
161+ cdef class Image2D(OptixObject):
123162 cdef OptixImage2D image
124163 cdef object _d_data
125164
126- class DenoiserLayer (OptixObject ):
165+ cdef class DenoiserLayer(OptixObject):
127166 cdef OptixDenoiserLayer layer
128167 cdef Image2D input
129168 cdef Image2D previous_output
130169 cdef Image2D output
131170
132- class Denoiser (OptixContextObject ):
171+ cdef class DenoiserGuideLayer(OptixObject):
172+ cdef OptixDenoiserGuideLayer layer
173+ cdef Image2D albedo
174+ cdef Image2D normal
175+ cdef Image2D flow
176+
177+ cdef class Denoiser(OptixContextObject):
133178 cdef OptixDenoiser denoiser
179+ cdef object model_kind
134180 cdef bool guide_albedo
135181 cdef bool guide_normals
182+ cdef bool kp_mode
183+ cdef tuple tile_size
184+ cdef object _d_state
185+ cdef size_t _state_size
186+ cdef object _d_scratch
187+ cdef size_t _scratch_size
188+ cdef object _d_window
189+ cdef size_t _window_size
190+ cdef object _d_intensity
191+ cdef object _d_avg_color
192+ cdef unsigned int _overlap
0 commit comments