|
1 | 1 | import os, sys, logging, collections |
2 | 2 |
|
3 | | -import numpy as np |
4 | 3 | import cupy as cp |
| 4 | +import numpy as np |
5 | 5 | import optix as ox |
| 6 | + |
6 | 7 | import glfw, imgui |
7 | 8 |
|
8 | 9 | from optix.sutil.gui import init_ui, display_text |
9 | 10 | from optix.sutil.camera import Camera |
10 | 11 | from optix.sutil.gl_display import GLDisplay |
11 | 12 | from optix.sutil.cuda_output_buffer import CudaOutputBuffer, CudaOutputBufferType, BufferImageFormat |
12 | 13 |
|
| 14 | +script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 15 | + |
13 | 16 | logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) |
14 | 17 | log = logging.getLogger() |
15 | 18 |
|
16 | | -script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 19 | +DEBUG=False |
17 | 20 |
|
18 | 21 |
|
19 | 22 | class Params: |
@@ -174,13 +177,18 @@ def build_ias(state): |
174 | 177 | state.params.trav_handle = state.ias.handle |
175 | 178 |
|
176 | 179 | def create_module(state): |
| 180 | + if DEBUG: |
| 181 | + exception_flags=ox.ExceptionFlags.DEBUG | ox.ExceptionFlags.TRACE_DEPTH | ox.ExceptionFlags.STACK_OVERFLOW, |
| 182 | + else: |
| 183 | + exception_flags=ox.ExceptionFlags.NONE |
| 184 | + |
177 | 185 | pipeline_opts = ox.PipelineCompileOptions( |
178 | 186 | uses_motion_blur=False, |
179 | 187 | traversable_graph_flags=ox.TraversableGraphFlags.ALLOW_SINGLE_LEVEL_INSTANCING, |
180 | 188 | uses_primitive_type_flags=ox.PrimitiveTypeFlags.CUSTOM, |
181 | 189 | num_payload_values=3, |
182 | 190 | num_attribute_values=3, |
183 | | - exception_flags=ox.ExceptionFlags.DEBUG | ox.ExceptionFlags.TRACE_DEPTH | ox.ExceptionFlags.STACK_OVERFLOW, |
| 191 | + exception_flags=exception_flags, |
184 | 192 | pipeline_launch_params_variable_name="params") |
185 | 193 |
|
186 | 194 | compile_opts = ox.ModuleCompileOptions( |
@@ -317,7 +325,7 @@ def update_sbt_header(state): |
317 | 325 | # The right sphere will use the next compiled program group. |
318 | 326 | material_index = state.material_index_2.nextval() |
319 | 327 |
|
320 | | - #state.hit_grps.update_program_group(3, state.hit_grps[3 + material_index]) |
| 328 | + state.hit_sbts.update_program_group(3, state.hit_grps[3 + material_index]) |
321 | 329 |
|
322 | 330 | state.sbt = ox.ShaderBindingTable(raygen_record=state.raygen_sbt, miss_records=state.miss_sbt, |
323 | 331 | hitgroup_records=state.hit_sbts) |
|
0 commit comments