Skip to content

Conversation

@AnastaZIuk
Copy link
Member

No description provided.

small change to make sure `ditt` doesn't autodelete
…ubresource bitflags to not trigger asserts, update examples_tests submodule
…experimental, no real validation), update examples_tests submodule
…arguments in json payload, CI should pass now
… with GPU converter, encode to EF_A2R10G10B10_UNORM_PACK32, update examples_tests submodule
return abs(phi);
case symmetry_t::NO_LATERAL_SYMMET: //! plot onto whole (in degress) [0, 360] range
{
NBL_CONSTEXPR float32_t M_TWICE_PI = numbers::pi<float32_t> *2.f;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

return (phi < 0.f) ? (phi + M_TWICE_PI) : phi;
}
}
return 69.f;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NaN

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 121 to 122
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent the cases

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 67 to 68
// TODO: DXC seems to have a bug and cannot use symmetry_t directly with == operator https://godbolt.devsh.eu/z/P9Kc5x
const ProfileProperties::LuminairePlanesSymmetry symmetry = accessor.getProperties().getSymmetry();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This

s.sample(); // error: translating binary operator '==' unimplemented

works now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 69 to 70
const float32_t vAngle = degrees(polar.theta);
const float32_t hAngle = degrees(wrapPhi(polar.phi, symmetry));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have asserts in HLSL, you can assert the polar coordinates are valid (more than 0 and less than pi and 2pi respectively)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 126 to 143
struct impl_t
{
static uint32_t getVUB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
for (uint32_t i = 0u; i < accessor.vAnglesCount(); ++i)
if (accessor.vAngle(i) > angle)
return i;
return accessor.vAnglesCount();
}

static uint32_t getHUB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
for (uint32_t i = 0u; i < accessor.hAnglesCount(); ++i)
if (accessor.hAngle(i) > angle)
return i;
return accessor.hAnglesCount();
}
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just prefix the methods with __ as is our convention

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 130 to 141
for (uint32_t i = 0u; i < accessor.vAnglesCount(); ++i)
if (accessor.vAngle(i) > angle)
return i;
return accessor.vAnglesCount();
}

static uint32_t getHUB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
for (uint32_t i = 0u; i < accessor.hAnglesCount(); ++i)
if (accessor.hAngle(i) > angle)
return i;
return accessor.hAnglesCount();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please use our upper_bound algorithm ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 147 to 162
return (uint32_t)hlsl::max((int64_t)impl_t::getVUB(accessor, angle) - 1ll, 0ll);
}

static uint32_t getHLB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
return (uint32_t)hlsl::max((int64_t)impl_t::getHUB(accessor, angle) - 1ll, 0ll);
}

static uint32_t getVUB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
return (uint32_t)hlsl::min((int64_t)impl_t::getVUB(accessor, angle), (int64_t)(accessor.vAnglesCount() - 1u));
}

static uint32_t getHUB(NBL_CONST_REF_ARG(accessor_t) accessor, const float32_t angle)
{
return (uint32_t)hlsl::min((int64_t)impl_t::getHUB(accessor, angle), (int64_t)(accessor.hAnglesCount() - 1u));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't use uint64_t, use the return type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 19 to 22
logger.log("%s: Invalid IES signature for \"%s\" file!", system::ILogger::ELL_ERROR, __FUNCTION__, fName);
}
else
logger.log("%s: Failed to read \"%s\" file!", system::ILogger::ELL_ERROR, __FUNCTION__, fName);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the're not errors, they' DEBUG or INFO, remember `isALoadableFileFormat can be called to query files if a particular loader is getting used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved


if (height > CDC_MAX_TEXTURE_HEIGHT)
height = CDC_MAX_TEXTURE_HEIGHT;
// TODO: If no symmetry (no folding in half and abuse of mirror sampler) make dimensions odd-sized so middle texel taps the south pole

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do it right now, and leave a TODO to undo it when implementing the exploitation of symmetries

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 16 to 18
// TODO(?): should be in nbl::hlsl::ies (or in the Texutre struct) but I get
// error GA3909C62: class template specialization of 'member_count' not in a namespace enclosing 'bda'
// which I don't want to deal with rn to not (eventually) break stuff

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its extremely annoying but you need to do it like this

namespace nbl
{
namespace hlsl
{
namespace ies
{
struct IESTextureInfo;
}
}
}

NBL_HLSL_DEFINE_STRUCT((::nbl::hlsl::ies::IESTextureInfo),
	((inv, float32_t2))
	((flatten, float32_t))
	((maxValueRecip, float32_t))
	((flattenTarget, float32_t))
	((domainLo, float32_t))
	((domainHi, float32_t))
	((fullDomainFlatten, uint16_t)) // bool
);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved


struct IESTextureInfo;
NBL_HLSL_DEFINE_STRUCT((IESTextureInfo),
((inv, float32_t2))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give it a better name than just inv, lastTexelRcp or something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 23 to 28
((flatten, float32_t))
((maxValueRecip, float32_t))
((flattenTarget, float32_t))
((domainLo, float32_t))
((domainHi, float32_t))
((fullDomainFlatten, uint16_t)) // bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need these members anymore because flattening is no longer needed (except for maxValueRecip)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 44 to 47
static inline SInfo createInfo(NBL_CONST_REF_ARG(accessor_t) accessor, NBL_CONST_REF_ARG(uint32_t2) size, float32_t flatten, bool fullDomainFlatten)
{
SInfo retval;
const ProfileProperties props = accessor.getProperties();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

store the info in the SProceduralTexture

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

{

template<typename Accessor NBL_FUNC_REQUIRES(concepts::IsIESAccessor<Accessor>)
struct Texture

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call it SProceduralTexture

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and remove the template

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 44 to 46
static inline SInfo createInfo(NBL_CONST_REF_ARG(accessor_t) accessor, NBL_CONST_REF_ARG(uint32_t2) size, float32_t flatten, bool fullDomainFlatten)
{
SInfo retval;
Copy link
Member

@devshgraphicsprogramming devshgraphicsprogramming Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this into a static inline SProceduralTexture create(const float32_t minTheta, const float32_t maxTheta, const uint32_t2 resolution=Default...)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually just static inline SProceduralTexture create(const float32_t maxCandelaValue, const uint32_t2 resolution=Default...) because flattening is no longer necessary so no need to know about the domain sizes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't actually need to template the whole class on the accessor, just operator()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 19 to 29
//! max 16K resolution
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_WIDTH = 15360u;
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_HEIGHT = 8640u;

// TODO: This constraint is hack because the mitsuba loader and its material compiler use Virtual Texturing, and there's some bug with IES not sampling sub 128x128 mip levels
// don't want to spend time to fix this since we'll be using descriptor indexing for the next iteration
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_WIDTH = 128u;
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_HEIGHT = 128u;

NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_WIDTH = 1024u;
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_HEIGHT = 1024u;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the texture stuff should go to SProceduralTexture

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

return retval;
}

static inline float32_t eval(NBL_CONST_REF_ARG(accessor_t) accessor, NBL_CONST_REF_ARG(SInfo) info, NBL_CONST_REF_ARG(float32_t2) uv)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this method into template operator(), its this function that needs to be templated on the accessor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also hold SInfo as a member`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually turn this into __evalNDC and use octahedral_t::ndcToDir

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

const float32_t3 dir = octahedral_t::uvToDir(uv);
const polar_t polar = polar_t::createFromCartesian(dir);

sampler_t sampler;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sampler is a reserved keyword in HLSL, use _sampler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

const polar_t polar = polar_t::createFromCartesian(dir);

sampler_t sampler;
const float32_t intensity = sampler.sample(accessor, polar);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sample is a reserved keyword, turn the method into operator()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not possible due to dxc overload resolution bug, we have __call

Comment on lines 77 to 83
//! blend the IES texture with "flatten"
float32_t blendV = intensity * (1.f - info.flatten);

const bool inDomain = (info.domainLo <= polar.theta) && (polar.theta <= info.domainHi);

if ((info.fullDomainFlatten && inDomain) || intensity > 0.0f)
blendV += info.flattenTarget * info.flatten;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more flattening needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

Comment on lines 90 to 92
static inline float32_t eval(NBL_CONST_REF_ARG(accessor_t) accessor, NBL_CONST_REF_ARG(SInfo) info, NBL_CONST_REF_ARG(uint32_t2) position)
{
const float32_t2 uv = float32_t2(position) * info.inv;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so for this, you take a corner sampled unnorm position, and need to turn it into UV, so needs to have +0.5 and then mul by rcp of texsize

OR mul by rcp of texsize and add half-texel in norm coords

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively you can do this

template<typename Accessor, typename Coordinate NBL_FUNC_REQUIRES(concepts::IsIESAccessor<Accessor,> && is_same_v<Coordinate ,float32_t2>)
inline float32_t operator()(NBL_CONST_REG_ARG(Accessor) accessor, const Coordinate coord) NBL_CONST_METHOD
{
   const float32_t2 ndc = // uv to NDC with half texel handling
   return __evalNDC(ndc);
}

template<typename Accessor, typename Coordinate NBL_FUNC_REQUIRES(concepts::IsIESAccessor<Accessor,> && is_same_v<Coordinate ,int32_t2>)
inline float32_t operator()(NBL_CONST_REG_ARG(Accessor) accessor, const Coordinate coord) NBL_CONST_METHOD
{
   const float32_t2 ndc = coord*lastTexelRcp*2.f-float32_t2(1,1);
   return __evalNDC(ndc);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

using polar_t = math::Polar<float32_t>;
using octahedral_t = math::OctahedralTransform<float32_t>;

static value_t sample(NBL_CONST_REF_ARG(accessor_t) accessor, NBL_CONST_REF_ARG(math::Polar<float32_t>) polar)
Copy link
Member

@devshgraphicsprogramming devshgraphicsprogramming Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turn sample(...) into template<typename CoordinateT> requires static value_t __call(...)

because sample is a reserved keyword and sampling is already kinda like a function call oeprator

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

for (auto i=0; i<combinedCount; i++)
{
const auto& toBind = binItems[i];
const auto& toBind = binItemsIt[i];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used binItems[i] so it always indexed from the start of the full list. Later batches rebound earlier items and could trigger validation errors. binItemsIt[i] is indexed from the current batch slice so each batch binds its own items

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok start here, wrong index was used for the current batch slice and later batches rebound earlier objects

const auto& toBind = binItemsIt[i];

batch binding happens in finalize

then finalize is triggered from convert

deferredAllocator.finalize();

convert_impl entry

ISemaphore::future_t<IQueue::RESULT> CAssetConverter::convert_impl(SReserveResult& reservations, SConvertParams& params)

now let four GPU buffers land in the same bin. One allocation for all 4 fails, allocator succeeds for 2 then 2. The second batch rebinds buffers 0–1 instead of 2–3, leaving 2–3 unbound

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants