-
Notifications
You must be signed in to change notification settings - Fork 64
Hlsl path tracer example #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hlsl_bxdfs
Are you sure you want to change the base?
Conversation
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
Signed-off-by: kevyuu <kevin.kayu@gmail.com>
…er_attached nbl::system::isDebuggerAttached
…r-steps_bugfix added -fconstexpr-ops-limit for gcc
…into yas_buildinfo
…fs_hlsl Maths for HLSL BxDFs (template cmath, tgmath)
Ray Tracing Pipeline
…nfo at build time (use gtml outputs); fix a few syntax errors
Build info cmake target
…build counter (the iteration thats currently being stored) Next are callbacks upon DeferredOperation and CommandBuffer completion
… the buildAccelerationStructures command in the pool. Now just time for callbacks. @Crisspl I also added that feature you wanted `bool IGPUCommandBuffer::recordReferences(const std::span<const IReferenceCounted*> refs);`
Add absolutely awesome callback to `IQueue::SSubmitInfo`
…cking TLAS tracking BLAS they use doing build
bool partitionRandVariable(float leftProb, NBL_REF_ARG(float) xi, NBL_REF_ARG(float) rcpChoiceProb) | ||
{ | ||
#ifdef __HLSL_VERSION | ||
NBL_CONSTEXPR float NEXT_ULP_AFTER_UNITY = asfloat(0x3f800001u); | ||
#else | ||
NBL_CONSTEXPR float32_t NEXT_ULP_AFTER_UNITY = bit_cast<float32_t>(0x3f800001u); | ||
#endif | ||
const float32_t NEXT_ULP_AFTER_UNITY = bit_cast<float32_t>(0x3f800001u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be templated on T
instead of float
and live in sampling.hlsl
(named same as the folder and namespace), do as part of #811
P.S. for the constant you can use
const T NextULPAfterUnity = bit_cast<T>(++bit_cast<unsigned_int_of_size_t<sizeof(T)> >(T(1)));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you can put it in sampling/basic.hlsl
// Copyright (C) 2018-2023 - DevSH Graphics Programming Sp. z O.O. | ||
// This file is part of the "Nabla Engine". | ||
// For conditions of distribution and use, see copyright notice in nabla.h | ||
#ifndef _NBL_BUILTIN_HLSL_MATH_MORTON_INCLUDED_ | ||
#define _NBL_BUILTIN_HLSL_MATH_MORTON_INCLUDED_ | ||
|
||
#include "nbl/builtin/hlsl/cpp_compat.hlsl" | ||
|
||
namespace nbl | ||
{ | ||
namespace hlsl | ||
{ | ||
namespace math | ||
{ | ||
|
||
namespace impl | ||
{ | ||
|
||
template<typename T, uint32_t bitDepth> | ||
struct MortonComponent; | ||
|
||
template<typename T> | ||
struct MortonComponent<T, 8u> | ||
{ | ||
static T decode2d(T x) | ||
{ | ||
x &= 0x55555555u; | ||
x = (x ^ (x >> 1u)) & 0x33333333u; | ||
x = (x ^ (x >> 2u)) & 0x0f0f0f0fu; | ||
x = (x ^ (x >> 4u)) & 0x00ff00ffu; | ||
return x; | ||
} | ||
}; | ||
|
||
template<typename T> | ||
struct MortonComponent<T, 32u> | ||
{ | ||
static T decode2d(T x) | ||
{ | ||
x &= 0x55555555u; | ||
x = (x ^ (x >> 1u)) & 0x33333333u; | ||
x = (x ^ (x >> 2u)) & 0x0f0f0f0fu; | ||
x = (x ^ (x >> 4u)) & 0x00ff00ffu; | ||
x = (x ^ (x >> 8u)) & 0x0000ffffu; | ||
x = (x ^ (x >> 16u)); | ||
return x; | ||
} | ||
}; | ||
|
||
} | ||
|
||
template<typename T, uint32_t bitDepth=sizeof(T)*8u> | ||
struct Morton | ||
{ | ||
using vector2_type = vector<T, 2>; | ||
using component_type = impl::MortonComponent<T, bitDepth>; | ||
|
||
static vector2_type decode2d(T x) | ||
{ | ||
return vector2_type(component_type::decode2d(x), component_type::decode2d(x >> 1u)); | ||
} | ||
}; | ||
|
||
} | ||
} | ||
} | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file will die after #860 is merged
return retval; | ||
} | ||
|
||
vector2_type generate(NBL_REF_ARG(scalar_type) rcpPdf, NBL_CONST_REF_ARG(vector2_type) _u) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need some structs like
template<typename V, typename P=float>
struct ValueAndPdf;
template<typename T, typename P=float>
struct ValueAndRcpPdf;
in sampling/basic.hlsl
do as part of #811
P.S. can require that P
is a ScalarFloat
template<typename T> | ||
vector<T,2> boxMullerTransform(vector<T,2> xi, T stddev) | ||
{ | ||
T sinPhi, cosPhi; | ||
math::sincos<T>(2.0 * numbers::pi<float> * xi.y - numbers::pi<float>, sinPhi, cosPhi); | ||
return vector<T,2>(cosPhi, sinPhi) * nbl::hlsl::sqrt(-2.0 * nbl::hlsl::log(xi.x)) * stddev; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turn into struct with stddev
as a member
return 4.0 * nbl::hlsl::mix(nbl::hlsl::mix(bilinearCoeffs[0], bilinearCoeffs[1], u.x), nbl::hlsl::mix(bilinearCoeffs[2], bilinearCoeffs[3], u.x), u.y) / (bilinearCoeffs[0] + bilinearCoeffs[1] + bilinearCoeffs[2] + bilinearCoeffs[3]); | ||
} | ||
|
||
vector4_type bilinearCoeffs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document which index/component maps to which vertex of the unit square
…justments Intrinsics adjustments
Missing one GLSL include from |
Adds the new Demote-Promote-Writer-Readers Lock
added new dot partial spec for not floating points
Description
Testing
TODO list: