ispc / ispc/ispc

Short vectors are not generated in C++ header

Open
#2,016 1 comment 0 reactions 1 assignee Claimed by @dbabokin View on GitHub
Header Generation
Dominant language
C++
Stars
3k
Forks
352
PR merge metrics
No merged PRs in 30d

Description

In a very special case the short vectors are not generated in the C++ header file. If you use short vectors in a function prototype and this function proto is used in an exported struct, the generated header does not contain a definition for used short vectors. This leads to compile issues in the host code. Here is a minimal example to reproduce the issue:

```
struct MyStruct;

typedef void (*MyFunc)(varying float<2>&a, uniform int<2>& b);

struct MyStruct {
uniform MyFunc func;
int data;
};

export void my_struct_init(uniform MyStruct& my_struct) {
my_struct.func = NULL;
}
```

The function prototype generated in the C++ header is partially wrong.

```
#ifndef __ISPC_STRUCT_MyStruct__
#define __ISPC_STRUCT_MyStruct__
struct MyStruct {
void ( * func)(float2 &a, int32_t2 &b);
int32_t data;
};
#endif
```

**a** is a varying type and hence should be (with regard to the documentation) a pointer to float2. Further Ispc does not generate a definition for float2 which leads to compiler error: _syntax error: identifier 'float2'_

I use ISPC 1.5.0. I do not tested it with other versions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.