Skip to content

Commit a0f2131

Browse files
Fix linker errors, Thank God HLSL likes the inline keyword
1 parent d6b269b commit a0f2131

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/nbl/builtin/hlsl/surface_transform.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ enum class FLAG_BITS : uint16_t
2828
};
2929

3030
// define everything else in terms of this
31-
float32_t2x2 transformMatrix(const FLAG_BITS transform)
31+
inline float32_t2x2 transformMatrix(const FLAG_BITS transform)
3232
{
3333
switch (transform)
3434
{
@@ -65,7 +65,7 @@ float32_t2x2 transformMatrix(const FLAG_BITS transform)
6565

6666
//! [width,height] might switch to [height, width] in orientations such as 90°CW
6767
//! Usecase: Find out how big the viewport has to be after or before a tranform is applied
68-
uint16_t2 transformedExtents(const FLAG_BITS transform, const uint16_t2 screenSize)
68+
inline uint16_t2 transformedExtents(const FLAG_BITS transform, const uint16_t2 screenSize)
6969
{
7070
switch (transform)
7171
{
@@ -85,7 +85,7 @@ uint16_t2 transformedExtents(const FLAG_BITS transform, const uint16_t2 screenSi
8585
return uint16_t2(0);
8686
}
8787

88-
float transformedAspectRatio(const FLAG_BITS transform, const uint16_t2 screenSize)
88+
inline float transformedAspectRatio(const FLAG_BITS transform, const uint16_t2 screenSize)
8989
{
9090
const uint16_t2 newExtents = transformedExtents(transform,screenSize);
9191
return float(newExtents[1])/float(newExtents[0]);
@@ -98,7 +98,7 @@ float transformedAspectRatio(const FLAG_BITS transform, const uint16_t2 screenSi
9898
//! Warnings:
9999
//! - You don't need to consider this using in your raytracing shaders if you apply the forward transformation to your projection matrix.
100100
//! - Be aware that almost always you'd want to do a single transform in your rendering pipeline.
101-
uint16_t2 applyInverseToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
101+
inline uint16_t2 applyInverseToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
102102
{
103103
// TODO: use inverse(transformMatrix(transform)) somehow
104104
const uint16_t2 lastTexel = screenSize - uint16_t2(1,1);
@@ -130,7 +130,7 @@ uint16_t2 applyInverseToScreenSpaceCoordinate(const FLAG_BITS transform, const u
130130
//! Usecase = [Scatter]:
131131
//! When directly writing to your swapchain using `imageStore` in order to match the orientation of the device relative to it's natural orientation.
132132
//! Warning: Be aware that almost always you'd want to do a single transform in your rendering pipeline.
133-
uint16_t2 applyToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
133+
inline uint16_t2 applyToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t2 coord, const uint16_t2 screenSize)
134134
{
135135
// TODO: use transformMatrix(transform) somehow
136136
const uint16_t2 lastTexel = screenSize - uint16_t2(1, 1);
@@ -162,7 +162,7 @@ uint16_t2 applyToScreenSpaceCoordinate(const FLAG_BITS transform, const uint16_t
162162
//! If rendering to the swapchain, you may use this function to transform the NDC coordinates directly
163163
//! to be fed into gl_Position in vertex shading
164164
//! Warning: Be aware that almost always you'd want to do a single transform in your rendering pipeline.
165-
float32_t2 applyToNDC(const FLAG_BITS transform, const float32_t2 ndc)
165+
inline float32_t2 applyToNDC(const FLAG_BITS transform, const float32_t2 ndc)
166166
{
167167
return mul(transformMatrix(transform),ndc);
168168
}

0 commit comments

Comments
 (0)