shaders icon indicating copy to clipboard operation
shaders copied to clipboard

some standard mathematical functions are missing in std

Open Clothoid1 opened this issue 4 years ago • 2 comments

This is a minor issue, i am just reporting this so that this does not get lost.

When trying to use std::sqrtf() std::fabsf() std::powf() ... and compiling with circle to SPIR-V binaries, one gets the error message: 'sqrtf' is not a member of std

In modern C++ such code should work, so circle should be able to compile such code. (knowing that a workaround is trivial - so really a low prio issue)

Clothoid1 avatar Nov 25 '21 17:11 Clothoid1

Can you submit a repro case? sqrtf is definitely supported by the backend.

seanbaxter avatar Nov 26 '21 23:11 seanbaxter

I can reproduce it with a very simple compute shader:

#include <cmath>

float sqrt_float(float aValue_in) { return std::sqrtf(aValue_in); }

[[using spirv:comp, local_size(8, 8, 1)]] void main() { uint x = glcomp_GlobalInvocationID.x; uint y = glcomp_GlobalInvocationID.y; }

when i compile that (stored in a file test.cxx) with ./circle -shader -c -emit-spirv test.cxx i get the error message: 'sqrtf' is not a member of namespace std

Clothoid1 avatar Nov 29 '21 10:11 Clothoid1