Skip to content

Commit b75ae29

Browse files
committed
update ImGUI.cpp to use nice hlsl vectors
1 parent 9ee0327 commit b75ae29

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,21 +1107,21 @@ bool UI::render(IGPUCommandBuffer* const commandBuffer, ISemaphore::SWaitInfo wa
11071107
else
11081108
commandBuffer->setScissor(scissors);
11091109
}
1110-
1110+
11111111
// get structs for computing the NDC coordinates ready
11121112
struct TRS
11131113
{
1114-
vector2df_SIMD scale;
1115-
vector2df_SIMD translate;
1114+
float32_t2 scale;
1115+
float32_t2 translate;
11161116

1117-
vector2df_SIMD toNDC(vector2df_SIMD in) const
1117+
float32_t2 toNDC(float32_t2 in) const
11181118
{
11191119
return in * scale + translate;
11201120
}
11211121
};
11221122
const TRS trs = {
1123-
.scale = vector2df_SIMD{ 2.0f / drawData->DisplaySize.x , 2.0f / drawData->DisplaySize.y },
1124-
.translate = vector2df_SIMD { -1.0f, -1.0f } - vector2df_SIMD{ drawData->DisplayPos.x, drawData->DisplayPos.y }*trs.scale,
1123+
.scale = float32_t2{ 2.0f / drawData->DisplaySize.x , 2.0f / drawData->DisplaySize.y },
1124+
.translate = float32_t2 { -1.0f, -1.0f } - float32_t2{ drawData->DisplayPos.x, drawData->DisplayPos.y }*trs.scale,
11251125
};
11261126

11271127
// everything binds the buffer once at base and works via local offsets
@@ -1358,8 +1358,8 @@ bool UI::render(IGPUCommandBuffer* const commandBuffer, ISemaphore::SWaitInfo wa
13581358
{
13591359
return std::round<int16_t>(std::clamp(ndc, -1.0f, 1.0f) * 32767.0f); // TODO: ok encodePixels<EF_R16_SNORM, double>(void* _pix, const double* _input) but iirc we have issues with our encode/decode utils
13601360
};
1361-
const auto vMin = trs.toNDC(vector2df_SIMD(scissor.offset.x, scissor.offset.y));
1362-
const auto vMax = trs.toNDC(vector2df_SIMD(scissor.offset.x + scissor.extent.width, scissor.offset.y + scissor.extent.height));
1361+
const auto vMin = trs.toNDC(float32_t2(scissor.offset.x, scissor.offset.y));
1362+
const auto vMax = trs.toNDC(float32_t2(scissor.offset.x + scissor.extent.width, scissor.offset.y + scissor.extent.height));
13631363
struct snorm16_t2_packed
13641364
{
13651365
int16_t x, y;

0 commit comments

Comments
 (0)