Skip to content

Commit d125a0e

Browse files
committed
pack rwmc params to half 2x16
1 parent 27fd427 commit d125a0e

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

include/nbl/builtin/hlsl/rwmc/CascadeAccumulator.hlsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ struct CascadeAccumulator
6969
// most of this code is stolen from https://cg.ivd.kit.edu/publications/2018/rwmc/tool/split.cpp
7070
void addSample(uint32_t sampleCount, input_sample_type _sample)
7171
{
72-
const cascade_layer_scalar_type log2Start = splattingParameters.log2Start;
73-
const cascade_layer_scalar_type log2Base = splattingParameters.log2Base;
72+
const float32_t2 unpackedParams = hlsl::unpackHalf2x16(splattingParameters.packedLog2);
73+
const cascade_layer_scalar_type log2Start = unpackedParams[0];
74+
const cascade_layer_scalar_type log2Base = unpackedParams[1];
7475
const cascade_layer_scalar_type luma = getLuma(_sample);
7576
const cascade_layer_scalar_type log2Luma = log2<cascade_layer_scalar_type>(luma);
7677
const cascade_layer_scalar_type cascade = log2Luma * 1.f / log2Base - log2Start / log2Base;

include/nbl/builtin/hlsl/rwmc/SplattingParameters.hlsl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ namespace rwmc
1212

1313
struct SplattingParameters
1414
{
15-
float log2Start;
16-
float log2Base;
15+
// float16_t log2Start; 0
16+
// float16_t log2Base; 1
17+
// pack as Half2x16
18+
int32_t packedLog2;
1719
};
1820

1921
}

0 commit comments

Comments
 (0)