Skip to content

Commit 2c5974e

Browse files
committed
fix optimal resolution bug, update examples_tests submodule
1 parent b855e1c commit 2c5974e

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

include/nbl/builtin/hlsl/ies/profile.hlsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ struct ProfileProperties
2020
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_WIDTH = 15360u;
2121
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_HEIGHT = 8640u;
2222

23+
// 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
24+
// don't want to spend time to fix this since we'll be using descriptor indexing for the next iteration
25+
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_WIDTH = 128u;
26+
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_HEIGHT = 128u;
27+
2328
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_WIDTH = 1024u;
2429
NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_HEIGHT = 1024u;
2530

src/nbl/asset/utils/CIESProfile.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@ core::smart_refctd_ptr<asset::ICPUImageView> CIESProfile::createIESTexture(Execu
1919
height = properties_t::CDC_MAX_TEXTURE_HEIGHT;
2020

2121
// TODO: If no symmetry (no folding in half and abuse of mirror sampler) make dimensions odd-sized so middle texel taps the south pole
22-
23-
// TODO: This 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
24-
// don't want to spend time to fix this since we'll be using descriptor indexing for the next iteration
25-
width = core::max(width,128);
26-
height = core::max(height,128);
22+
width = core::max(width,properties_t::CDC_MIN_TEXTURE_WIDTH);
23+
height = core::max(height,properties_t::CDC_MIN_TEXTURE_HEIGHT);
2724

2825
asset::ICPUImage::SCreationParams imgInfo;
2926
imgInfo.type = asset::ICPUImage::ET_2D;

src/nbl/asset/utils/CIESProfileParser.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,9 @@ bool CIESProfileParser::parse(CIESProfile& result)
226226
{
227227
const uint32_t maxDimMeasureSize = core::sqrt(FULL_SOLID_ANGLE/smallestRangeSolidAngle);
228228
result.accessor.properties.optimalIESResolution = decltype(result.accessor.properties.optimalIESResolution){ maxDimMeasureSize, maxDimMeasureSize };
229-
result.accessor.properties.optimalIESResolution *= 2u; // safe bias for our bilinear interpolation to work nicely and increase resolution of a profile
229+
auto& res = result.accessor.properties.optimalIESResolution *= 2u; // safe bias for our bilinear interpolation to work nicely and increase resolution of a profile
230+
res.x = core::max(res.x,CIESProfile::properties_t::CDC_MIN_TEXTURE_WIDTH);
231+
res.y = core::max(res.y,CIESProfile::properties_t::CDC_MIN_TEXTURE_HEIGHT);
230232
}
231233

232234
assert(nonZeroEmissionDomainSize >= 0.f);

0 commit comments

Comments
 (0)