Skip to content

Commit 791ef1c

Browse files
committed
fix runtime issues after shaders update
1 parent c4f4470 commit 791ef1c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,19 +1166,20 @@ namespace nbl::ext::imgui
11661166

11671167
auto packSnorm16 = [](float ndc) -> int16_t
11681168
{
1169-
return std::round<int16_t>(std::clamp(ndc, -1.0f, 1.0f) * 32767.0f);
1169+
return std::round<int16_t>(std::clamp(ndc, -1.0f, 1.0f) * 32767.0f); // TODO: ok encodePixels<asset::EF_R16_SNORM, double>(void* _pix, const double* _input) but iirc we have issues with our encode/decode utils
11701170
};
11711171

1172-
auto packToUint32 = [](uint16_t x, uint16_t y) -> uint32_t
1172+
const auto vMin = trs.toNDC(core::vector2df_SIMD(scissor.offset.x, scissor.offset.y));
1173+
const auto vMax = trs.toNDC(core::vector2df_SIMD(scissor.offset.x + scissor.extent.width, scissor.offset.y + scissor.extent.height));
1174+
1175+
struct snorm16_t2_packed
11731176
{
1174-
return (static_cast<uint32_t>(x) << 16) | static_cast<uint32_t>(y);
1177+
int16_t x, y;
11751178
};
11761179

1177-
const auto vMin = trs.toNDC(core::vector2df_SIMD(scissor.offset.x, scissor.offset.y));
1178-
const auto vMax = trs.toNDC(core::vector2df_SIMD(scissor.offset.x + scissor.extent.width, scissor.offset.y + scissor.extent.height));
1180+
reinterpret_cast<snorm16_t2_packed&>(element->aabbMin) = { .x = packSnorm16(vMin.x), .y = packSnorm16(vMin.y) };
1181+
reinterpret_cast<snorm16_t2_packed&>(element->aabbMax) = { .x = packSnorm16(vMax.x), .y = packSnorm16(vMax.y) };
11791182

1180-
element->aabbMin = packToUint32(packSnorm16(vMin.x), packSnorm16(vMin.y));
1181-
element->aabbMax = packToUint32(packSnorm16(vMax.x), packSnorm16(vMax.y));
11821183
element->texId = pcmd->TextureId.textureID;
11831184
element->samplerIx = pcmd->TextureId.samplerIx;
11841185
}

0 commit comments

Comments
 (0)