Skip to content

Commit ffd0b9c

Browse files
authored
Emit pointers for CPU target. (shader-slang#1418)
Co-authored-by: Yong He <yhe@nvidia.com>
1 parent dfc9100 commit ffd0b9c

11 files changed

+478
-306
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ build.*/
2222
*.expected.png
2323
*.actual.png
2424
*.actual.txt
25+
*.slang-repro
2526

2627
tests/**/*.exp
2728
tests/**/*.lib
2829
tests/**/*.dll
2930
tests/**/*.cpp
31+
tests/**/*.slang-lib
32+
tests/**/*.slang-module
3033

3134
# Files generated by other shader compilers
3235

prelude/slang-cpp-scalar-intrinsics.h

+14-14
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ SLANG_FORCE_INLINE float F32_fmod(float a, float b) { return ::fmodf(a, b); }
8080
SLANG_FORCE_INLINE float F32_remainder(float a, float b) { return ::remainderf(a, b); }
8181
SLANG_FORCE_INLINE float F32_atan2(float a, float b) { return float(::atan2(a, b)); }
8282

83-
SLANG_FORCE_INLINE float F32_frexp(float x, float& e)
83+
SLANG_FORCE_INLINE float F32_frexp(float x, float* e)
8484
{
8585
int ei;
8686
float m = ::frexpf(x, &ei);
87-
e = float(ei);
87+
*e = float(ei);
8888
return m;
8989
}
90-
SLANG_FORCE_INLINE float F32_modf(float x, float& ip)
90+
SLANG_FORCE_INLINE float F32_modf(float x, float* ip)
9191
{
92-
return ::modff(x, &ip);
92+
return ::modff(x, ip);
9393
}
9494

9595
SLANG_FORCE_INLINE uint32_t F32_asuint(float f) { Union32 u; u.f = f; return u.u; }
@@ -147,33 +147,33 @@ SLANG_FORCE_INLINE double F64_fmod(double a, double b) { return ::fmod(a, b); }
147147
SLANG_FORCE_INLINE double F64_remainder(double a, double b) { return ::remainder(a, b); }
148148
SLANG_FORCE_INLINE double F64_atan2(double a, double b) { return ::atan2(a, b); }
149149

150-
SLANG_FORCE_INLINE double F64_frexp(double x, double& e)
150+
SLANG_FORCE_INLINE double F64_frexp(double x, double* e)
151151
{
152152
int ei;
153153
double m = ::frexp(x, &ei);
154-
e = float(ei);
154+
*e = float(ei);
155155
return m;
156156
}
157157

158-
SLANG_FORCE_INLINE double F64_modf(double x, double& ip)
158+
SLANG_FORCE_INLINE double F64_modf(double x, double* ip)
159159
{
160-
return ::modf(x, &ip);
160+
return ::modf(x, ip);
161161
}
162162

163-
SLANG_FORCE_INLINE void F64_asuint(double d, uint32_t& low, uint32_t& hi)
163+
SLANG_FORCE_INLINE void F64_asuint(double d, uint32_t* low, uint32_t* hi)
164164
{
165165
Union64 u;
166166
u.d = d;
167-
low = uint32_t(u.u);
168-
hi = uint32_t(u.u >> 32);
167+
*low = uint32_t(u.u);
168+
*hi = uint32_t(u.u >> 32);
169169
}
170170

171-
SLANG_FORCE_INLINE void F64_asint(double d, int32_t& low, int32_t& hi)
171+
SLANG_FORCE_INLINE void F64_asint(double d, int32_t* low, int32_t* hi)
172172
{
173173
Union64 u;
174174
u.d = d;
175-
low = int32_t(u.u);
176-
hi = int32_t(u.u >> 32);
175+
*low = int32_t(u.u);
176+
*hi = int32_t(u.u >> 32);
177177
}
178178

179179
// Ternary

0 commit comments

Comments
 (0)