Skip to content

Commit e1de225

Browse files
committed
minor fixes to uint16_t2 dim 4
1 parent b63fa26 commit e1de225

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/nbl/builtin/hlsl/sampling/quantized_sequence.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct QuantizedSequence<T, Dim NBL_PARTIAL_REQ_BOT(impl::SequenceSpecialization
185185
void set(const uint16_t idx, const store_type value)
186186
{
187187
assert(idx >= 0 && idx < Dim);
188-
data = glsl::bitfieldInsert(data, value >> DiscardBits, BitsPerComponent * idx, BitsPerComponent);
188+
data = glsl::bitfieldInsert(data, scalar_type(value >> DiscardBits), BitsPerComponent * idx, BitsPerComponent);
189189
}
190190

191191
template<typename F, bool FullWidth>
@@ -346,7 +346,7 @@ struct QuantizedSequence<T, Dim NBL_PARTIAL_REQ_BOT(is_same_v<T,uint16_t2> && Di
346346
static this_t create(const vector<scalar_type, Dimension> value)
347347
{
348348
this_t seq;
349-
seq.data = hlsl::promote<store_type>(0u);
349+
seq.data = store_type(0u,0u);
350350
NBL_UNROLL for (uint16_t i = 0; i < Dimension; i++)
351351
seq.set(i, value[i]);
352352
return seq;
@@ -361,7 +361,7 @@ struct QuantizedSequence<T, Dim NBL_PARTIAL_REQ_BOT(is_same_v<T,uint16_t2> && Di
361361
}
362362
else // z w
363363
{
364-
return glsl::bitfieldExtract(data[1], BitsPerComponent * (idx & uint16_t(1u)), BitsPerComponent);
364+
return glsl::bitfieldExtract(data[1], BitsPerComponent * (idx - uint16_t(2u)), BitsPerComponent);
365365
}
366366
}
367367

@@ -375,7 +375,7 @@ struct QuantizedSequence<T, Dim NBL_PARTIAL_REQ_BOT(is_same_v<T,uint16_t2> && Di
375375
}
376376
else // z w
377377
{
378-
data[1] = glsl::bitfieldInsert(data[1], trunc_val, BitsPerComponent * (idx & uint16_t(1u)), BitsPerComponent);
378+
data[1] = glsl::bitfieldInsert(data[1], trunc_val, BitsPerComponent * (idx - uint16_t(2u)), BitsPerComponent);
379379
}
380380
}
381381

0 commit comments

Comments
 (0)