Skip to content

Commit 40a3ebf

Browse files
Merge github.com:Devsh-Graphics-Programming/Nabla into devsh
2 parents 84161c8 + 6b5de21 commit 40a3ebf

File tree

20 files changed

+199
-175
lines changed

20 files changed

+199
-175
lines changed

README.md

Lines changed: 57 additions & 48 deletions
Large diffs are not rendered by default.

artifacts/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ add_custom_target(pack_artifact_ditt
3636
COMMAND cmake -E copy ${EXAMPLES_TESTS_PATH}/media/kernels/physical_flare_256.exr ${CMAKE_CURRENT_BINARY_DIR}/Ditt/pack/media/kernels/physical_flare_256.exr
3737
COMMAND cmake -E copy ${EXAMPLES_TESTS_PATH}/media/kernels/physical_flare_512.exr ${CMAKE_CURRENT_BINARY_DIR}/Ditt/pack/media/kernels/physical_flare_512.exr
3838

39+
COMMAND cmake -E copy ${EXAMPLES_TESTS_PATH}/media/mitsuba/staircase2.zip ${CMAKE_CURRENT_BINARY_DIR}/Ditt/pack/media/mitsuba/staircase2.zip
40+
3941
COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/Ditt && cmake -E tar -cvj Ditt.tar.bz2 pack/
4042
)

examples_tests/01.HelloWorld/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ class DemoEventCallback : public ui::IWindow::IEventCallback
103103

104104
static core::smart_refctd_ptr<system::ISystem> createSystem()
105105
{
106-
core::smart_refctd_ptr<system::ISystemCaller> caller = nullptr;
106+
nbl::core::smart_refctd_ptr<system::ISystemCaller> caller = nullptr;
107107
#ifdef _NBL_PLATFORM_WINDOWS_
108-
caller = core::make_smart_refctd_ptr<nbl::system::CSystemCallerWin32>();
108+
caller = nbl::core::make_smart_refctd_ptr<nbl::system::CSystemCallerWin32>();
109109
#endif
110-
return make_smart_refctd_ptr<system::ISystem>(std::move(caller));
110+
#ifdef _NBL_PLATFORM_WINDOWS_
111+
return nbl::core::make_smart_refctd_ptr<nbl::system::CSystemWin32>(std::move(caller));
112+
#endif
113+
return nullptr;
111114
}
112115

113116
class HelloWorldSampleApp : public system::IApplicationFramework, public ui::IGraphicalApplicationFramework

examples_tests/22.RaytracedAO/closestHit.comp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,17 @@ void main()
6969
const uvec3 indices = get_triangle_indices(batchInstanceData,triangleID);
7070

7171
// positions
72-
vec3 geomDenormal;
73-
const vec3 lastVxPos = load_positions(geomDenormal,batchInstanceData,indices);
74-
const bool frontfacing = bool((batchInstanceData.determinantSignBit^floatBitsToUint(dot(geomDenormal,normalizedV)))&0x80000000u);
72+
vec3 geomNormal;
73+
const vec3 lastVxPos = load_positions(geomNormal,batchInstanceData,indices);
74+
75+
const bool frontfacing = bool((batchInstanceData.determinantSignBit^floatBitsToUint(dot(normalizedV,geomNormal)))&0x80000000u);
7576

7677
// get material
7778
const nbl_glsl_MC_oriented_material_t material = nbl_glsl_MC_material_data_t_getOriented(batchInstanceData.material,frontfacing);
7879
contrib.color = contrib.albedo = nbl_glsl_MC_oriented_material_t_getEmissive(material);
7980

8081
const uint pathDepth = bitfieldExtract(staticViewData.pathDepth_noRussianRouletteDepth_samplesPerPixelPerDispatch,0,8);
81-
const bool _continue = vertex_depth!=pathDepth && ray.maxT==nbl_glsl_FLT_MAX; // not last vertex and not NEE path
82+
const bool _continue = vertex_depth!=pathDepth && material.genchoice_count!=0u && ray.maxT==nbl_glsl_FLT_MAX; // not last vertex and has a BxDF and not NEE path
8283
if (_continue)
8384
{
8485
// if we ever support spatially varying emissive, we'll need to hoist barycentric computation and UV fetching to the position fetching
@@ -89,7 +90,7 @@ void main()
8990

9091
//
9192
normalizedN = load_normal_and_prefetch_textures(
92-
batchInstanceData,indices,compactBary,geomDenormal,material
93+
batchInstanceData,indices,compactBary,geomNormal,material
9394
#ifdef TEX_PREFETCH_STREAM
9495
,mat2(0.0) // TODO: Covariance Rendering
9596
#endif
@@ -103,10 +104,10 @@ void main()
103104
);
104105
}
105106
else
106-
contrib.worldspaceNormal = normalize(geomDenormal)*nbl_glsl_MC_colorToScalar(contrib.albedo);
107+
contrib.worldspaceNormal = geomNormal*nbl_glsl_MC_colorToScalar(contrib.albedo);
107108
}
108109
else
109-
Contribution_initMiss(contrib);
110+
Contribution_initMiss(contrib,aovThroughputScale);
110111

111112
Contribution_normalizeAoV(contrib);
112113

examples_tests/22.RaytracedAO/raygen.comp

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,35 +79,41 @@ void main()
7979
// get material while waiting for indices
8080
const nbl_glsl_MC_oriented_material_t material = nbl_glsl_MC_material_data_t_getOriented(batchInstanceData.material,frontfacing);
8181
contrib.color = contrib.albedo = nbl_glsl_MC_oriented_material_t_getEmissive(material);
82-
82+
8383
// load vertex data
84-
vec3 geomDenormal;
85-
const vec3 lastVxPos = load_positions(geomDenormal,batchInstanceData,indices);
86-
87-
// get initial scramble key while waiting for vertex positions
88-
const nbl_glsl_xoroshiro64star_state_t scramble_start_state = texelFetch(scramblebuf,ivec2(outPixelLocation),0).rg;
84+
vec3 geomNormal;
85+
const vec3 lastVxPos = load_positions(geomNormal,batchInstanceData,indices);
8986

90-
//
91-
normalizedN = load_normal_and_prefetch_textures(
92-
batchInstanceData,indices,compactBary,geomDenormal,material
93-
#ifdef TEX_PREFETCH_STREAM
94-
,dBarydScreen
95-
#endif
96-
);
87+
// little optimization for non-twosided materials
88+
if (material.genchoice_count!=0u)
89+
{
90+
// get initial scramble key while waiting for vertex positions
91+
const nbl_glsl_xoroshiro64star_state_t scramble_start_state = texelFetch(scramblebuf,ivec2(outPixelLocation),0).rg;
92+
93+
//
94+
normalizedN = load_normal_and_prefetch_textures(
95+
batchInstanceData,indices,compactBary,geomNormal,material
96+
#ifdef TEX_PREFETCH_STREAM
97+
,dBarydScreen
98+
#endif
99+
);
97100

98-
const vec3 origin = dPdBary*compactBary+lastVxPos;
99-
normalizedV = normalize(pc.cummon.camPos-origin);
101+
const vec3 origin = dPdBary*compactBary+lastVxPos;
102+
normalizedV = normalize(pc.cummon.camPos-origin);
100103

101-
// generate rays
102-
const uint vertex_depth = 1u;
103-
generate_next_rays(
104-
samplesPerPixelPerDispatch,material,frontfacing,vertex_depth,
105-
scramble_start_state,pc.cummon.samplesComputed,outPixelLocation,origin,
106-
vec3(pc.cummon.rcpFramesDispatched),1.f,contrib.albedo,contrib.worldspaceNormal
107-
);
104+
// generate rays
105+
const uint vertex_depth = 1u;
106+
generate_next_rays(
107+
samplesPerPixelPerDispatch,material,frontfacing,vertex_depth,
108+
scramble_start_state,pc.cummon.samplesComputed,outPixelLocation,origin,
109+
vec3(pc.cummon.rcpFramesDispatched),1.f,contrib.albedo,contrib.worldspaceNormal
110+
);
111+
}
112+
else
113+
contrib.worldspaceNormal = geomNormal*nbl_glsl_MC_colorToScalar(contrib.albedo);
108114
}
109115
else
110-
Contribution_initMiss(contrib);
116+
Contribution_initMiss(contrib,1.f);
111117

112118
if (bool(pc.cummon.depth))
113119
{

examples_tests/22.RaytracedAO/raytraceCommon.glsl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ void storeAccumulation(in vec3 color, in uvec3 coord)
7979
}
8080
void storeAccumulation(in vec3 prev, in vec3 delta, in uvec3 coord)
8181
{
82-
if (any(greaterThan(abs(delta),vec3(nbl_glsl_FLT_MIN*16.f))))
83-
storeAccumulation(prev+delta,coord);
82+
const vec3 newVal = prev+delta;
83+
const uvec3 diff = floatBitsToUint(newVal)^floatBitsToUint(prev);
84+
if (bool((diff.x|diff.y|diff.z)&0x7ffffff0u))
85+
storeAccumulation(newVal,coord);
8486
}
8587

8688
vec3 fetchAlbedo(in uvec3 coord)
@@ -152,7 +154,7 @@ bool has_world_transform(in nbl_glsl_ext_Mitsuba_Loader_instance_data_t batchIns
152154

153155
#include <nbl/builtin/glsl/barycentric/utils.glsl>
154156
mat2x3 dPdBary;
155-
vec3 load_positions(out vec3 geomDenormal, in nbl_glsl_ext_Mitsuba_Loader_instance_data_t batchInstanceData, in uvec3 indices)
157+
vec3 load_positions(out vec3 geomNormal, in nbl_glsl_ext_Mitsuba_Loader_instance_data_t batchInstanceData, in uvec3 indices)
156158
{
157159
mat3 positions = mat3(
158160
nbl_glsl_fetchVtxPos(indices[0],batchInstanceData),
@@ -165,7 +167,7 @@ vec3 load_positions(out vec3 geomDenormal, in nbl_glsl_ext_Mitsuba_Loader_instan
165167
//
166168
for (int i=0; i<2; i++)
167169
dPdBary[i] = positions[i]-positions[2];
168-
geomDenormal = cross(dPdBary[0],dPdBary[1]);
170+
geomNormal = normalize(cross(dPdBary[0],dPdBary[1]));
169171
//
170172
if (tform)
171173
positions[2] += batchInstanceData.tform[3];
@@ -194,7 +196,7 @@ bool needs_texture_prefetch(in nbl_glsl_ext_Mitsuba_Loader_instance_data_t batch
194196

195197
vec3 load_normal_and_prefetch_textures(
196198
in nbl_glsl_ext_Mitsuba_Loader_instance_data_t batchInstanceData,
197-
in uvec3 indices, in vec2 compactBary, in vec3 geomDenormal,
199+
in uvec3 indices, in vec2 compactBary, in vec3 geomNormal,
198200
in nbl_glsl_MC_oriented_material_t material
199201
#ifdef TEX_PREFETCH_STREAM
200202
,in mat2 dBarydScreen
@@ -222,7 +224,6 @@ vec3 load_normal_and_prefetch_textures(
222224
// the rest is always only needed for continuing rays
223225

224226

225-
vec3 normal = geomDenormal;
226227
// while waiting for the scramble state
227228
// TODO: optimize, add loads more flags to control this
228229
const bool needsSmoothNormals = true;
@@ -235,18 +236,20 @@ vec3 load_normal_and_prefetch_textures(
235236
);
236237

237238
// not needed for NEE unless doing Area or Projected Solid Angle Sampling
238-
const vec3 smoothNormal = normals*nbl_glsl_barycentric_expand(compactBary);
239-
// TODO: first check wouldn't be needed if we had `needsSmoothNormals` implemented
240-
if (!isnan(smoothNormal.x) && has_world_transform(batchInstanceData))
239+
vec3 smoothNormal = normals*nbl_glsl_barycentric_expand(compactBary);
240+
if (has_world_transform(batchInstanceData))
241241
{
242-
normal = vec3(
242+
smoothNormal = vec3(
243243
dot(batchInstanceData.normalMatrixRow0,smoothNormal),
244244
dot(batchInstanceData.normalMatrixRow1,smoothNormal),
245245
dot(batchInstanceData.normalMatrixRow2,smoothNormal)
246246
);
247247
}
248+
// TODO: this check wouldn't be needed if we had `needsSmoothNormals` implemented
249+
if (!isnan(smoothNormal.x))
250+
return normalize(smoothNormal);
248251
}
249-
return normalize(normal);
252+
return geomNormal;
250253
}
251254

252255
#include <nbl/builtin/glsl/sampling/quantized_sequence.glsl>
@@ -324,8 +327,8 @@ void generate_next_rays(
324327
worldspaceNormal += result.aov.normal/float(maxRaysToGen);
325328

326329
nextThroughput[i] = prevThroughput*result.quotient;
327-
// do denormalized half floats flush to 0 ?
328-
if (max(max(nextThroughput[i].x,nextThroughput[i].y),nextThroughput[i].z)>=exp2(-14.f))
330+
// TODO: add some sort of factor to this inequality that could account for highest possible emission (direct or indirect) we could encounter
331+
if (max(max(nextThroughput[i].x,nextThroughput[i].y),nextThroughput[i].z)>exp2(-19.f)) // match output mantissa (won't contribute anything afterwards)
329332
{
330333
maxT[i] = nbl_glsl_FLT_MAX;
331334
nextAoVThroughputScale[i] = prevAoVThroughputScale*result.aov.throughputFactor;
@@ -392,11 +395,11 @@ vec2 SampleSphericalMap(vec3 v)
392395
return uv;
393396
}
394397

395-
void Contribution_initMiss(out Contribution contrib)
398+
void Contribution_initMiss(out Contribution contrib, in float aovThroughputScale)
396399
{
397400
vec2 uv = SampleSphericalMap(-normalizedV);
398401
// funny little trick borrowed from things like Progressive Photon Mapping
399-
const float bias = 0.25*sqrt(pc.cummon.rcpFramesDispatched);
402+
const float bias = 0.0625f*(1.f-aovThroughputScale)*pow(pc.cummon.rcpFramesDispatched,0.08f);
400403
contrib.albedo = contrib.color = textureGrad(envMap, uv, vec2(bias*0.5,0.f), vec2(0.f,bias)).rgb;
401404
contrib.worldspaceNormal = normalizedV;
402405
}

examples_tests/35.GeometryCreator/main.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
248248

249249
CommonAPI::Init(
250250
initOutput,
251-
video::EAT_OPENGL,
251+
video::EAT_VULKAN,
252252
"35.GeometryCreator",
253253
requiredInstanceFeatures,
254254
optionalInstanceFeatures,
@@ -515,10 +515,7 @@ class GeometryCreatorSampleApp : public ApplicationBase
515515
auto& fence = m_frameComplete[m_resourceIx];
516516

517517
if (fence)
518-
{
519-
while (logicalDevice->waitForFences(1u, &fence.get(), false, MAX_TIMEOUT) == video::IGPUFence::ES_TIMEOUT) {}
520-
logicalDevice->resetFences(1u, &fence.get());
521-
}
518+
logicalDevice->blockForFences(1u, &fence.get());
522519
else
523520
fence = logicalDevice->createFence(static_cast<video::IGPUFence::E_CREATE_FLAGS>(0));
524521

@@ -552,8 +549,6 @@ class GeometryCreatorSampleApp : public ApplicationBase
552549
scissor.extent = { WIN_W,WIN_H };
553550
commandBuffer->setScissor(0u, 1u, &scissor);
554551

555-
swapchain->acquireNextImage(MAX_TIMEOUT, m_imageAcquire[m_resourceIx].get(), nullptr, &m_acquiredNextFBO);
556-
557552
video::IGPUCommandBuffer::SRenderpassBeginInfo beginInfo;
558553
{
559554
VkRect2D area;
@@ -594,7 +589,8 @@ class GeometryCreatorSampleApp : public ApplicationBase
594589

595590
commandBuffer->endRenderPass();
596591
commandBuffer->end();
597-
592+
593+
logicalDevice->resetFences(1, &fence.get());
598594
CommonAPI::Submit(
599595
logicalDevice.get(),
600596
swapchain.get(),

examples_tests/39.DenoiserTonemapper/main.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ int main(int argc, char* argv[])
7979
params.Vsync = true;
8080
params.Doublebuffer = true;
8181
params.Stencilbuffer = false;
82-
params.StreamingDownloadBufferSize = 1024*1024*1024; // for 16k images
82+
// TODO: this is a temporary fix for a problem solved in the Vulkan Branch
83+
params.StreamingUploadBufferSize = 1024*1024*1024; // for Color + 2 AoV of 8k images
84+
params.StreamingDownloadBufferSize = core::roundUp(params.StreamingUploadBufferSize/3u,256u); // for output image
8385
auto device = createDeviceEx(params);
8486

8587
if (check_error(!device,"Could not create Irrlicht Device!"))
@@ -1270,8 +1272,17 @@ nbl_glsl_complex nbl_glsl_ext_FFT_getPaddedData(ivec3 coordinate, in uint channe
12701272
uint32_t inImageByteOffset[EII_COUNT];
12711273
{
12721274
asset::ICPUBuffer* buffersToUpload[EII_COUNT];
1275+
size_t inputSize = 0u;
12731276
for (uint32_t j=0u; j<denoiserInputCount; j++)
1277+
{
12741278
buffersToUpload[j] = param.image[j]->getBuffer();
1279+
inputSize += buffersToUpload[j]->getSize();
1280+
}
1281+
if (inputSize>=params.StreamingUploadBufferSize)
1282+
{
1283+
printf("[ERROR] Denoiser Failed, input too large to fit in VRAM, Streaming Denoise not implemented yet!");
1284+
return -1;
1285+
}
12751286
auto gpubuffers = driver->getGPUObjectsFromAssets(buffersToUpload,buffersToUpload+denoiserInputCount,&assetConverter);
12761287

12771288
bool skip = false;

examples_tests/53.ComputeShaders/main.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class MeshLoadersApp : public ApplicationBase
127127
{
128128
static constexpr uint32_t WIN_W = 1280;
129129
static constexpr uint32_t WIN_H = 720;
130-
static constexpr uint32_t FBO_COUNT = 1u;
130+
static constexpr uint32_t FBO_COUNT = 2u;
131131
static constexpr size_t NBL_FRAMES_TO_AVERAGE = 100ull;
132132

133133
public:
@@ -236,7 +236,7 @@ APP_CONSTRUCTOR(MeshLoadersApp)
236236
const auto swapchainImageUsage = static_cast<asset::IImage::E_USAGE_FLAGS>(asset::IImage::EUF_COLOR_ATTACHMENT_BIT);
237237
const video::ISurface::SFormat surfaceFormat(asset::EF_R8G8B8A8_SRGB, asset::ECP_COUNT, asset::EOTF_UNKNOWN);
238238

239-
CommonAPI::InitWithDefaultExt(initOutput, video::EAT_OPENGL_ES, "MeshLoaders", WIN_W, WIN_H, FBO_COUNT, swapchainImageUsage, surfaceFormat, nbl::asset::EF_D32_SFLOAT);
239+
CommonAPI::InitWithDefaultExt(initOutput, video::EAT_VULKAN, "MeshLoaders", WIN_W, WIN_H, FBO_COUNT, swapchainImageUsage, surfaceFormat, nbl::asset::EF_D32_SFLOAT);
240240
window = std::move(initOutput.window);
241241
gl = std::move(initOutput.apiConnection);
242242
surface = std::move(initOutput.surface);
@@ -288,12 +288,17 @@ APP_CONSTRUCTOR(MeshLoadersApp)
288288
}
289289

290290
auto cpuSSBOBuffer = core::make_smart_refctd_ptr<ICPUBuffer>(sizeof(SShaderStorageBufferObject));
291+
cpuSSBOBuffer->addUsageFlags(asset::IBuffer::EUF_STORAGE_BUFFER_BIT);
291292
triggerRandomSetup(reinterpret_cast<SShaderStorageBufferObject*>(cpuSSBOBuffer->getPointer()));
292293
core::smart_refctd_ptr<video::IGPUBuffer> gpuSSBOBuffer;
293294
{
295+
cpu2gpuParams.beginCommandBuffers();
296+
294297
auto gpu_array = cpu2gpu.getGPUObjectsFromAssets(&cpuSSBOBuffer, &cpuSSBOBuffer + 1, cpu2gpuParams);
295298
if (!gpu_array || gpu_array->size() < 1u || !(*gpu_array)[0])
296299
assert(false);
300+
301+
cpu2gpuParams.waitForCreationToComplete(false);
297302

298303
auto gpuSSBOOffsetBufferPair = (*gpu_array)[0];
299304
gpuSSBOBuffer = core::smart_refctd_ptr<video::IGPUBuffer>(gpuSSBOOffsetBufferPair->getBuffer());
@@ -370,7 +375,7 @@ APP_CONSTRUCTOR(MeshLoadersApp)
370375
primitiveAssemblyParams.primitiveType = EPT_POINT_LIST;
371376
asset::SRasterizationParams rasterizationParams;
372377

373-
video::IGPUDescriptorSetLayout::SBinding gpuUboBinding;
378+
video::IGPUDescriptorSetLayout::SBinding gpuUboBinding = {};
374379
gpuUboBinding.count = 1u;
375380
gpuUboBinding.binding = 0;
376381
gpuUboBinding.stageFlags = static_cast<asset::ICPUShader::E_SHADER_STAGE>(asset::ICPUShader::ESS_VERTEX | asset::ICPUShader::ESS_FRAGMENT);
@@ -384,7 +389,7 @@ APP_CONSTRUCTOR(MeshLoadersApp)
384389
video::IGPUBuffer::SCreationParams gpuUBOCreationParams;
385390
//gpuUBOCreationParams.size = sizeof(SBasicViewParameters);
386391
gpuUBOCreationParams.usage = asset::IBuffer::E_USAGE_FLAGS::EUF_UNIFORM_BUFFER_BIT;
387-
gpuUBOCreationParams.sharingMode = asset::E_SHARING_MODE::ESM_CONCURRENT;
392+
gpuUBOCreationParams.sharingMode = asset::E_SHARING_MODE::ESM_EXCLUSIVE;
388393
gpuUBOCreationParams.queueFamilyIndexCount = 0u;
389394
gpuUBOCreationParams.queueFamilyIndices = nullptr;
390395

include/nbl/builtin/glsl/material_compiler/common.glsl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,6 @@ nbl_glsl_MC_eval_pdf_aov_t nbl_glsl_MC_instr_bxdf_eval_and_pdf_common(
746746
in uint op, in bool is_not_brdf,
747747
in nbl_glsl_MC_params_t params,
748748
in mat2x3 ior, in mat2x3 ior2,
749-
#if GEN_CHOICE_STREAM>=GEN_CHOICE_WITH_AOV_EXTRACTION
750-
in vec3 normal,
751-
#endif
752749
in float absOrMaxNdotV,
753750
in float absOrMaxNdotL,
754751
in nbl_glsl_LightSample s,
@@ -775,7 +772,7 @@ nbl_glsl_MC_eval_pdf_aov_t nbl_glsl_MC_instr_bxdf_eval_and_pdf_common(
775772
const float a = nbl_glsl_MC_params_getAlpha(params);
776773
const float a2 = a*a;
777774
#if GEN_CHOICE_STREAM>=GEN_CHOICE_WITH_AOV_EXTRACTION
778-
result.aov.normal = normal;
775+
result.aov.normal = currInteraction.inner.isotropic.N;
779776
#endif
780777

781778
#if defined(OP_DIFFUSE) || defined(OP_DIFFTRANS)
@@ -961,9 +958,6 @@ void nbl_glsl_MC_instr_eval_and_pdf_execute(
961958
{
962959
result = nbl_glsl_MC_instr_bxdf_eval_and_pdf_common(
963960
instr,op,is_not_brdf,params,ior,ior2,
964-
#if GEN_CHOICE_STREAM>=GEN_CHOICE_WITH_AOV_EXTRACTION
965-
precomp.N,
966-
#endif
967961
NdotV,NdotL,
968962
s,microfacet,run
969963
);
@@ -1235,7 +1229,7 @@ nbl_glsl_LightSample nbl_bsdf_cos_generate(
12351229
const float ax = nbl_glsl_MC_params_getAlpha(params);
12361230
const float ax2 = ax*ax;
12371231
#if GEN_CHOICE_STREAM>=GEN_CHOICE_WITH_AOV_EXTRACTION
1238-
out_values.aov.normal = precomp.N;
1232+
out_values.aov.normal = currInteraction.inner.isotropic.N;
12391233
#endif
12401234

12411235
// TODO: refactor

0 commit comments

Comments
 (0)